One-day hands-on training
What is Approval Testing ?
Approval Testing is a technique that changes the way you design your check for pass or fail in an automated test case.
When designing a test case, we often talk about it having three parts. First, we set up the program in a known state, “Arrange”. Then we provoke some behaviour that we want to test, “Act”, and then we check the correct thing happened, “Assert”.
With Approval testing, you still need the “Arrange” and “Act” parts of the test, but it changes the way you do the “Assert” part. Instead of choosing a few aspects of program behaviour to make specific assertions about, you instead ask your program to report what has happened. When designing the test case, you examine the report, and judge whether it shows the program is behaving correctly. If you choose to ‘Approve’ this report, then subsequent test runs will simply compare the new report against this approved version. Any difference, and the test will fail.
What’s the benefit of Approval Testing?
The outcome from both an Assertion-based and Approval test is similar - a repeatable regression test that you can run at any time to check your program still works. The main advantage of Approval testing is that by default, it checks a whole report, rather than relying on your remembering to assert all the important things in each test case. It means you find bugs you never anticipated when you designed the test.
Planned learning outcomes:
- the three parts of an automated test case
- how to use Approval testing to find bugs in existing code
- how to use Approval testing to make Characterization tests for Legacy code
- how to use Approval testing to test Graphical User Interfaces without maintenance costs spiralling out of control
- differences in costs and benefits with Approval tests vs assertion-based tests
Attendees are welcome to bring questions or challenges from their own background.
Participants should already have some experience of test automation, for example with JUnit or Cucumber/Gherkin. There will not be any advanced programming, but test automation and scripting skills are needed.