Jasmine CI and Capturing Test Result Output on Jenkins Server
Asked Answered
G

1

9

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 ?

Gwenni answered 29/4, 2013 at 11:48 Comment(0)
S
9

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.

Seow answered 7/5, 2013 at 11:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.