Record and playback is a really convenient way to record test cases, since it feels natural to just go through the UI. This makes the initial creation of tests to be really fast and convenient, but it makes things a little bit harder down the line when software start to change and the maintenance part kicks in.
We decided not to include it as part of our version 1 of SafetyNet because we don't do record and playback in our process. We wanted to invest in other methods that improve maintenance time and the goal was to be able to have scripts that tests the code we are shipping during the sprint.
So this our workflow:
- Record out UI Controls using mainly Area Recording
- Testers create their scripts using the UI Test Window
- To determine which controls need updating, we use Locate All Controls feature
- To find new controls, we use Repeat Area Recording
- To update controls that we currently use in our tests with new ones we use Update Control References
Area Recording
The point of area recording is to speed up the process of getting the controls we use for testing into our UI Maps. We create an UI Map per page or complex control(same as the Page Object Pattern), and is really easy to click a div or any html container and get all the elements recorded with unique css selector to identify it. Sometimes you want to only record links, so there is way to customize which types of controls get recorded and is documented here. In the future we are planning to support custom elements, meaning the user will be able to input a tag or css selector that would get recorded if it was found.
UI Test Window
The UI Test Window has everything a manual tester needs to create tests. Is Divided in Browser Actions, Test Functions and the UI Map Controls. At this point you need to drag any of the components into the test to create a step. In the future we will look into other ways to do this (i.e keyboard shortcuts to speed up the process)
You can also create Reusable Tests that encapsulate some logic that is repeated in multiple tests.
Locate All Controls
This feature is used to find which controls are missing in the UI Map, so you can quickly assess whether the tests associated with this UI Map will fail. Documentation here.
Repeat Area Recording
This feature loops through all the areas you currently have in the UI Map and repeats the recording using the last settings you used. It will find new controls and add them automatically to the UI Map. Unless the UI is drastically changed, this controls will be old ones that have changed enough that its CSS selector can not be used to find them anymore. More info here.
Update Control References
You can use this feature to update the properties of an old control with one it was just recorded. More here.
This simple to use features help us to quickly react to UI Changes or to new requirements in our tests. If you want to try them, follow this guide to get started with SafetyNet UIMaps for Visual Studio.