Generating test execution results xml file using python unittest executable

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube: Community Edition, Version 7.9.1 (build 27448)
    SonarScanner: sonar-scanner-4.3.0.2102-linux

  • what are you trying to achieve
    Trying to publish test execution results and code coverage metrics from Bamboo plan sonar scanner executable to SonarQube dashboard

  • what have you tried so far to achieve this
    Have a python project with unit tests executed using “unittest” and “coverage” executables, not using nose test runner as it not maintained in python community. To run unit tests, using the below commands from project root directory:
    python -m unittest discover
    coverage xml

“python -m unittest discover” executes the unit tests but doesn’t generate any .xml file with test execution results and “coverage xml” generates coverage.xml file in root directory. Hence, in “sonar-project.properties” file, we have “sonar.python.coverage.reportPaths=coverage.xml” but no value for “sonar.python.xunit.reportPath” property (We know nosetests and pytest executables will generate a xml file which can be plugged in here, but not for unittest exectable)

Hence, Bamboo sonar scanner command is not publishing any test execution metrics to Sonarqube dashboard. Any ideas on how to achieve this?