Code Assertions in

WindowTester Pro

Interacting with an application under test (AUT) is only half of the story. In order to verify facts about the AUT, WindowTester Pro provides a rich assertion story.

Assertions at Recording-Time

During a recording session, a tester can create two kinds of assertions.

Locator-Specific Assertions

Using the assertion inspector, a tester can make assertions about properties of specific widgets located in the AUT. For example, if we are testing a wizard page, we might at some point want to verify that the "Finish" button is disabled. The generated code would look like this:

ui.assertThat(new ButtonLocator("Finish").isEnabled(false));

Assertion Hooks

If there is no existing locator-supported assertion for the property in question, a tester can use the recording control to create an assertion hook as a means to place-mark a spot where there is some state they want to check in the generated code. An assertion hook creates a code stub in the generated code where the developer can later define the logic of the assertion. An example assertion hook might look like so in the generated code:

public void verifyNetworkState() {
	//TODO: fill out assertion logic

Runtime Support for Assertions

The WindowTester Pro runtime provides a rich library of conditions that can be used to build assertions. For more on assertions see here.