As I managed to solve the problem myself, I thought it would be nice to share it. This approach may be flawless, but it is the first that seemed to work. Feel free to post improvements and suggestions.
What I did in a nutshell:
- Launch Xvfb Instance, Virtual Framebuffer
- Using JsTestDriver :
- run a Firefox instance in a virtual framebuffer (without a head)
- grab a Firefox instance and run the test suite
- generate JUnit-compatible .XML test results
- Use Bamboo to check the result file to transfer or fail assembly
Next I will talk about more detailed steps. This is what my directory structure looked like:
lib /
JsTestDriver.jar
test /
qunit /
equiv.js
QUnitAdapter.js
jsTestDriver.conf
run_js_tests.sh
tests.js
test-reports /
build.xml
On the build server:
- Install Xvfb (
apt-get install Xvfb ) - Install Firefox (
apt-get install firefox )
In your application to create:
server: http: // localhost: 4224
load:
# Load QUnit adapters (may be omitted if QUnit is not used)
- qunit / equiv.js
- qunit / QUnitAdapter.js
# Tests themselves (you'll want to add more files)
- tests.js
Create a script file to run unit tests and generate test results (example in Bash, run_js_tests.sh ):
#!/bin/bash
Create an Ant target that calls the script:
<target name="test"> <exec executable="cmd" osfamily="windows"> </exec> <exec executable="/bin/bash" dir="test" osfamily="unix"> <arg value="run_js_tests.sh" /> </exec> </target>
Finally, tell the Bamboo build plan both to invoke the test target and to search for JUnit test results. Here, the default is "**/test-reports/*.xml" .
miek Jan 15 2018-10-15T00: 00Z
source share