本文介绍了数据驱动的单元测试如何从VSTS工作项中检索数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了一些使用数据驱动测试方法的测试代码,这些代码从VSTS工作项中读取测试数据,其代码如下:

I saw some test code using data driven test approach to read the test data from VSTS work item with following like code:

[DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase"," https://myaccount .visualstudio.com/DefaultCollection; XXX ","11543012",DataAccessMethod.Sequential)]

[DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase", "https://myaccount.visualstudio.com/DefaultCollection;XXX", "11543012", DataAccessMethod.Sequential)]

我也在我的代码中尝试了这种方法,但是出现了如下错误:单元测试适配器无法连接到数据源或读取数据.错误详细信息:TF26198:该工作项不存在,或者您没有访问权限.

I tried this approach also in my code, but got following like error:The unit test adapter failed to connect to the data source or to read the data. Error details: TF26198: The work item does not exist, or you do not have permission to access it.

我想知道与VSTS工作项建立数据源连接的基本机制是什么?我的代码如何连接到VSTS工作项?它使用什么凭证来访问工作项?

I am wondering what is the underlying mechanism of Data Source connection to VSTS work item? How does my code connect to VSTS work item? What credential it uses to access work item?

推荐答案

它使用团队资源管理器的缓存凭据.使用测试代理/构建代理的相同帐户登录测试/构建,然后通过Team Explorer连接到VSTS,然后将构建/发布排队进行测试.

It uses cache credential of team explorer. Log on test/build with the same account of test agent/build agent, then connect to your VSTS through Team Explorer, then queue build/release to do test.

请注意,如果使用的是Visual Studio Test任务,则测试在构建代理上运行,如果使用的是Run Functional Test,则测试将在测试代理上运行.

Note, if you are using Visual Studio Test task, the test is running on build agent, if you are using Run Functional Test, the test is running on test agent.

这篇关于数据驱动的单元测试如何从VSTS工作项中检索数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:25