Jasmine CI and Capturing Test Result Output on Jenkins Server
continuous-integration, jasmine, jasmine-headless-webkit, ruby-on-rails
Solution
I use phantomjs in combination with a junit compatible xml reporter for jasmine. Then I simply use the JUnit Jenkins plugin.
The junit reporter and glue code can be found here:
https://github.com/larrymyers/jasmine-reporters
This github project by Larry Myers has a good example setup for this. It contains a rhino and a phantomjs setup. I have only tried the phantomjs part and I am really pleased.
Problem
Background: Have inherited a Ruby on Rails 3.1.x project which is in need of some BDD and testing for Javascript code. So following the Instructions I have added the jasmine gem for JS testing. This works ok via rake jasmine and gives me the local web-server accessible via http://some-host.com:8888/ Problem: What I want to do is use the tests on the CI server, which is running Jenkins. The Jenkins project is setup with the command `rake jasmine:ci` to run the CI variant of Jasmine. The output on the Jenkins build console log is below: ``` Waiting for jasmine server on 32901... jasmine server started. Waiting for suite to finish in browser ... ................ Finished in 0.00454 seconds 16 examples, 0 failures * Stopping Xvfb :66.0 Xvfb ...done. ``` I'd like to capture the output; as in the view that is generated from the Jasmine web server page and preserve this with the build run. I've tried the obvious of seeing if there is an `-o <filename.out>` option, but not had any success. Does anyone know how to capture the output in the context of running in a CI instance ? Does it require PhantomJS ?