vendredi 9 septembre 2016

The unit test adapter failed to connect to the data source or to read the data. (is not marked as serializable)

I'm using VS 2015 Enterprise and trying to get my unit tests to read data directly from the test case, which is in TFS 2013. Currently I´m getting the following error when trying to connect through the datasource.

Result Message: 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" (http://ift.tt/1oha0hz) in the MSDN Library. Error details: Type 'Microsoft.TeamFoundation.TestManagement.Client.TestObjectNotFoundException' in Assembly 'Microsoft.TeamFoundation.TestManagement.Client, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.

My test method looks like this.

[TestMethod]
[DataSource("TfsDataSource")]
public void Test1()
{
     string expected = "t1";
     string actual = TestContext.DataRow["actual"].ToString();
     Assert.AreEqual(expected, actual);
}

And my config sections like this:

   <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="TestCaseConnection" connectionString="http://tfsurl/DefaultCollection;projectname" providerName="Microsoft.VisualStudio.TestTools.DataSource.TestCase"/>
  </connectionStrings>
  <microsoft.visualstudio.testtools>
    <dataSources>
      <add name="TfsDataSource" connectionString="TestCaseConnection" dataTableName="103217" dataAccessMethod="Sequential"/>
    </dataSources>
  </microsoft.visualstudio.testtools>

Have searched for a solution for some time now but haven´t found anything that matches this issue, so all help or input is appreciated!

Aucun commentaire:

Enregistrer un commentaire