Runner Listeners
If you are creating runners and want to tap into the runner listeners or callbacks, you can do so by creating a class or a struct with the different events we announce.
Event
Description
onBundleStart
When each bundle begins execution
onBundleEnd
When each bundle ends execution
onSuiteStart
Before a suite (describe, story, scenario, etc)
onSuiteEnd
After a suite
onSpecStart
Before a spec (it, test, then)
onSpecEnd
After a spec
Every run
and runRaw
methods accepts a callbacks
argument, which can be a Class with the right listener methods or a struct with the right closure methods. This will allow you to listen to the testing progress and get information about it. This way you can build informative reports or progress bars.
class{
// Called at the beginning of a test bundle cycle
function onBundleStart( target, testResults ){
}
// Called at the end of the bundle testing cycle
function onBundleEnd( target, testResults ){
}
// Called anytime a new suite is about to be tested
function onSuiteStart( target, testResults, suite ){
}
// Called after any suite has finalized testing
function onSuiteEnd( target, testResults, suite ){
}
// Called anytime a new spec is about to be tested
function onSpecStart( target, testResults, suite, spec ){
}
// Called after any spec has finalized testing
function onSpecEnd( target, testResults, suite, spec ){
}
}
Last updated
Was this helpful?