In this recipe, we demonstrate how to capture the CasperJS test output and persist it to disk in the XUnit format. This is important for tracking test performance over time and integrating CasperJS with continuous integration servers.
To run this recipe, the CasperJS binary must be installed and on our PATH
; we will also need a script that expects to use the CasperJS API, particularly the tester
module for executing assertions and tests. Lastly, we need to make sure that we have write permissions on the directory where CasperJS will write the XUnit report.
We will reuse the script from the previous recipe here. That script is available in the downloadable code repository as recipe08.js
under chapter05
. If we run the provided example script, we must change to the root directory for the book's sample code.
Lastly, the script in this recipe runs against the demo site that is included with the cookbook's sample code repository...