Timothy Rajan
Timothy Rajan

Reputation: 1957

MSTest - Running tests using visual studio services (TFS and Continous Integration )

I am following up the below link and setting a CI set up.

https://blogs.msdn.microsoft.com/visualstudioalm/2015/05/29/testing-in-continuous-integration-and-continuous-deployment-workflows/

The issue I am facing here is with respect to the test settings file. The test are running fine locally. But not remotely when running it, I am getting all test failures.

I believe this is because of the spreadsheet ( where the test data resides ) and the test settings file.

My test settings file is below

<?xml version="1.0" encoding="UTF-8"?>
   <TestSettings name="UITestSettings" id="1623gdcf4-f2af-496f-b65h4-fe25w6c4e49cb" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Description>These are default test settings for a remote test run.</Description>
  <Deployment>
    <DeploymentItem filename="XXX\TestData\LocationData.xls" />
    <DeploymentItem filename="XXX\TestData\UITestData.xls" />
  </Deployment>
  <Execution parallelTestCount="0">
    <Timeouts runTimeout="36610000" testTimeout="36610000" />
    <TestTypeSpecific>
      <UnitTestRunConfig testTypeId="13cdcs9d9-ddb5-4fa4-a97d-d965ccdfc6d4b">
        <AssemblyResolution>
          <TestDirectory useLoadContext="true" />
        </AssemblyResolution>
      </UnitTestRunConfig>
      <WebTestRunConfiguration testTypeId="4ess7599fa-5ecb-43e9-a887-cd63cfdf72d207">
        <Browser name="Internet Explorer 9.0" MaxConnections="6">
          <Headers>
            <Header name="User-Agent" value="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)" />
            <Header name="Accept" value="*/*" />
            <Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
            <Header name="Accept-Encoding" value="GZIP" />
          </Headers>
        </Browser>
      </WebTestRunConfiguration>
    </TestTypeSpecific>
    <AgentRule name="LocalMachineDefaultRole">
    </AgentRule>
  </Execution>
  <Properties>
    <Property name="TestSettingsUIType" value="UnitTest" />
  </Properties>
</TestSettings>

All test failed with this error

Data source 'XXX.YYY.aboutThemRecommendationFirstQuarterFlows' cannot be found in the test configuration settings

But I have the settings file in the build steps ( in Run functional Step )

Is there anything I am missing. Any help would be great as I am struggling to find a solutions.

Thanks

Upvotes: 0

Views: 658

Answers (1)

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29976

According to the error message, it seems that you are referring to a data source named as "XXX.YYY.aboutThemRecommendationFirstQuarterFlows" which does not exist in "App.config" file test configuration settings.

For example, I have a test method use "MyExcelDataSourceTTT" data source:

[TestMethod]
[DataSource("MyExcelDataSourceTTT")]
public void TestMethod1()
{
    Assert.AreEqual(TestContext.DataRow["1"].ToString(),"1");
}

But in the App.config file, I only have "MyExcelDataSource" data source. "MyExcelDataSourceTTT" data source does not exist:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="microsoft.visualstudio.testtools" type="Microsoft.VisualStudio.TestTools.UnitTesting.TestConfigurationSection, Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
  </configSections>
  <connectionStrings>
    <add name="ExcelConnection" connectionString="Dsn=Excel Files;dbq=.\testdata.xlsx;defaultdir=.; driverid=790;maxbuffersize=2048;pagetimeout=5" providerName="System.Data.Odbc" />
  </connectionStrings>
  <microsoft.visualstudio.testtools>
    <dataSources>
      <add name="MyExcelDataSource" connectionString="ExcelConnection" dataTableName="Sheet1$" dataAccessMethod="Sequential"/>
    </dataSources>
  </microsoft.visualstudio.testtools>
</configuration>

Now, when run the testing, you will get "Data source 'MyExcelDataSourceTTT' cannot be found in the test configuration settings.." error message. enter image description here

Upvotes: 1

Related Questions