如何从 Team Foundation Server 中删除测试用例 [英] How to delete test cases from Team Foundation Server

查看:22
本文介绍了如何从 Team Foundation Server 中删除测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从 Team Foundation Server 中删除测试用例?我采取了以下步骤:

How do you go about deleting test cases from Team Foundation Server? I have taken the following stesp:

然后我在 VS 命令窗口中输入以下内容:witadmin destroywi/collection:服务器名称/id:测试用例 id

Second I entered the following into the VS command window: witadmin destroywi /collection: server name /id: test case id

我从 VS 命令提示符收到以下错误消息:命令witadmin"无效.

I received the following error message from the VS command prompt: Command "witadmin" is not valid.

我什至尝试以普通用户身份从 Windows 命令提示符运行此命令,并选择以管理员身份运行",但是在每种情况下,我都收到相同的错误消息,指出命令witadmin"无效"...

I even tried to run this command from the windows command prompt as a normal user and also selecting "Run as administrator", however in each case I get the same error message stating "Command "witadmin" is not valid"...

推荐答案

witadmin 不是 TFS Power Tools 的一部分,应该在 Visual Studio 和团队资源管理器的默认安装上的 Visual Studio 命令提示符中可用.

witadmin is not part of TFS Power Tools and should be available from the Visual Studio Command Prompt on the default instalation of Visual Studio and Team Explorer.

如果由于任何原因它不可用,您应该能够在c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"或安装了 Visual Studio 的等效路径中找到它其他地方.

If for any reason it isn't available, you should be able to find it at "c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE" or an equivalent path in case Visual Studio was installed elsewhere.

参数名称和参数本身之间不应有任何空格,可以通过逗号分隔来指定多个 ID:

There shouldn't be any spaces between the parameter name and the parameter itself and multiple IDs can be specified by delimiting them with commas:

witadmin destroywi /collection:host\collection /id:3,5,7

<小时>

编辑以包含来自 OP 的新要求

如果您需要更灵活地确定要销毁哪些工作项,则应求助于 Team Foundation 的客户端 API.在下面的示例中,我创建了一个控制台应用程序,它接收两个参数:团队项目的名称和一个 WIQL 查询:

If you need more flexibility in determining what work items are to be destroyed, you should resort to Team Foundation's client API. In the sample below, I created a console application that receives two parameters: The Team Project's name and a WIQL query:

using System;
using System.Linq;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace DelWi {
    class Program {
        static void Main(string[] args) {
            var store = new WorkItemStore(args[0]);
            WorkItemCollection workItems = store.Query(args[1]);
            if (workItems.Count == 0) {
                Console.WriteLine("No work items with the specified criteria.");
            }
            var query = from workItem in workItems.Cast<WorkItem>()
                        select workItem.Id;
            foreach (var item in store.DestroyWorkItems(query)) {
                Console.WriteLine("{0}\t{1}", item.Id, item.Exception.Message);
            }
            Console.WriteLine("Press any key to continue...");
            Console.Read();
        }
    }
}

编译后你可以调用它传递参数,例如:

Once compiled you can call it passing the parameters such as in:

DelWi.exe "host\defaultcollection" "SELECT * FROM WorkItems WHERE [System.TeamProject] = 'The Best Team Project Ever'  AND  [System.WorkItemType] = 'Test Case'  AND  [System.Id] > 34  AND  [System.Id] < 37"

不过要小心,因为如果您没有正确指定查询,您最终可能会删除比您想要的更多的工作项.

Be careful though, because if you don't specify the query correctly you may end up deleting more work items than you want.

这篇关于如何从 Team Foundation Server 中删除测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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