JsTestDriver integration with Hudson
To install Hudson on your machine, you need to download it from http://hudson-ci.org/.
Run the following command to start Hudson:
java -jar hudson-2.2.0.war
You can start launching Hudson by typing the following address in your browser:
You should now be redirected to the Hudson home page.
Creating Hudson Job
First of all, you need to create a new Job in Hudson. You can do this by clicking on “New Job” and entering the Job name and selecting “Build a free-style software project” as shown in the figure below:
Configuring JsTestDriver with Hudson
Click the “Configure” link of the project. In the configuration page, enter the project description. In order to run the job periodically, you need to configure the “Build Triggers”. Check the “Build periodically” option and enter the cron-like expression. To run the job every 5 mins past the hour (for example), enter the following expression
5 * * * * as shown below in the figure:
In order to execute the JsTestDriver test command, you need to configure the “Build” section. There are many ways to do so, you can either add “Execute Shell”, “Invoke Ant or Maven2 or Maven3″, or “Execute Windows Batch command”. The latter case can be used when you are working on Windows environment. For the case of this example, I use the “Execute Windows Batch command” option and specify the path of the batch file as shown in the screenshot below:
The batch file has the following content:
java -jar JsTestDriver-1.3.4.b.jar --config jsTestDriver.conf --tests all --testOutput c:/outputFolder --reset
For the matter of simplicity, I assume that the JsTestDriver server is already started and some browsers are already captured. This step is not included in this post, however, This step also can be automated if required.
Testing the integration of JsTestDriver with Hudson
In order to test the integration of JsTestDriver with Hudson, this can be done by manually or automatically (as indicated in the “Build periodically” option). To test the integration manually, click on the “Build Now” link as shown in the screenshot below:
Click the “console output” link to check the output of the results:
setting runnermode QUIET Firefox: Reset ... Total 3 tests (Passed: 3; Fails: 0; Errors: 0) (3.00 ms) Firefox 12.0 Windows: Run 3 tests (Passed: 3; Fails: 0; Errors 0) (3.00 ms)
You may face this error while trying to run a new Job:
hudson java.io.IOException: Cannot run program "sh"
In order to fix this error, check this post: