I would like to call a data-driven test from another test (using Add test as step) and pass it the values for its data-driven parameters. For example, I have multiple tests which all need to log in but with different user credentials. I want to have the login as a data-driven test which takes the user credentials as input - and want to pass the user credential values from each test.
Is there a way to accomplish this without converting all tests to code?
Thanks,
Shashi
6 Answers, 1 is accepted

Any ideas on this?
Thanks,
Shashi
I apologize for the delay getting back to you. Please review this KB article and see if it fits your needs.
Greetings,Cody
the Telerik team

Thanks for getting back to me. I looked at the blog article you sent me. While this solution works, I am afraid it doesn't scale very well.
The scenario in my case is as follows:
Log in as user A and do stuff that is specific to user A
Log in as user B and do stuff that is specific to user B
...
Log in as user X and do stuff that is specific to user X.
With the approach described in the blog, I would need to have a script for each user as follows:
MainTest A: Log in as user A and do stuff that is specific to user A
MainTest B: Log in as user B and do stuff that is specific to user B
...
MainTest X: Log in as user X and do stuff that is specific to user X.
The code to log in then needs to be repeated in each script. In my case, the code to log in is a little complex as it handles a couple of different situations (first-time login and subsequent login). If the process to log in changes in any way, I have to update each of these scripts. The problem gets even worse when you take into account that there will be many tests for each of the users - all of which require the user to be logged in (and so will probably need to have code to log the user in).
What I would like to do is as follows:
LoginTest: Steps to login (data-driven test)
MainTest A:
- Call LoginTest with user A's credentials
- Do stuff specific to user A
MainTest B:
- Call LoginTest with user B's credentials
- Do stuff specific to user B
.. and so on.
By the way, I am using login is only an example. I would like to do this for other functionality in the application as well - in which the steps are basically the same for all users except for user-specific differences in values passed to certain commands.
In case this helps, I have my tests all bound to one XML file which has values for all the data required by all the tests in the suite (this includes the credentials of all users to be used by the tests). So a solution to the original problem in the blog article (ability of a script to select data that it needs) would work very well.
Let me know if you have any suggestions on how I might approach this problem.
Shashi
Since you have put all your data into a single spreadsheet, it simplifies what you're trying to accomplish. Data bind all your top level tests to your data source. Then in your case yes, call your LoginTest from your various other tests. Just make sure that InheritParentDataSource is set to true. With this setting you can databind your LoginTest to the same columns of the same data source that the parent test is using. I think that should solve it for you.
All the best,Cody
the Telerik team

Hi Cody,
Sorry for the delay in responding - things were quite busy the last few days.
What do I need to select to get to the Properties window that has the InheritDataSource setting? I selected various things (the aii file, individual statements, even tried unbinding the xml file from the login script) but couldn't find the setting in any of the Properties windows. Note that I am editing the aii file in VS 2010 using the Developer version of WebUI.
Thanks,
Shashi
Oh, that's different. You posted in the QA Edition forum so I showed how the setting appears for that edition.
In the Dev Edition you must first open Test View, click on the test in question, then open the Properties window as shown in the attached screenshot.
Cody
the Telerik team