Jenkins auto build when codeigniter unit test passes
-
17-06-2021 - |
Domanda
I'm using php-codeigniter framework and to perform unit-test I use simple-test framework.
Simple-test generates an xml report which is stored in a file while running test cases. Both the application and test-files are committed in jenkins.
Whenever I perform a commit I need unit_test.php to be run automatically and based on the xml file output the build should be generated.
Is there a possible way for it......?
Soluzione
You can start with the PHP templates for jenkins.
You will need to setup Apache Ant on your CI box and configure the xml template to run the differents metric you want, like phpUnit, phpLOC, phpMD, phpCPD, etc.
Based on the output on each metric, you can then flag if the build fail, pass or just keep the metric for further references.
For simple-test, you might have to dig a bit further since its not a documented procedure here is a link