I have a codedui test which reads value from an .csv file. I'm using the following code:
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\testdata.csv", "testdata#csv", DataAccessMethod.Sequential), DeploymentItem("testdata.csv"), TestMethod]
public void test()
{
String a = TestContext.DataRow["Field 1"].ToString();
}
As part of my requirement, i need to capture the test results e.g. id generated and write it back again to "testdata.csv".
I tried using: TestContext.DataRow["IDField"] = id;
But its not successful.
My question is:
- How do we write value to this file during runtime?
- How to read the above value in a different test?
- If i need to read values from multiple sources, is there a way to do it because in the datasource, i can give only one file name.
Thanks