I have a data table which contains the data and i want to use data table as a parameter for my test case as a data driven testing.
Any Testing Framework (MsTest/Nunit) suggestion is appreciated with c# as a scripting language.
Scenario:-
I need to get the test data from TFS which i am able to retrieve and store it in a data table. Once i have saved in data table i need to use the same data table in my test case as a parameter so that my test case runs for all the parameter.
[DataTestMethod]
[WorkItem(13)]
public void GetTestValuesFromTestParameter()
{
//Code to get the data from TFS
var method = MethodBase.GetCurrentMethod();
var attr = (WorkItemAttribute)method.GetCustomAttributes(typeof(WorkItemAttribute), true)[0];
GetTableItemsFromTestCase(workItemId);
}
private DataTable GetTableItemsFromTestCase(int workItemId)
{
//Return the data table items from TFS
}
Suppose the test case in TFS has 2 parameter [Name,FirstName] and i will prepare the test data with the value
//////Data table Start /////
[Name] [FirstName]
1. ["QWERTY","LAST"]
2. ["TEST","TEST"]
//////Data table END /////
and now i have a data table with 2 rows. The test case should run with 2 input values from data table (i,.e-> 'QWERTY' and 'TEST').
Work item attribute is a mapping to get the ID of the Test case in TFS which will get the data from TFS.
I am struck here and need help on how to pass the Data table to the test case.