如何为testrun,TFS API设置BuildNumber [英] How to set BuildNumber for a testrun, TFS API

查看:98
本文介绍了如何为testrun,TFS API设置BuildNumber的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我开发了一个应用程序,在运行时会在MTM中创建一个测试运行。下面是代码片段。


它运行良好,但是通过MTM手动运行只有一个属性,这是内部版本号。



如何为结果对象设置内部版本号。


它是Result对象中的只读值。我非常肯定它应该来自其他一些对象,如计划,测试点等。

 result.Outcome  =   TestOutcome  .Passed; 
result.State  =  TestResultState .Completed;
var   InstallExTrace  =  result.CreateAttachment(logPath  +  " \ \"   +  build  +  " \\"   +  buildNumber  +  ; " \\"   +  attachmentInstallExTrace);
var   InstExFinished  =  result.CreateAttachment(logPath  +  " \ \"   +  build  +  " \\"   +  buildNumber  +  ; " \\"   +  attachmentInstExFinished);
result.Attachments.Add(InstallExTrace);
result.Attachments.Add(InstExFinished);
result.Comment  =  resultComment;
result.RunBy  =  tfi;
result.Save();

解决方案

我认为你误解了小费。您只应在createAttacgment方法中添加誓言。


" logPath  +  " \\"   +  build  +  " \\"   +  buildNumber  +  " \\"   +  attachmentInstallExTrace"
这意味着一个路径链接:


C:\\\\\\\\\\\\\\\\\\\\\所以你只需要直接指定路径,你可以参考这个帖子:


https://social.msdn.microsoft.com/论坛/ vstudio / zh-CN / dd96dbea-b439-4dd7-93e0-82671636d6df / mtm-tfs-api-create-a-shared-step-result-and-attachment?forum = vsmantest




Hello all,

I have developed an application which when run creates a test run in MTM. Below is the snippet.

Its working very well, but only one attribute is missing from thsi run against the manual run via MTM, which is build number.

How do I set build number to the result object.

It is a read only value in Result object. I pretty much sure that it should be coming from some other object like Plan, test points etc.,

result.Outcome = TestOutcome.Passed;
result.State = TestResultState.Completed;
var InstallExTrace = result.CreateAttachment(logPath + "\\" + build + "\\" + buildNumber + "\\" + attachmentInstallExTrace);
var InstExFinished = result.CreateAttachment(logPath + "\\" + build + "\\" + buildNumber + "\\" + attachmentInstExFinished);
result.Attachments.Add(InstallExTrace);
result.Attachments.Add(InstExFinished);
result.Comment = resultComment;
result.RunBy = tfi;
result.Save();

解决方案

I think you misunderstand the meaning of the tip. You should only add the oath in the createAttacgment method.

"logPath + "\\" + build + "\\" + buildNumber + "\\" + attachmentInstallExTrace" This means a path link this:

C:\Log\build\27\repos\Attachmnent

So you just need to specify the path directly, you could refer to this thread:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/dd96dbea-b439-4dd7-93e0-82671636d6df/mtm-tfs-api-create-a-shared-step-result-and-attachment?forum=vsmantest



这篇关于如何为testrun,TFS API设置BuildNumber的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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