【问题标题】:Generate specification plan of specs2 using Maven?使用Maven生成specs2的规范计划?
【发布时间】:2011-08-02 20:00:10
【问题描述】:

我无法使用 Maven 输出我的 specs2 规范的规范计划。我有,例如,

class FooTest extends SpecificationWithJUnit{
  "foo" should {
    "bar" in { "bat" must_== "bat" }
}

并且想要输出,

foo should
  + bar 
(...success messages...)

但我能得到的只是 JUnit 风格

Running FooTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.797 sec

我的surefire插件配置为:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.7.2</version>
  <configuration>
     <useFile>true</useFile>
     <disableXmlReport>true</disableXmlReport>
     <includes>
       <include>**/*Test.*</include>
       <include>**/*Suite.*</include>
     </includes>
   </configuration>
 </plugin>

我可以设置一个属性来生成所需的输出吗?

【问题讨论】:

    标签: scala maven specs


    【解决方案1】:

    您可以:

    • 使用maven-scala 插件通过specs2.run mypackage.MySpec 执行规范(详情here

    • 使用latest specs2 snapshot,您可以在其中传递系统属性以在JUnit 运行程序执行规范时在控制台上显示结果:-Dspecs2.console。在该模式下,您可以使用 -Dspecs2.commandline=nocolor 传递其他命令行参数(例如,从输出中删除 ASCII 颜色)

    【讨论】:

    • 第二项很棒!非常感谢这个功能。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-02
    • 2016-09-30
    相关资源
    最近更新 更多