I am trying to create automated cases that will be data driven each testcase will store the data in a different Excel Spread sheet. The only way I can see to change the spreadSheet at the moment is by updating the App.Config File to be something like below
<
configuration>
<
configSections>
<
section name="microsoft.visualstudio.testtools" type="Microsoft.VisualStudio.TestTools.UnitTesting.TestConfigurationSection, Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</
configSections>
<
connectionStrings>
<
add name="ExampleExcelConn" connectionString="Dsn=Excel Files;dbq=Example.xlsx;defaultdir=.; driverid=790;maxbuffersize=2048;pagetimeout=5" providerName="System.Data.Odbc" />
</
connectionStrings>
<
microsoft.visualstudio.testtools>
<
dataSources>
<
add name="ExampleDataSource" connectionString="ExampleExcelConn" dataTableName="TestCase1$" dataAccessMethod="Sequential"/>
<add name="ExampleDataSource" connectionString="ExampleExcelConn2" dataTableName="TestCase2$" dataAccessMethod="Sequential"/>
<!-- the two above are accessing different dataTables-->
</dataSources>
</microsoft.visualstudio.testtools>
<appSettings>
<add key="environment" value="B118_GTL_Test"/>
<add key="service" value="GTL_Test"/>
<add key="CSDir" value=""/>
<add key="ApplicationName" value="BedrockShell"/>
</appSettings>
</configuration>
Is there a way to update the dataTableName dynamically so that I can use the same dataSource in 1 file for all those testcases?