小编cfh*_*yes的帖子

从可执行 JAR 运行单个黄瓜场景

我想将我的验收测试打包到一个可执行 JAR 中,其中包含运行测试和生成报告所需的所有库。我还想运行所有测试或单个测试。

到目前为止,我能够运行所有测试,尽管在我在 serenity.properties 中指定的位置生成报告,但没有生成 index.html。

通常,我会使用 maven verify 目标运行我的测试,该目标将运行 serenity-maven-plugin,但由于我是从 JAR 运行的,我不确定如何实现相同的目标。

我有一个主类,如下所示:

@RunWith(CucumberWithSerenity.class)
@CucumberOptions(features = "classpath:com/cfhayes/test/LookupADefinition.feature")
public class DefinitionTestSuite {
  public static void main(String[] args) throws Exception {
    JUnitCore.main("com.cfhayes.test.DefinitionTestSuite");
  }
}
Run Code Online (Sandbox Code Playgroud)

我的功能文件使用标签,以便我可以指定要运行的单个场景:

Feature: Lookup a definition

  @TEST-0001
  Scenario: Looking up the definition of 'apple'
    Given the user is on the Wikionary home page
    When the user looks up the definition of the word 'apple'
    Then they should see the definition 'A common, round fruit produced by the …
Run Code Online (Sandbox Code Playgroud)

cucumber-jvm cucumber-junit cucumber-java cucumber-serenity

4
推荐指数
1
解决办法
2248
查看次数