0

I am using Jenkins to run unit-tests on a Django project via django-jenkins.

Recently, I found that some of the unit-tests wasn't being executed (someone had mistakenly changed an import, causing Jenkins to miss some of the unit-test files).

Is there a way to assert on the number of tests that Jenkins executes?, or the number of test-packages?

nak
  • 690
  • 6
  • 15

1 Answers1

0

It could be tricky in python.

But you could add additional shell command that just looks into junit report.

cat reports/junit.xml | grep 'classname="your.missing.test.name"'

command would fail if grep doesn't found test record.

Or do the sudo apt-get install libxml-xpath-perl and assert on tests attibute value

[ $(xpath  -q -e '//@tests' reports/junit.xml) == 'tests="1"' ]
kmmbvnr
  • 5,863
  • 4
  • 35
  • 44