There is another approach that would avoid having to go to code and looking up records in the datasource. If you structure your tests the right way you can data bind everything and achieve your test cases:
- Create two main login tests, MainTestA & MainTestB. These tests only login in the user. Databind these tests to your excel spreadsheet
- Create two subtests. SubTestA performs the actions and assume the user is already logged in. SubTestB performs the verifications and assume the user is already logged in. These tests can either use the same excel file as the main test, or you can databind them to separate excel files. If you use a different excel file the subtest will execute all the rows in the excel file before returning to the main test.
- Modify MainTestA to call SubTestA via Test-as-step feature. After calling the subtest add steps to logout the user.
- Modify MainTestB to call SubTestB via Test-as-step feature.After calling the subtest add steps to logout the user.
- Create a test list - EndToEndTestListA. Add MainTestA and MainTestB to it.
Now when you run EndToEndTestListA it will execute in this manner:
- MainTestA will begin execution. It will run for all the rows in the login excel file. For each row it will call SubTestA to perform the same actions for each user. If SubTestA has a separate data file it will run all the rows in that datafile before returning to MainTestA.
- When MainTestA is done executing MainTestB will begin executing. It will run in the same manner as MainTestA except it will call SubTestB instead of SubTestA
Will this approach work for you?
All the best,
the Telerik team