简体   繁体   English

针对nunit测试装置,多个类别是否会导致多个测试?

[英]Do multiple categories lead to multiple tests, for nunit test fixtures?

say that i have the following setup: 说我有以下设置:

[TestFixture, Category("aCategory"), Category("anotherCategory")]
public class SomeClass{
   [Test]
   public void SomeTest()
   {
      //testing
   }
}

how many times will the SomeTest be run? SomeTest会运行多少次? once, with the results shown in both categories, or twice, once for each category? 一次,结果显示在两个类别中,或两次,每个类别一次?

In NUnit, categories act more like filters than a grouping mechanism. 在NUnit中,类别更像过滤器而不是分组机制。

When selecting the tests to run, you can include or exclude multiple categories, which will affect which tests are selected for a given run of the test suite. 选择要运行的测试时,可以包含或排除多个类别,这将影响为给定的测试套件运行选择的测试。

You can assign multiple categories to a test class or method, but for a given run of the suite, each method will only be executed once. 您可以为测试类或方法分配多个类别,但对于套件的给定运行,每个方法只执行一次。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM