I am having a unit test project and the sample code is below. Basically my plan is to create the data at run time and this data will act as a datasource for the unit tests.
[TestMethod]
[TestCategory("UITest"), TestCategory("PersonalDetailsFlow")]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\TestFlows.xml", "flow", DataAccessMethod.Sequential)]
public void TestMethod1()
{
//Test Code
}
[ClassInitialize]
public static void ClassInit(TestContext context)
{
DriverData driverData = new DriverData();
driverData.DataGenerator();
}
The data creation happens in the ClassInitialize section. When I set the settings file to a testsettings file, the project runs without any issues.
When I change the testsettings file to point to a runsettings file (since I have lot of data passed from runsettings file ), I get the below error line "The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests"
I am quite curious to know whats happening when I run using testsettings to make it successful but when using a runsettings file, getting all issues and how to avoid this when using a runsettings file.
Also, please refer How to execute a line of code which is a data setup code in MSTest before all test