0

i'm trying to connect to my excel file to get the data to my test unit in VS 2013 I have Office 2013 (it's a new computer)

this is my App.config:

<?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=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
 </configSections>
 <connectionStrings>
 <add name="ExcelConnection" connectionString="Dsn=Excel Files;dbq=.\Ketonuria.xlsx;defaultdir=.; driverid=790;maxbuffersize=2048;pagetimeout=5" providerName="System.Data.Odbc" />
 </connectionStrings>
 <microsoft.visualstudio.testtools>
 <dataSources>
 <add name="Ketonuria" connectionString="ExcelConnection" dataTableName="twoPositiveIn1Week$" dataAccessMethod="Sequential"/>
 </dataSources>
 </microsoft.visualstudio.testtools>

</configuration>

and this is my test method:

 [TestMethod]
        [DataSource("Ketonuria")]
        [DeploymentItem("Ketonuria.xlsx")]
        public void TwoPositiveIn1Week()
        {
            TestContext.WriteLine(TestContext.DataRow["Patient ID"].ToString());
            Assert.IsTrue(true);


        }

I included the excel file in the project and also i change the property "Copy to output directory" to copy always

the error i'm getting is: "the unit test adapter failed to connect to the data source..."

Dkova
  • 1,087
  • 4
  • 16
  • 28
  • 1
    Should the last line be "failed to connect" (not "field")? What is the complete message? Does it contain path information that can be compared to the XML? – AdrianHHH Aug 10 '14 at 08:37
  • yes it's failed, i will edit it. and no, no path just a link to microsoft – Dkova Aug 10 '14 at 12:46

0 Answers0