我正在尝试使用 microsoft 测试管理器使用 c# 以编程方式执行测试用例。为此,我想读取存储在 Microsoft 测试管理器中的参数值。请建议我如何做到这一点例如:-读取内部参数“我的价值”的值我试图输入图像但它不起作用......
问候苛刻
我正在尝试使用 microsoft 测试管理器使用 c# 以编程方式执行测试用例。为此,我想读取存储在 Microsoft 测试管理器中的参数值。请建议我如何做到这一点例如:-读取内部参数“我的价值”的值我试图输入图像但它不起作用......
问候苛刻
我想您想从自动化测试实现的测试用例的数据源中读取参数。
您必须将您的测试与 TFS 上的测试用例 ID 相关联。
试试下面的代码。
[TestClass]
public class TestClass
{
public TestContext TestContext { get; set; }
public DataRow DataRow { get; set; }
[TestMethod]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.TestCase",
"http://localhost:8080/tfs/[CollectionName];[ProjectName]", "[TestCaseId]", DataAccessMethod.Sequential)]
public void TestMethod()
{
string column1 = TestContext.DataRow[0].ToString(); // read parameter by column index
string column2 = TestContext.DataRow["Column2"].ToString(); //read parameter by column name
}
}
请记住,您的 TestMethod 将为测试用例数据源的每一行(迭代)运行一次。
我认为您描述的是数据驱动的编码 UI 测试。