I don't quite understand the function test.begin(String description, Number planned, Function suite)
. What is the parameter Number planed
for?
Number planned
is the number of asserts
that you expect to test. This is totally optional
and can be thought about as a a sanity check that your test script has actually completed fully.
The docs states:-
The planned argument is especially useful in case a given test script is abruptly interrupted leaving you with no obvious way to know it and an erroneously successful status.
An example:-
casper.test.begin('when testing foo', 3, function() {
test.assertEquals(1 === 1, '1 equals 1');
test.assertEquals(5 === 5, '5 equals 5');
test.done();
});
This test would actually fail as I have defined 3 planned asserts
but only 2 have succeeded (as there are only 2 asserts).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With