New to Telerik Test Studio? Download free 30-day trial

Test as Step

The Test as step feature allows you to run an existing test as a single step within another test. Using tests as step can help to reuse common automated steps across the project. This approach is also known as test modularization and includes breaking up the testing tasks into modules that do specific small functions on their own, but do not perform the complete end-to-end testing scenario.

This article describes how to add this type of step and demonstrates an example scenario.

Add Test as Step

Choose the Test as Step option from the Step Builder and click on the Add Step button in the lower right corner of the pane.

Step Builder Test as step

On the next screen you can choose a test to add among all tests of the same type (web, WPF, desktop) in the project. Pick a test from the list and confirm the selection with pressing the Select button.

Choose a Test to add as step

Important!

Tests set 'In development' and used as a step are always executed regardless their current state.

Group Recorded Steps as Test and Insert It as Step

To ease the process of separating the test steps into smaller modules, Test Studio also gives the option to choose some already recorded steps and move them into a test. This test directly gets added as a step in the original test.

Let's use the following example - loading a URL in clear browser session forces the popup to accept the cookies. Record the steps to confirm the selection in the current test and insert these into a if..else condition. As these are repetitive actions to include in any other scenario, you can separate them into a new test - select the steps and choose the Create Test as Step option from the Step Context Menu.

Select steps to create test as step

The next screen lists the selected steps and lets you set a meaningful name for the new test. Confirm the new test by pressing the Create button.

Name and create the Test as step

It is directly inserted as a step in the original test.

New test added as step

Example of Using Tests as Step

Below is a sample project automating Amazon.com:

Project

The sample Login test contains the following steps:

Login Test

Open the AddToCart test and insert the Login test to its beginning using the Test as Step option from the Step Builder. The Login test is added as a single step and all its steps gets executed before moving on to step 3 in this example.

Test

Important!

Tests set 'In development' and used as a step are always executed regardless their current state.

In this article