English 中文(简体)
Id利用TFSAP进行特定测试
原标题:Get a specific TestSuite by Id using the TFS API
  • 时间:2012-04-19 15:21:46
  •  标签:
  • tfs
  • tfs-sdk

我正试图利用TFSAP软件进行测试。

试验分析可在试验分析等级内任何地方存在,因此,当然我可以写回功能。 然而,我希望能提高效率。

我是否缺少一种方法,或者也许有人问我可以写什么?

问题回答

如果你已经知道<代码>测试标准Id,那么事情就非常简单。 仅需要了解你的团队项目名称team ProjectName:

>。

using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.TestManagement.Client;

namespace GetTestSuite
{
    class Program
    {
        static void Main()
        {
           int testSuiteId = 555;
           const string teamProjectName = "myTeamProjectName";

           var tpc =
                TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
                    new Uri("http://tfsURI"));

           var tstService = (ITestManagementService)tpc.GetService(typeof(ITestManagementService));
           var tProject = tstService.GetTeamProject(teamProjectName);

           var myTestSuite = tProject.TestSuites.Find(testSuiteId);            
        }
    }
}

如果你不这样做,你很可能需要找到类似于所介绍的解决办法:here。 S.Raiten(一个S.Raiten员额),在那里,再次入侵确实发生。 查阅testPlanId

using System;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.TestManagement.Client;

namespace GetTestSuite
{
    class Program
    {
        static void Main()
        {
            int testPlanId = 555;
            const string teamProjectName = "myTeamProjectName";

            var tpc =
                TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
                    new Uri("http://tfsURI"));

            var tstService = (ITestManagementService)tpc.GetService(typeof(ITestManagementService));
            var tProject = tstService.GetTeamProject(teamProjectName);

            var myTestPlan = tProject.TestPlans.Find(testPlanId);
            GetPlanSuites(myTestPlan.RootSuite.Entries);                
        }

        public static void GetPlanSuites(ITestSuiteEntryCollection suites)
        {
            foreach (ITestSuiteEntry suiteEntry in suites)
            {
                Console.WriteLine(suiteEntry.Id);
                var suite = suiteEntry.TestSuite as IStaticTestSuite;
                if (suite != null)
                {
                    if (suite.Entries.Count > 0)
                        GetPlanSuites(suite.Entries);
                }
            }
        }
    }
}




相关问题
Why not use TFS as a build / CI solution?

Currently our build solution is set up using TFS + MS Build scripts. TFS is also being used as a CI server. I ve seen several posts on this site telling people about other CI solutions. Are there ...

Get files from TFS under Linux [closed]

is there a free (command line) tool for linux which with I can get all files from a TFS-Repository (no Check in / Check out required - only get actual version)?

upgrading tfs 2008 sp1 to use sql server 2008

I have an instance of tfs 2008 supported by sql server 2005. I want to change the sql server machine by doing a restore based move. I also want to change the version of sql server to 2008. I know ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

TFSReg in 2010 Beta 2?

does anybody know what is the equivalent of the TFSReg.exe command-line tool in 2010 Beta 2? I cannot find it anywhere, I searched the entire Program Files tree. Was it renamed? Moved? Replaced by ...

热门标签