【问题标题】:Running the disjoint of two JUnit Test suites运行两个 JUnit 测试套件的脱节
【发布时间】:2013-07-25 09:11:53
【问题描述】:

假设我有两个 JUnit 测试套件,即 SuiteATest 和 SuiteBTest。他们几乎没有共同的测试课程。有没有一种简单的方法可以命令 JUnit 从两个测试套件中运行这些常见的测试类?

【问题讨论】:

    标签: unit-testing testing junit test-suite


    【解决方案1】:

    我使用 cpsuite 的 BaseTypeFilter(http://johanneslink.net/projects/cpsuite.jsp) 对测试进行分组。

    例如:

    // 套件a

    public class A implements SlowTests {
    
    }
    

    // 套件 b

    public class B implements SlowTests {
    
    }
    

    你可以添加一个测试套件:

    @RunWith(ClasspathSuite.class)
    @BaseTypeFilter(SlowTests .class)
    public class SlowSuite {
    }
    

    或者你可以使用 Junit 的分类功能(http://alexruiz.developerblogs.com/?p=1711)

    【讨论】:

      猜你喜欢
      • 2017-04-29
      • 2012-12-04
      • 2020-02-27
      • 1970-01-01
      • 1970-01-01
      • 2011-04-29
      • 2012-02-17
      • 2013-02-11
      • 1970-01-01
      相关资源
      最近更新 更多