JamWils
JamWils

Reputation: 785

Data Driven Test error in VS2010 using MSTest

I have built a bunch of tests for my employer using Test Driven Development. I am now trying to use Data Driven Development for these tests. Unfortunately, whenever I try to setup the Data Connection String with an XML file, Visual Studio 2010 keeps giving me the same error.

I don't have a high enough reputation on the site to post an image. The error says, "Error trying to sample data from , please make sure the file is valid.

I have tried a simple XML files instead of my more complex one. I have set the "Copy to Output Directory" property for the file to "Copy Always". I have tried to manually fill in the data source attribute instead of using the wizard. I have gone to test -> edit local test settings and enabled deployment. I am out of ideas can anyone help. Perhaps it is the way I am making the xml files? I have been building them in notepad+ and saving with .xml.

Thank you!

Upvotes: 0

Views: 781

Answers (1)

Jens H
Jens H

Reputation: 4632

This sound to me like your tests cannot find the physical locatin of the XML file.

Have a look at MSDN article How to: Create a Data-Driven Unit Test for walkthrough at how to implement data driven tests, including example ConnectionString.

Also make sure that under dialog Test -> Edit test settings -> Local (local.testsettings) the CheckBox Deployment -> Enable deployment is activated. This forces the deployment of your files rather than just relying on the attributes. For more explanation, see this article MSTest Aggravation and a Solution (For Me Anyway).

Upvotes: 2

Related Questions