5.14. How to Create Semi-Automatic Tests that Query for User Input

The most common use case for Squish tests is full automation—Squish is used to record a test (or we write a test manually), and then plays the test back and reports the results. But in some situations we might want to create a semi-automatic test that requires the tester to provide some input. For example, when testing some software with a hardware device we might want to ask the user who is running the test if the device's state has been changed in the expected way.

For example, imagine that we want to write tests for some printer-related software. The tests exercise the software, and one of the results should be that the printer prints a page with the text “This is a test”.

Since Squish can't verify a physical occurrence such as a page coming out of the printer with some specific text on it, any test that has such a requirement must rely on the tester to inform Squish whether the test passed or failed. Squish offers the testInteraction Functions (Section 6.3.17). for such purposes.