作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
SpecFlow很棒——它对我们进行适当的集成测试很有帮助。
我想知道的一件事是是否有办法告诉 SpecFlow 向它在功能代码隐藏文件中创建的测试类添加额外的 NUnit 属性。
现在,我的测试类生成如下:
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.8.1.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Some action description here")]
public partial class MySampleFeature
{
......
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.8.1.0")]
[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[NUnit.Framework.TestFixtureAttribute()]
[NUnit.Framework.DescriptionAttribute("Some action description here")]
[NUnit.Framework.Category("LongRunningTests")] <== add this "Category" attribute
public partial class MySampleFeature
{
......
}
最佳答案
事实上 NUnit.Framework.Category
如果您使用 tags (look for the tags section),则已支持属性关于您的功能或场景。所以如果你写
@LongRunningTests
Feature: MySampleFeature
Category
属性。
IUnitTestGeneratorProvider
。接口(interface)并注册到
unitTestProvider的
generatorProvider
配置的 specflow 部分中的属性。
关于nunit - 如何教 SpecFlow 向我的测试类添加额外的 NUnit 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11009181/
我是一名优秀的程序员,十分优秀!