0
我曾嘗試AndroidStudio的代碼覆蓋功能,我遇到了一個奇怪的問題:類名稱被標記爲「未覆蓋」,而在運行Android的代碼覆蓋率工作室
它標誌着測試類的名稱爲「未覆蓋」碼。 這怎麼可能?這是一個錯誤?
圖片瀏覽:
正如你可以看到它有一個方法與4線,他們中的每一個被覆蓋。那麼,爲什麼班級名字上的紅線?
我曾嘗試AndroidStudio的代碼覆蓋功能,我遇到了一個奇怪的問題:類名稱被標記爲「未覆蓋」,而在運行Android的代碼覆蓋率工作室
它標誌着測試類的名稱爲「未覆蓋」碼。 這怎麼可能?這是一個錯誤?
圖片瀏覽:
正如你可以看到它有一個方法與4線,他們中的每一個被覆蓋。那麼,爲什麼班級名字上的紅線?
您正在使用static
方法,因此class
本身從未被創建爲object
,因此從不測試該能力。
好吧,如何測試一個靜態方法與覆蓋? –
http://stackoverflow.com/questions/9700179/junit-testing-helper-class-with-only-static-methods like this – Stefan