1

I'm trying to get sonar to produce code coverage reports and unit test results. I'm running my unit tests with JS Test Driver and using maven to send the results to sonar which is installed on an internal server machine.

I've managed to get the unit test results to show up, but when I look at the source for the individual test files in sonar I get:

"Could not find source for unit test: Chrome_280150095_Windows.ButtonTest in any of test directories"

Additionally the code coverage results do not appear although they are being generated. I have a feeling it's because the jsTestDriver.conf-coverage.dat file contains paths to code from the machine I'm running jstestdriver from, not the machine I'm using to host sonar.

Can I only run mvn sonar:sonar on a machine with sonar installed locally or can I do it remotely like I'm trying? Where will sonar pick up the source classes from?

I'm very new to sonar so forgive me if I'm doing something totally wrong!

Here are the various files involed:

pom: http://pastebin.com/N21rbZZ3
maven settings profile for sonar: http://pastebin.com/HZfPMF0f
mvn sonar:sonar output: http://pastebin.com/WvPf1Axf
jsTestDriver.conf-coverage.dat: http://pastebin.com/pYYx20A9
TEST-Chrome_280150095_Windows.ButtonTest.xml: http://pastebin.com/f97EHtYE

Thanks!

4

1 回答 1

2

使用 Maven 触发分析时,不考虑“sonar.sources”和“sonar.tests”等属性。请参阅http://docs.codehaus.org/display/SONAR/Analysis+Parameters。因此,您关于未找到的测试源代码的问题。当实现以下票证时,此行为最终会改变:http: //jira.codehaus.org/browse/SONAR-4536。同时,您应该使用 SonarQube Runner 来触发分析。

于 2013-08-14T11:53:11.523 回答