0

My group will be implementing CI using Jenkins. As such, I want to make sure that any unit and/or integration tests we create integrate easily with Jenkins. We have several different technologies in our stack we are using from C++ code to Oracle PL/SQL packages to Groovy code. We want to develop test drivers (code that wraps and tests these individual code units) that we can integrate with Jenkins so that these tests are automatically run when we perform commits (git) as well as on a nightly basis. My question is, what are the best practices for writing these test drivers so that they will easily integrate with Jenkins when we implement it?

For example, we have have a PL/SQL stored procedure that we want to run tests against as part of our CI testing. I could write a bash shell script that wraps calls to it, I could write a Java program that calls it. Basically I could wrap it in anything. Then the next question is...is there some sort of standard for outputting results so that Jenkins can easily determine if the test passed or failed?

GregH
  • 12,278
  • 23
  • 73
  • 109

2 Answers2

0

.is there some sort of standard for outputting results so that Jenkins can easily determine if the test passed or failed?

If your test results are compliant with Junit results,jenkins have junit plugin which give you the better way for tracing  test reports  (result trend graph) and also test result archiving. converting ant test log to Junit format easier one.

useful links:

http://nose2.readthedocs.org/en/latest/plugins/junitxml.html

https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Plugin

https://wiki.jenkins-ci.org/display/JENKINS/xUnit+Plugin

Jenkins and JUnit

Basically I could wrap it in anything.

I personally prefer to go with Java among your choices.because it give you better Api to create xml files

Community
  • 1
  • 1
DevD
  • 664
  • 5
  • 16
0

Use python unittest to wrap any of your tests. Produce junit xml test results.

One easy way of getting any python unittest to write out junit is from command-line.

yum install pytest

And call your test script like this:

py.test --junitxml result.xml testscript.py

And in jenkins build configuration Post-build actions Add a "Publish JUnit test result report" action with result.xml and any more test result files you produce.

https://docs.python.org/2.7/library/unittest.html

This is just one way of producing junit xml results with python. There are a good few other methods either using unittest module or junitxml or others.

gaoithe
  • 4,218
  • 3
  • 30
  • 38