The Arrange-Act-Assert (AAA) pattern should be followed when writing a UITest, to achieve the best results and fast feedback from the test. As the name suggests, it consists of three steps:
- Arrange: Eponymously, this step contains all the actions that help arrange the test, for example, initialization of things required later while running the test, setting up the environment, and much more.
- Act: This is when the test performs the desired interaction with the application, such as entering text, pushing a button, and so on.
- Assert: Assert is when our UITest asserts whether the interaction gave us the desired outcome or not, such as verifying that an error message was displayed.