Data Driving Coded UI Tests

Frequently, we have to repeat a test with different data values. This ‘data-driving’ is made very easy in Coded UI Test. In the Tutorial, we created a Coded UI Test to verify the addition of two numbers in the calculator. Let us now see how we can convert it into a data-driven test.

Step 2:- Create the data sets. Coded UI Test supports multiple data sources. The data sets may be defined in a CSV (comma separated values) file, an Excel worksheet, an XML file, database table or from a test case on TFS. For this walkthrough, we will use a CSV file with the following data.

The test will run 3 times (as many iterations as there rows in the Data Source). The Test Results will show each iteration details.

You have seen in this walkthrough how to create a data driven tests. If the Test Case is authored in Camano, there is an even simpler way to make it data-driven. More about this workflow in the next article.

First of all, I want to thank you for writing this blog, which is very useful.

I have a question that refers to data driven Coded UI testing. Is it possible to use variable in "DataSource" attribute in any way because I don't want to use hard coded values. For example, I have this attribute:

As you can see serverName variable is used instead of hard coded value that can be placed to some configuration file or database.

Can I do that?

If I can't, what' the best way to manage it? In this particular case I need to use test case as data source. Can I use test case as data source programmatically instead of using "DataSource" attribute?