Jira Ticket reference in Nunit header

試著忘記壹切 提交于 2021-02-11 12:51:46

问题


We are creating Nunit tests which have corresponding Jira stories. We have been putting the ticket reference in the test name, but is there a convention or Nunit attribute that we should consider using instead which would be a useful or organised place for putting this reference instead?


回答1:


Many folks use the [Description] attribute for this purpose.

Another option is to use [TestOf]. While it's aimed at specifying the class or method that you are testing, you can use it for any other string description if you don't make use of it for that purpose.

Finally, you can trivially create your own property attribute. For example:

c# public class JiraTicketAttribute : PropertyAttribute { public JiraTicketAttribute(string ticket) : base(ticket) { } }

The test on which it is used will end up with a property named "JiraTicket" with the value you specify as an argument.



来源:https://stackoverflow.com/questions/52645207/jira-ticket-reference-in-nunit-header

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!