[TestMethod] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML","|DataDirectory|\\TestDataSource.xml","TestData", DataAccessMethod.Sequential)]
public void DemoTest() { } Make sure to add the XML file as Deployment Item i.e. 1) Add this attribute to the test method [DeploymentItem(@"\\<Path>\TestDataSource.xml")] Or 2) Go to test setting and add the XML file as deployment item Or 3) Right click on the XML file - go to properties of the file and set copy to output directory = copy always
[DeploymentItem(@"\\<Path>\TestDataSource.xml")]