如何从 Team Foundation Server 中删除测试用例

编程入门 行业动态 更新时间:2024-10-18 08:30:23
本文介绍了如何从 Team Foundation Server 中删除测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

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

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

首先,我从 这个网站安装了 Team Foundation Server Power Tools.

然后我在 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屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 18:41:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1398169.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:测试   Team   Foundation   Server

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!