4

I have a python project that houses four subprojects that kind of go together but are kept in the same github repository as they are logically separate. So my project directory structure is like below. . ├── project1 ├── project2 ├── project3 ├── project4 ├── Jenkinsfile ├── README.md ├── requirements.txt

I have a jenkins build which builds all the projects. It launches pytest to run all the test. I can see that its running all the test and coverage.xml is created for all the projects.

I want to create cobertura to check the coverage reports. In my jenkins build script I first run the pytest command and then rename the coverage.xml to project specific like project1_coverage.xml

At the end I have the following steps in my jenkins file.

// Cobertura test coverage
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'proj1_coverage.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'proj2_coverage.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'proj3_coverage.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: 'proj4_coverage.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])

```

Its creating 4 reports but its only reporting report for one of the files or the first file. How can I make cobertura report the data in all the coverage.xml files.

Thanks a lot.

joydeep bhattacharjee
  • 1,249
  • 4
  • 16
  • 42
  • I have the same issue, do you have any new findings? seems that cobertura just moves the report file and names it coverage.xml. So even if there are 4 reports it's all about 1 file and all the coverage report links have the same URL – fersarr Feb 14 '18 at 10:22
  • Nope. The issue still there. Right now I run the whole pytest together and create a single coverage file. The developers in the organisation have grown comfortable with seeing the combined report and just look at the individual files for coverage. Personally I believe its for the better as it would give less incentive for having all the projects in one repo and not separate projects in separate repos. – joydeep bhattacharjee Feb 16 '18 at 11:19
  • @joydeepbhattacharjee How did you rename the cobertura coverage.xml? Is there a configuration to change the file name? – user911 Jul 08 '18 at 16:33
  • I had used a simple bash mv command but that did not work. I dont know if there is any configuration to change the file name. – joydeep bhattacharjee Jul 13 '18 at 05:51

0 Answers0