TFS工作流程-在自定义编辑器中显示测试套件 [英] TFS Workflow - Show Test Suites in Custom Editor

查看:128
本文介绍了TFS工作流程-在自定义编辑器中显示测试套件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


您可以通过 IServiceProvider 获取当前的构建定义。请参阅此网站(和其他一些网站)建议使用内置编辑器。可以使用实验室工作流程参数的内置编辑器窗口(第一个屏幕截图中的那个)吗?



请先感谢。

解决方案

显然我只是愚蠢。

  var pr = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri( http:// tfs:8080 / tfs / DefaultCollection / ProjectName));; 

项目名称不能在此URL中。

  var pr = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri( http:// tfs: 8080 / tfs / DefaultCollection)); 

请参阅我的后续文章问题


[Edit] You can get the current build-def via the IServiceProvider. See this answer. [/Edit]

I'm trying to add a custom editor for one of our TFS Xaml build workflows. I started by following this excelent tutorial by Ewald Hofman. Everything worked as expected, when I click on the [...] button for the workflow parameter the credential dialog is displayed.

What I want to do: I want to display a selectable list/tree of test suites that are available in the TFS team project. Just like in the Default Labs Workflow:

Obviously, for this to work, I have to be able to communicate the the TFS over its .Net-API (Is it possible to do via SOAP/REST?).

But whenI started to alter the example to fit to my scenario, I naivly tried using the IServiceProvider to get ahold of an IBuildService instance.

public override object EditValue(ITypeDescriptorContext context, ServiceProvider provider, object value)
{
            if (provider != null)
            {
                IWindowsFormsEditorService editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                IBuildServer bs = (IBuildServer)provider.GetService(typeof(IBuildServer));
                ...

This approach did not work, bs is null after this statement.

Then I tried to connect to the TestManagement like this:

            var pr = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfs:8080/tfs/DefaultCollection/ProjectName"));
            var TcmService = pr.GetService<ITestManagementService>();
            var t = TcmService.GetTeamProject("ProjectName");

But this failed with a HTTP 404 error that is displayed when I click the edit [...] buttton of the workflow parameter. The url is correct, if i open the page in a browser, the Team Webaccess page is displayed.

TL;DR:

I would like to be able to display a list of test suites of the current tfs in a custom worfklow parameter editor, but I am failing to connect to the TFS.

Other approach: This site (and some others) recommend using builtin editors. Is it possible to use the builtin editor window of the labs workflow paramaters (the one in the first screenshot)?

Thanks in advance.

解决方案

Appearantly I was just stupid.

var pr = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfs:8080/tfs/DefaultCollection/ProjectName"));

The project name must not be in this URL. With the line below it works just fine.

var pr = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://tfs:8080/tfs/DefaultCollection"));

See my followup question

这篇关于TFS工作流程-在自定义编辑器中显示测试套件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆