【问题标题】:JUnit set timeout from command lineJUnit 从命令行设置超时
【发布时间】:2016-02-03 17:02:54
【问题描述】:

在 JUnit3 和 JUnit4 中,当我从 命令行 运行测试时,有没有办法传递一个选项,以便我可以为 每个 测试用例指定超时?

请注意,我们必须使用命令行,因此答案不应使用注释 (@Test(timeout=1000)),而应类似于:

JUnit3:

java junit.textui.TestRunner --timeout=1000 TestClass1 [TestClass2, ...]

JUnit4:

java org.junit.runner.JUnitCore --timeout=1000 TestClass1 [TestClass2, ...]

【问题讨论】:

    标签: command-line junit timeout


    【解决方案1】:

    在对 junit 3&4 源代码进行研究之后,我不得不接受我想要的东西是不可能的。该命令只接受测试类作为参数,因此不能传递其他选项来指定超时。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-05
      • 2013-05-15
      • 2016-08-26
      • 1970-01-01
      相关资源
      最近更新 更多