Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用API为TFS中的不同共享参数创建结果_C#_Visual Studio_Tfs_Msdn_Azure Devops - Fatal编程技术网

C# 如何使用API为TFS中的不同共享参数创建结果

C# 如何使用API为TFS中的不同共享参数创建结果,c#,visual-studio,tfs,msdn,azure-devops,C#,Visual Studio,Tfs,Msdn,Azure Devops,我的测试用例中有一些步骤。现在,一个步骤有几个共享参数,这些参数在通过TFS手动运行时创建不同的迭代。如何使用TFS API获取这些参数并通过代码获取相同的参数要在测试步骤中获取参数,请运行以下代码: TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://servername:8080/tfs/DefaultCollection"));

我的测试用例中有一些步骤。现在,一个步骤有几个共享参数,这些参数在通过TFS手动运行时创建不同的迭代。如何使用TFS API获取这些参数并通过代码获取相同的参数要在测试步骤中获取参数,请运行以下代码:

 TfsTeamProjectCollection tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://servername:8080/tfs/DefaultCollection"));
        ITestManagementTeamProject project = tfs.GetService<ITestManagementService>().GetTeamProject("teamproject");

        ITestCase testcase24 = project.TestCases.Find(24); //24 is the test case id

        foreach (System.Data.DataTable dataTable in testcase24.Data.Tables)
        {
            string header = "";
            foreach (System.Data.DataColumn colume in dataTable.Columns)
            {
                header += colume.ColumnName + "\t";
            }
            Console.WriteLine(header);
            foreach (System.Data.DataRow row in dataTable.Rows)
            {
                string rowValue = "";
                foreach (object o in row.ItemArray)
                {

                    rowValue += o.ToString() + "\t";
                }
                Console.WriteLine(rowValue);
            }
        }
tfstreamprojectcollection tfs=tfstreamprojectcollectionfactory.GetTeamProjectCollection(新Uri(“http://servername:8080/tfs/DefaultCollection"));
ITestManagementTeamProject=tfs.GetService().GetTeamProject(“teamproject”);
ITestCase testcase24=project.TestCases.Find(24)//24是测试用例id
foreach(testcase24.Data.Tables中的System.Data.DataTable数据表)
{
字符串标题=”;
foreach(dataTable.Columns中的System.Data.DataColumn列)
{
header+=columne.ColumnName+“\t”;
}
控制台写入线(标题);
foreach(dataTable.Rows中的System.Data.DataRow行)
{
字符串rowValue=“”;
foreach(row.ItemArray中的对象o)
{
rowValue+=o.ToString()+“\t”;
}
Console.WriteLine(行值);
}
}

请提供您的要求的更多详细信息。我理解这一点,因为您希望通过API获取参数(如果是,请检查我下面的答复)。是否还要为这些共享参数设置值?还可以通过API运行测试用例?非常感谢您的响应。是的,我想设置值,然后为每个参数运行所有剩余步骤。