I was talking to a customer and they wanted to test a CRM application. There test scenario more or less like below image. They wanted to execute Entry Test and Exit Test only once and Main Test any number of times. When we do manual testing of this scenario this is usual kind of test cases. However automating this test is not that simple. In this post we will take a look that how Test Studio simplify automating this type of test scenario.
Let us assume you need to automate a test for following scenario,
Test Step 1: Login to application
Test Step 2: Perform various operations
Test Step 3: Logout from application
Requirement is that user will Login only once, perform operations any number of times and then logout from application. Essentially step 1 and step 3 will be executed by user only once and step 2 will be executed any number of times. Iteration of step 2 depends on external data source. This may be usual automated testing scenario you always come across.
Now let us assume that you have recorded test as following,
In above test we are data driving step 6. We are performing usual data driven testing. Problem with this approach is that each steps will get executed number of times depending on rows in data source. So if there are 10 rows in test data then this each test steps will be executed 10 times.
Our requirement is different in above test steps we want to execute only test step 6 ten times and other test steps only once. Let us see how we can do this.
Step 1: Move test steps you want to execute many times in different test. Let us call this test as INNERTEST
Step 2: Make sure to data bind the INNERTEST
Step 3: Record OUTERTEST. In OUTERTEST record all the steps you want to execute only once.
So in above recorded test we can record step 6 as separate test. We are calling that test as INNERTEST. This test is data bind.
This INNERTEST will contain all the test steps we want to execute repeatedly. In this case we have test step in INNERTEST.
After recording INNERTEST, let us go ahead and record OUTERTEST. We need to put all test need to executed only once part of this test. So all test steps for Login and Logout will be part of OUTESTEST. You notice that we want these test steps to be executed only once.
Now from ribbon add a Test as step in OUTERTEST.
You need to choose INNERTEST as test as step to be part of OUTERTEST
We have added INNERTEST as test as step in OUTERTEST at step 6.
Now on execution of test you will find that all test steps are getting executed only once however test steps of INNERTEST will executed many times depending on number of rows of data source. So we can conclude that
In this way you can work with multilevel test using Test Studio. I hope you find this test useful. Thanks for reading.