0
我想使用C#訪問TFS項目並創建一個測試用例。下面是項目結構C#在項目組中添加測試用例或用戶故事
網址:http://localhost:8080/tfs/test
項目:PROJECT1
球隊名稱:TEAM1
添加測試用例或在這裏工作項目
我是能夠連接到項目並在那裏添加工作項目,但是如何c在我連接到一個特定的團隊項目(在這種情況下,它是TEAM1),並添加測試用例或工作項
這裏是我的示例代碼
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Uri collectionUri = (args.Length < 1) ?
new Uri("http://localhost:8080/tfs/test") : new Uri(args[0]);
System.Console.WriteLine(collectionUri);
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(collectionUri);
WorkItemStore workItemStore = tpc.GetService<WorkItemStore>();
Project teamProject = workItemStore.Projects["project1"];
WorkItemType workItemType = teamProject.WorkItemTypes["User Story"];
// Create the work item.
WorkItem userStory = new WorkItem(workItemType)
{
// The title is generally the only required field that doesn’t have a default value.
// You must set it, or you can’t save the work item. If you’re working with another
// type of work item, there may be other fields that you’ll have to set.
Title = "test through code",
Description =
"this is an automation user story genrated"
};
// Save the new user story.
userStory.Save();
}
}
}