2013-03-19 107 views
12

我剛剛分離了單元測試和集成測試。我想將UT和IT的覆蓋率結果分開。聲納故障安全測試結果

我跟着this tutorial,它的工作原理(感謝@JohnDobie)。

sonar coverage test results

聲納顯示單獨的代碼覆蓋結果和單元測試成功(右上)。但是,我怎樣才能在聲吶中獲得集成測試成功?

+0

應該詢問/遷移到超級用戶,不是嗎? – TheBlastOne 2013-03-19 10:31:34

+0

@TheBlastOne我不知道,超級用戶沒有任何聲納標籤。 – gontard 2013-03-19 10:34:37

+4

@TheBlast我不同意,聲納問題通常與編程有關。我懷疑超級用戶的人可以回答與單元測試和maven配置有關的問題。 – Sylar 2013-10-10 08:44:07

回答

10

等待IT執行結果聲納中的實現(請參閱@Fabriceanswer)。我在this tutorial中發現了一個解決方法。我們的想法是:

... fool Sonar to show test success for both unit and integration tests together by instructing Failsafe to store its test reports to the same directory as Surefire instead of the default failsafe-reports.

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-failsafe-plugin</artifactId> 
    <configuration> 
     <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> 
    </configuration> 
</plugin> 

結果是不完美的,因爲所有的測試結果在單元測試窗口小部件顯示。但我真的不想在ci服務器上檢查IT測試結果。我想爲我的項目提供一個全功能於一身的儀表板。

enter image description here

2

IT執行結果不會被推送或顯示在Sonar中。

這是我們未來可能添加的內容,但我們首先關注的是覆蓋範圍,畢竟這是最重要的。 (執行結果通常通過CI服務器上的CI軟件進行監控)

+10

因爲聲吶是一個「一體化」工具,所以必須檢查ci服務器是一件可惜的事情。 – gontard 2013-03-22 10:17:40

+2

我100%同意@gontard。 – diegomtassis 2014-02-05 15:25:15

+1

那麼,測試執行結果在SonarQube中真的沒用,因爲如果你運行SonarQube分析而你的項目有迴歸,你應該始終具有100%的成功率(因此0錯誤和0失敗)=>持續集成。 – 2014-02-06 11:10:15