In functional regression testing there is both Positive and Negative testing. Typically, Positive testing is testing that affirms that a feature is functioning correctly. The workflow that captures this can be thought of as the 'happy' path.
While there can be different interpretations of the term 'Negative' testing, Negative testing for the purposes of this article is testing that ensures that the proper safeguards trigger when a feature is used incorrectly. Negative testing, effectively, affirms that 'unhappy' workflows with the potential to break an app cannot be followed.
Writing Negative Tests
With Rainforest, negative testing can be performed through testing the various safeguards that should be in place that prevent an unhappy workflow from being followed.
To make the results of negative testing as clear as possible, we've come up with a few test writing strategies to facilitate negative testing in Rainforest.
Write negative tests specifically to trigger an intended safeguard:
Negative tests are still regression tests, and as a best practice, individual regression tests should be written to produce a single and specific outcome. A negative test, following this principle, should have the triggering of an intended safeguard as it's end goal.
End a negative test when the intended safeguard is triggered:
Flowing from this, as the intent of a negative test to trigger an intended safeguard, the test should cover this flow should end when that safeguard is triggered. Testing beyond this goal would impart extraneous objectives on the test, making it less focused than it could be.
Results of Negative Testing
If negative tests are written deterministically with an end-goal in mind, the meaning of the results from can be identified from the passage or failure of the test. Simply put, the outcome of these tests should indicate the following:
- If a tester passes the last step of the test, the actions the testers performed while testing triggered the intended safeguards. The passage of a negative test means that no further action is needed.
- If a tester fails the last step of the test, the proper safeguard was not triggered as expected and the tester was able to proceed down an unhappy path. Failure of a negative test should send up a warning flag, as this indicates actions must be taken to troubleshoot why this safeguard was not triggered.
Rainforest displays the steps a tester took in the results of a test. Results of negative test follow this format, which allows problem areas with an app to be quickly identified and efficiently addressed.
If you have any questions about how to execute negative testing in Rainforest, please let us know at firstname.lastname@example.org!