[英]How can I access data source from different folders in my unit test project?
I am using MSTest and trying to use my Data sources in different folder but I get 我正在使用MSTest并尝试在其他文件夹中使用我的数据源,但是我得到了
test adapter failed to connect 测试适配器连接失败
My project looks like this 我的项目看起来像这样
Project
|__Tests
|___TestSuite1
| |___UnitTest1.cs
| |___Data1.csv
|
|___TestSuite2
|_UnitTest2.cs
|_Data2.csv
|_Data2OtherScenario.csv
Do you know what might be wrong with my connection string? 您知道我的连接字符串可能出什么问题吗?
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\Tests\\TestSuite2\\Data2.csv", "Data2.csv", DataAccessMethod.Sequential), DeploymentItem("Data2.csv")]
[TestMethod]
public void Test1(){
//Test
}
It seems that the connection string was correct and visual studio had some dirt files. 似乎连接字符串正确,Visual Studio中有一些污垢文件。 I end up Cleaning the solution and restarting Visual Studio and it worked 我最终清洗了解决方案并重新启动Visual Studio,它正常工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.