使用MTM DataSouce的VS2017产生ERROR [英] VS2017 using MTM DataSouce produces ERROR
问题描述
当我尝试使用DataSource运行单元测试时,我收到以下错误:
When I am trying to run a Unit Test using a DataSource I receive the following error:
消息:单元测试适配器无法连接到数据源或读取数据。有关解决此错误的详细信息,请参阅"数据驱动的单元测试疑难解答"。 (http://go.microsoft.com/fwlink/?LinkId=62412)在MSDN
库中。错误详细信息:初始化字符串的格式不符合从索引121开始的规范。
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://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library. Error details: Format of the initialization string does not conform to specification starting at index 121.
在VS2015中,我添加了一个.testsettings文件,它工作正常。在VS2017中添加.testsettings或.runsettings无助于打破VS测试。以下代码是我正在运行的代码:
In VS2015 I added a .testsettings file and it worked fine. In VS2017 adding a .testsettings or .runsettings does not help and break the VS test. The following code is what I am running:
[TestMethod]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase", "https://tfs.eleadcrm.com/tfs/DefaultCollection;service-one", "87622", DataAccessMethod.Sequential)]
public void TestMethod1()
{
var user = this.TestContext.DataRow["username"].ToString();
var r = new Random(0);
var num = r.Next(0, 1000);
Assert.IsTrue(num < 100, $"'{num}' is greater than 99.");
}
有人能指出我正确的方向吗?
Can anyone point me in the right direction?
Mark
推荐答案
欢迎来到MSDN论坛。
Welcome to MSDN forum.
我在visual studio 2015和visual studio 2017中测试,两者都运行正常。
I test in visual studio 2015 and visual studio 2017, both of them work fine.
以下屏幕截图在2017年的视觉工作室:
the following screenshot is in visual studio 2017:
在Visual Studio 2017中,尝试卸载 MSTest.TestAdapter 和MSTest.TestFramework并通过nuget安装Microsoft.VisualStudio.QualityTools.UnitTestFramework.Updated并检查问题是否仍然存在。
In visual studio 2017, try uninstall MSTest.TestAdapter and MSTest.TestFramework and install Microsoft.VisualStudio.QualityTools.UnitTestFramework.Updated via nuget and check it if the issue persists.
祝你好运,
Joyce
这篇关于使用MTM DataSouce的VS2017产生ERROR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!