Imported test execution data ignored

1,241 views
Skip to first unread message

brice.r...@gmail.com

unread,
Apr 3, 2018, 11:41:22 AM4/3/18
to SonarQube
Hello,

I'm trying to import test result from generic XML but tests are not imported:
sonar:sonar -Dsonar.testExecutionReportPaths=/test/tools/pic/workspace/sb_maven/result.xml -Dsonar.test.inclusions=integration/testcase/**/Test*.java -Dsonar.test.exclusions=integration/lib/**/*.java -Dsonar.host.url=http://xx.xx.xx.xx:9000/sonar ********

thi is the XML :
<testExecutions version="1">
  <file path="integration/testscase/sf/pda/TestChoixRegleVideMotifsAutorises.java">
    <testCase name="testChoixRegleVideMotifsAutorises" duration="35.846"/>
  </file>
  <file path="integration/testscase/sf/pdi/TestSaisieTexteIndexRegleSimu.java">
    <testCase name="testSaisieTexteIndexRegleSimu" duration="32.87"/>
  </file>
</testExecutions>

This is the console output part :

[INFO] Index files
[INFO] Excluded sources: 
[INFO]   integration/testcase/**/Test*.java ----> WHY ?
[INFO] Included tests: 
[INFO]   integration/testcase/**/Test*.java
[INFO] Excluded tests: 
[INFO]   integration/lib/**/*.java

...

INFO] Sensor Generic Test Executions Report
[WARNING] Property 'sonar.genericcoverage.unitTestReportPaths' is deprecated. Please use 'sonar.testExecutionReportPaths' instead.
[INFO] Parsing /test/tools/pic/workspace/sb_maven/result.xml
[INFO] Imported test execution data for 0 files
[INFO] Test execution data ignored for 2 unknown files, including:
integration/testscase/sf/pda/TestChoixRegleVideMotifsAutorises.java
integration/testscase/sf/pdi/TestSaisieTexteIndexRegleSimu.java

This project does not contain any source file. This contains only test scripts for external application testing (using Selenium).

Thank you for your help

G. Ann Campbell

unread,
Apr 3, 2018, 2:40:30 PM4/3/18
to SonarQube
Hi,

Guessing at your project structure, your integration test classes aren't located under `src/test`. Since you don't appear to have redefined `sonar.tests` then they wouldn't have been recognized by the analysis as tests, which would explain why they were considered "unknown files" when the test execution report was processed (because there were no "tests" by those names). 

You may have thought you handled that by setting up your test inclusions & exclusions, but they layer on top of test file identification. They say "of all the files that are tests, include/exclude this subset". But with an empty test set, that's not going to do you any good. And BTW, you should only need to set inclusions or exclusions (once you've properly identified which files are tests, that is).

I can't answer off-hand why your pattern was excluded as source files, but I'm betting this src-versus-test confusion plays into it.


HTH,
Ann
Message has been deleted

brice.r...@gmail.com

unread,
Apr 4, 2018, 3:29:05 AM4/4/18
to SonarQube
Hello,

Thank you for your answer.
Yes, tests classes are under src/test, like this : 'src/test/integration/testscase' ...
I've not redefined 'sonar.tests' property because doc says 'Not compatible with Maven, which retrieves test from the default location for Java Maven projects.'
What could help you for answer me ?

Thanks
Reply all
Reply to author
Forward
Message has been deleted
0 new messages