Class
caplin.testing.fixture

TimeFixture

TimeFixture allows you to control when callbacks passed to window.setTimeout() and window.setInterval() are executed.
Currently setInterval() is not fully supported. It only fires once instead of repeating.

timeMode property
There are two modes supported by the TimeFixture:
  • 'NextStep' (default) - will automatically fire all timers at the end of each 'given, when or then' step (including 'and' steps)
  • 'Manual' - will stop the automatic-firing of timers on each 'given, when or then' step
passedBy property
When in 'Manual' mode, 'passedBy' is defined in milliseconds. Any function(s) registered to wait for a period less than (or equal to) the stated 'passedBy' value are then executed in ascending time order.

Example using 'NextStep' mode (default):
given("time.timeMode = 'NextStep'")
and(...)
// All timed events fired for the 'and' step above
and(...)
// All timed events fired for the 'and' step above
when(...)
// All timed events set up in the "when" step are fired
then(...)

Example using 'Manual' mode:
given("time.timeMode = 'Manual'")
and(...)
when(...)
and("time.passedBy => 2000")
// timed events from the 'given' and 'when' steps set to execute 2 seconds in the future are fired
then(...)

Constructor Summary

Attributes Name and Description
caplin.testing.fixture.TimeFixture( oTimeUtility)

Method Summary

Attributes Name and Description
void doGiven(String sPropertyName, Variant vValue)

void doThen(String sPropertyName, Variant vValue)

TimeFixture does not support doThen.

void doWhen(String sPropertyName, Variant vValue)

Methods implemented from class caplin.testing.Fixture:
addSubFixtures, canHandleProperty, setUp, tearDown

Constructor Detail

caplin.testing.fixture.TimeFixture( oTimeUtility)

Parameters
oTimeUtility

Method Detail

void doGiven(String sPropertyName, Variant vValue)

Parameters
String sPropertyName The property name (e.g. 'time.timeMode' or 'time.passedBy')
Variant vValue The value to set
See
caplin.testing.Fixture#doGiven

void doThen(String sPropertyName, Variant vValue)

TimeFixture does not support doThen.

Parameters
String sPropertyName The property name
Variant vValue The value to set
See
caplin.testing.Fixture#doThen

void doWhen(String sPropertyName, Variant vValue)

Parameters
String sPropertyName The property name (e.g. 'time.timeMode' or 'time.passedBy')
Variant vValue The value to set
See
caplin.testing.Fixture#doWhen