Though we can loop a certain set of steps with the help of addons, lets see how we can do the same with the help of TestProject features.
Scenario:
- Open https://example.testproject.io/web/
- Fill up Full Name, Password and click on Login button
- Fill up Country, Address, Email, Phone
What do we need?
Create a test case as application set up which will open the browser, load the url, and fill up Full Name, Password and click on Log in button. Name it as : TC_LOOP_TestCaseOne
Now create another test case just to fill up the fields Country, Address, Email and Phone. Parametrize the fields Country, Address, Email and Phone and create a csv file and will use that one as a datasource (csv file). Lets name it as 'TC_LOOP_TestCase_Nested'.
Create a job and add the TC_LOOP_TestCaseOne as first test case and
TC_LOOP_TestCase_Nested as second test case and associate the
TC_LOOP_TestCase_Nested with data source csv file that we have created previously.
TC_LOOP_TestCase_Nested as second test case and associate the
TC_LOOP_TestCase_Nested with data source csv file that we have created previously.
Content of the CSV file
Country,Email,MyAddress,Phoneno
DZ,gmail@g.com,MY Kesura,8822223131
DZ,gmail@YAHOO.com,MY Kesura Saheed no,84792374893288
DZ,gmail@g.com,MY Kesura,8822223131
DZ,gmail@YAHOO.com,MY Kesura Saheed no,84792374893288
Edit the job and make sure that 'Restart the browser before each test' should be unchecked.
If you run the test case, then you will TC_LOOP_TestCase_Nested is repeated based on the no of records in the csv file.
No comments:
Post a Comment