1.

How Can We Create Data Driven Unit Test Using Vsts Test?

Answer»

Creating data DRIVEN unit TEST is pretty simple in VSTS. First create a simple table with test data values. For instance you can see in the below figure we have created a table with 3 fields i.e. 2 input fields and 1 expected value. To consume this table apply ‘DataSource’ attribute with a proper database connection string as shown in the below figure. To get FIELD data from the table we can use the ‘DataRow’ with index.

We have 3 test cases in the table, so when we executed the above test’s we got the below test results in our visual studio IDE result window.

Creating data driven unit test is pretty simple in VSTS. First create a simple table with test data values. For instance you can see in the below figure we have created a table with 3 fields i.e. 2 input fields and 1 expected value. To consume this table apply ‘DataSource’ attribute with a proper database connection string as shown in the below figure. To get field data from the table we can use the ‘DataRow’ with index.

We have 3 test cases in the table, so when we executed the above test’s we got the below test results in our visual studio IDE result window.



Discussion

No Comment Found