How to use Step Groups in automated Test Cases?
In Testsigma, Step group is a collection of Test Steps that form actions in a Task and are run together to perform the Task. An Example for such task is Login process which consists of several small steps such as entering the login credentials and clicking on login button.
Testing login process of an application is common for many Test Cases. In that case, we can create a step group with the steps required for a login process and later we can use the same step group wherever we need to perform login thus avoiding creation of same steps redundantly. Only the login credentials such as username and password and UI identifiers for the page needs to be modified.
In Testsigma, Step Groups are implemented as a variation of Test Cases i.e you can create Step Groups in a manner similar to the creation of a Test Case. And once a Step Group is created, you can add a Step Group to a Test Case just like adding any other Test Step. The only difference is that a Test Step is a single step / action whereas a Step Group is a set of Test Steps.
Steps for creating and using a Step Group
Before adding a Step Group to a Test Case, we need to create one. Once the Step Group is created, we can start using them in our Test Cases.
The steps to be followed in creating and using a Step Group can be summarized as follows:
1.) First of all, create a Step Group using the Create Test Case page.
Please refer this article for more details on the creation of Step Groups - How To Create a Step Group?
2.) Secondly, add the required Test Steps to the Step Group just as we add Test Steps in Test Cases.
In our case, we can add steps for logging into an Application.
Please refer this article for more details on the creation of Test Steps - How to add/edit/delete automated test step?
Please check the last section - Usage of Test Data Profile in Step Groups for more details on adding Test Data Profile to Step Groups.
3.) Finally, navigate to the Test Case where we need to add the Step Group and perform the following steps:
a.) Click on the Create Test Step button to open the Create Test Step wizard as shown below:
b.) Select the Step Group radio button and the Action Text field changes to a Step Group selector containing already created Step Groups as shown below:
c.) Select the Step Group that you want to include in this Test Case, make the necessary changes in remaining fields if necessary and click on the Create button to add the Step Group in this Test Case.
Usage of Test Data profile in Step Groups
Although Test Data Parameters can be used in Test Steps created inside Step Groups, we need to make sure that the Test Data profile used in Test Steps inside the Step Group is same as the Test Data profile that is selected for the Test Case where the Step Group is added.
The steps followed for using Test Data Profile in Step Groups can be summarized as follows:
1.) Create a Test Data Profile and add the required Test Data Sets and Parameters to it. Also, note down the parameter names for usage in Step groups. Let us create a Test Case for testing the login process of OrangeHRM Website using data-driven Steps in a Step group. We will use a pair of valid and invalid login credentials as given below:
2.) Now, create a Step Group and add Test Steps to it.
As you can see the steps 2,3 are using Parameter Test Data with parameters from the Test Data profile created earlier. Please check this article for more details on usage of different Test Data types - Different types of test data and their usage in Testsigma
Note: We won't get suggestions for Test Data while creating Test Steps in Step Groups. That is why it is recommended to note down the parameter names while creating the Test Data Profile. This is because Test Data Profile is not linked to a Step Group and linking a Step Group removes its advantage of reusability in different cases.
3.) Create a Test Case and add the above Step Group to the Test Case.
4.) As you can see above, we have also add a final step to the Test Case to validate that login is successful.
- The page should display url https://opensource-demo.orangehrmlive.com/index.php/dashboard
5.) Finally, select the Test Data profile which contains the parameters in Step Group.
That's how we can perform data-driven Testing using Step Groups.