Eugen Martynov
Eugen Martynov

Reputation: 20130

Python sonar doesn't collect tests

I have next in my config:

sonar.sources=dev
sonar.python.xunit.reportPath=parts/jenkins-test/testreports/*.xml
sonar.dynamicAnalysis=reuseReports

I see test xml files which are junit format (jenkins also process them correctly).

When I run sonar-runner I see:

23:26:54.094 INFO  - Processing report '..././parts/jenkins-test/testreports/widget.tests.test_widget.TestLookup.xml'
23:26:54.094 INFO  - Parsing report '..././parts/jenkins-test/testreports/widget.tests.test_widget.TestLookup.xml'
2

But I don't see any test on sonar dashboard. I use sonar 4.3 version and runner 2.4 version.

UPD If I run sonar-runner with --debug I see next in the log:

09:53:29.619 INFO  - Parsing report '..././parts/jenkins-test/testreports/md.authentication.tests.test_tokenauth.TestTokenAuthenticatorTestCase.xml'
09:53:29.620 DEBUG - Cannot find the resource for authentication.tests.test_tokenauth.TestTokenAuthenticatorTestCase, creating a virtual one
09:53:29.620 DEBUG - Saving test execution measures for file 'authentication.tests.test_tokenauth.TestTokenAuthenticatorTestCase' under resource 'org.sonar.api.resources.File@4336db7c[key=<null>,deprecatedKey=authentication.tests.test_tokenauth.TestTokenAuthenticatorTestCase,path=<null>,dir=<null>,filename=authentication.tests.test_tokenauth.TestTokenAuthenticatorTestCase,language=Python]'

Upvotes: 0

Views: 1197

Answers (1)

Rafael
Rafael

Reputation: 583

are these, authentication.tests, python packages? Is this on Unix? see maybe related here: http://sonarqube.15.x6.nabble.com/Python-coverage-information-not-showing-up-in-Sonar-td5005729.html

Btw, I have the same issue, can display test coverage, but not unit tests stats...

Looking into PythonXunitSensor's code, looks like it is failing finding

authentication/tests/test_tokenauth.py from that SonarQube's step working directory, perhaps worth checking that path as well.

Cheers, Rafael.

Upvotes: 1

Related Questions