Record a test once and reuse it by composing new tests upon it. Changes in the original test propagate to any dependent tests that referenced it at recording time.
Often individual test cases will share some prefix of test actions. For example, separate tests verifying that a user can create and delete events in a calendar application both share the same initial test steps for logging the user into the application. Reflect allows you to record that “Login” test once and then refer to it when creating both the “Create Event” and “Delete Event” tests. Both the “Create Event” and “Delete Event” tests are called composed tests in this case.
The primary benefits of composing tests are:
Record Once: you only need to perform the manual test steps once for a given test. Thereafter, you can refer to that test when creating new tests that depend on those actions. Reflect will execute the initial test and then enable the normal recording experience. This saves you time because Reflect will likely execute the initial test faster than you and it avoids the possibility of you making a mistake or changing the test steps in repeated recordings.
Update Once: since composed tests refer to an initial test, rather than copying it, any updates made to the initial test propagate to the composed tests. This means if a test fails for some reason, you only need to fix the test itself and all composed tests will automatically use the test updates. Another ancillary benefit is that composed tests do not execute subsequent test actions if an initial test fails, which allows you to establish sequential dependencies between tests.
Thus, test composition makes it easier and faster to record new tests and dramatically improves the maintainability of your test suite. Additionally, a composed test itself can be used as an “initial test” for a new recording, which enables the flexible chaining of user experiences branches through an application.
To record a composed test, there must be at least 1 existing test in your Reflect account. Click “Create Test” to open the test recording modal. Then, click “Start from an Existing Test”.
Select an existing test from the dropdown. The final URL for the selected existing test is the starting URL that the new test recording will use.
Finally, give the test a name and click “Begin Recording” to initiate the test. Reflect will initialize a new browser and execute the specified test. Then, it will enable the normal recording experience where you can record new test steps.
Viewing a composed test is no different from viewing a normal test. The primary difference is that the initial tests in a composed test are not modifiable when viewing a composed test. To modify a test that is used as an initial test, open the latest run for the initial test and modify it there. See the Viewing a Test Run section for more information.
You cannot delete tests that other tests are composed upon. To delete a test that other composed tests are referring to, first delete those other composed tests.