Main menu

A fully-automated testing rig #6

29 July 2014

Part 6: Manually fail a test, but continue script execution

We set up an event to take screenshots of failed test pages, by hooking into the onFail event. This made for a problem when we wanted to pass or fail a test based on whether there were entries in the Drupal Watchdog table. Failing a test also would normally stop script execution, but we explicitly need our post script to finish its work!

CasperJS fortunately allows you both to pass and fail tests manually, and also to create your own events. We created a manual_fail event in our pre script, which we could call from our Watchdog test, to fail the test without causing a screenshot. As the onFail event is called from outside the post script, it can continue execution.

About the author

Nathan is a recent Masters of Computer Science graduate from the University of Warwick, and has lots of little chunks of experience in a variety of languages and arenas.
He is currently the main developer for our automated testing ambitions.