如何使用verify命令从命令行运行Cucumber JUnit项目。

huangapple 未分类评论44阅读模式
英文:

how to run a cucumber junit project from command line using verify

问题

我有一个使用 cucumber 编写的自动化框架,作为 Junit 测试用例运行。如何通过命令行使用 verify 运行它?

目前我是右键点击测试运行器类,然后作为 Junit 测试用例运行。

我尝试了 mvn test verify,但它没有运行特定的测试运行器类。

英文:

I have an automation framework using cucumber and run as Junit test case. How can I run from command line using verify?

Right now I am right clicking on test runner class and run as junit test case.

I tried mvn test verify but it doesn't run the specific test runner class.

答案1

得分: 0

使用mvn verify时会使用Failsafe插件,并且测试应该相应地命名:

> https://maven.apache.org/surefire/maven-failsafe-plugin/examples/inclusion-exclusion.html
> 测试包含和排除 运行包含的测试
>
> 默认情况下,Failsafe插件将自动包含所有符合以下通配符模式的测试类:
>
> "/IT*.java" - 包含所有子目录和所有以"IT"开头的Java文件名。
> "
/*IT.java" - 包含所有子目录和所有以"IT"结尾的Java文件名。
> "**/*ITCase.java" - 包含所有子目录和所有以"ITCase"结尾的Java文件名。
>
> 如果测试类不遵循这些命名约定,则需要配置Failsafe插件并指定要包含的测试。

使用mvn test时会使用Surefire插件,并且测试应该相应地命名:

> https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html
> 测试包含和排除 运行包含的测试
>
> 默认情况下,Surefire插件将自动包含所有符合以下通配符模式的测试类:
>
> "/Test*.java" - 包含所有子目录和所有以"Test"开头的Java文件名。
> "
/*Test.java" - 包含所有子目录和所有以"Test"结尾的Java文件名。
> "/*Tests.java" - 包含所有子目录和所有以"Tests"结尾的Java文件名。
> "
/*TestCase.java" - 包含所有子目录和所有以"TestCase"结尾的Java文件名。
>
> 如果测试类不遵循这些命名约定,则需要配置Surefire插件并指定要包含的测试。

英文:

When using mvn verify Failsafe is used and test should be named accordingly:

> https://maven.apache.org/surefire/maven-failsafe-plugin/examples/inclusion-exclusion.html
> Inclusions and Exclusions of Tests Inclusions
>
> By default, the Failsafe Plugin will automatically include all test
> classes with the following wildcard patterns:
>
> "/IT*.java" - includes all of its subdirectories and all Java filenames that start with "IT".
> "
/*IT.java" - includes all of its subdirectories and all Java filenames that end with "IT".
> "**/*ITCase.java" - includes all of its subdirectories and all Java filenames that end with "ITCase".
>
> If the test classes do not follow any of these naming conventions,
> then configure Failsafe Plugin and specify the tests you want to
> include.

When using mvn test Surefire is used and test should be named accordingly:

> https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html
> Inclusions and Exclusions of Tests Inclusions
>
> By default, the Surefire Plugin will automatically include all test
> classes with the following wildcard patterns:
>
> "/Test*.java" - includes all of its subdirectories and all Java filenames that start with "Test".
> "
/*Test.java" - includes all of its subdirectories and all Java filenames that end with "Test".
> "/*Tests.java" - includes all of its subdirectories and all Java filenames that end with "Tests".
> "
/*TestCase.java" - includes all of its subdirectories and all Java filenames that end with "TestCase".
>
> If the test classes do not follow any of these naming conventions,
> then configure Surefire Plugin and specify the tests you want to
> include.

huangapple
  • 本文由 发表于 2020年7月23日 12:05:57
  • 转载请务必保留本文链接:https://java.coder-hub.com/63046740.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定