问题描述
我试图找出如何将TFS 2018中的测试用例与.Net Core项目中的Xunit Fact相关联。
如果我在Visual Studio 2017 Test Explorer中单击XUnit Fact ,则关联选项被禁用。
I am trying to figure out how to associate a Test Case in TFS 2018 to a Xunit Fact in a .Net Core project.
If i click on the XUnit Fact in the Visual Studio 2017 Test Explorer, the association option is disabled.
有有人知道如何将Xunit Fact与TFS中的测试用例关联吗?
Does anyone know how to associate a Xunit Fact to a Test Case in TFS?
推荐答案
有一个Rest API可以。
There is a Rest API could update work item filed.
例如:
PATCH https://服务器名称:8080 / tfs / DefaultCollection / _apis / wit / workitems / [testcaseid]?api-version = 1.0
内容类型: application / json-patch + json
正文:
[
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomatedTestName",
"value": "[namespace.classname.methodname (e.g. UnitTestProject1.UnitTest1.TestMethod2)]"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomatedTestStorage",
"value": "[assembly name(e.g. unittestproject1.dll)"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomatedTestId",
"value": "[guid id]"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomatedTestType",
"value": "Unit Test"
},
{
"op": "add",
"path": "/fields/Microsoft.VSTS.TCM.AutomationStatus",
"value": "Automated"
}
]
AutomatedTestId是Guid值,因此您可以使用以下C#代码生成新的Guid:
The AutomatedTestId is a Guid value, so you can generate a new Guid by using this C# code:
Guid g = Guid.NewGuid();
string s = g.ToString();
看看这个类似的问题
这篇关于如何将XUnit事实与TFS中的测试用例相关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!