I would like to share my first steps with jenkins continous integration using siesta. In our project we have the goal to set up a well tested automated suite for our building process. Here siesta offers a good mechanism to do that, PhantomJS. We are using ExtJS for our GUI. There we have to write logic in JavaScript e.g. getting components when we need them, overriding existing features and so on. For all these stuff we use our jetty server to test this behaviour emulating database requests with ajax stores and json-files. This server is placed in our subversion system so every developer is able to access it. When jetty is placed in subversion it is really simple to execute our tests in jetty on jenkins For this testing process we need to batch some processes.
First we need a directory in the webapps folder of jetty where the tests are placed. In this folder the following directories are placed in. The test directory, the siesta sources, the test-harness.js and the test-harness.html. This has to commit to subversion to give jenkins the chance of knowing the sources. A setup from test-harness.js and the test-harness.html you can find here: https://www.bryntum.com/docs/siesta/#!/g ... ng_started
After your environment is setted up we have to batch the process for jenkins. The jenkins workflow looks like the following:
- Set up the project by copying the source files of the application under tests in your test folder of the webapps directory from the jetty server
- Run the jetty servers start.jar on jenkins with setting up a stop port and a stop key
- call phantomjs on localhost in jenkins with a JUnit report format
- after phantomjs passes all test with success or fail call the start.jar of jetty with the stop command using the stop key and stop port
- remove the project sources which were copied to the jettys webapps directory in jenkins for cleaning up the project again on jenkins and because of you do not want to have this in your subversion when you run this batch file on your local machine
My batch file Run_Siesta_Tests.bat looks like this:
set pathToCopyTo=jetty\webapps\myproject_test
xcopy /S /E /H /Y /Q ExtJsmyproject\resources %pathToCopyTo%\resources\
xcopy /S /E /H /Y /Q ExtJsmyproject\app %pathToCopyTo%\app\
xcopy /H /Y /Q ExtJsmyproject\app.js %pathToCopyTo%
xcopy /S /E /H /Y /Q jetty\webapps\myproject\data %pathToCopyTo%\data\
xcopy /S /E /H /Y /Q jetty\webapps\myproject\ext %pathToCopyTo%\ext\
xcopy /S /E /H /Y /Q jetty\webapps\myproject\language_theme_data %pathToCopyTo%\language_theme_data\
xcopy /H /Y /Q jetty\webapps\myproject\index.html %pathToCopyTo%
xcopy /H /Y /Q jetty\webapps\myproject\log4javascript.js %pathToCopyTo%
cd jetty
CALL start /B java -DSTOP.PORT=8079 -DSTOP.KEY=mysecret -jar start.jar
CALL webapps\myproject_test\siesta-1.1.7-trial\bin\phantomjs https://localhost:8090/myproject_test/test-harness.html --report-format JUnit --report-file ..\ui_unit_test.xml
CALL java -DSTOP.PORT=8079 -DSTOP.KEY=mysecret -jar start.jar --stop
rmdir /S /Q webapps\myproject_test\resources
rmdir /S /Q webapps\myproject_test\app
rmdir /S /Q webapps\myproject_test\data
rmdir /S /Q webapps\myproject_test\ext
rmdir /S /Q webapps\myproject_test\language_theme_data
del /Q webapps\myproject_test\app.js
del /Q webapps\myproject_test\index.html
del /Q webapps\myproject_test\log4javascript.js
@if errorlevel 1 pause
I hope this post is helpful for all siesta developers.
Thank you for all the help I got in this forum.
Best regards
Erik