【问题标题】:Junit Testwatcher skipped/ignored testJunit Testwatcher 跳过/忽略测试
【发布时间】:2017-01-26 22:26:27
【问题描述】:

我创建了一个 TestWatcher,当 TestCase failssucceededskipped 时应该做一些事情。

Methodssucceededfailed被解雇了,但都没有

@Override
protected void skipped(AssumptionViolatedException e, Description description) {
    System.out.println("Skipped: " + description);
    e.printStackTrace();
}

也没有

@Override
protected void skipped(org.junit.internal.AssumptionViolatedException e, Description description)
{
    System.out.println("Skippedinternal: " + description);
    e.printStackTrace();
}

被解雇。

为什么当 testignored 时不调用这两个,或者这是对 ignored test 做出反应的错误方式,如果是这种情况,我该怎么做?

【问题讨论】:

    标签: java junit watch


    【解决方案1】:

    TestWatcher 中的已跳过事件 (http://junit.org/junit4/javadoc/4.12/org/junit/rules/TestWatcher.html) 仅在测试因假设失败 (http://junit.sourceforge.net/javadoc/org/junit/Assume.html) 而被跳过的情况下触发。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-12
      • 1970-01-01
      • 2017-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多