testRTC offers specialized assertion and expectation commands that are meant to automatically determine the pass/failure status of a test run or a monitor run.
These mechanisms are listed here:
Expectations are special testRTC mechanisms that are calculated at the end of a test run or a monitor run. These can be used to look at metrics and determine if a test passed or failed based on user defined thresholds.
- .rtcSetTestExpectation() – used for calculation of predefined expectations built into testRTC
- .rtcSetEventsExpectation() – used for calculation of predefined expectations built into testRTC between certain events
- .rtcSetCustomExpectation() – used for developer-specific calculated expectations
- .rtcSetCustomEventsExpectation() – used for developer-specific calculated events-based expectations
Forced warnings and failures
You can explicitly force failure or warning in the probe or the whole test.
- .rtcWarning() – add a warning to the probe’s status with a specific warning message
- .rtcFail() – fail the probe in the test with a specific error message
- .rtcFailAll() – fail the probe and attempt to stop the test by failing all probes in the test with a specific error message
Nightwatch scripting language has its own assertion mechanisms that can be used in testRTC. Our suggestion is to try and use the above primitives instead where possible.