java - 如何使用验证从命令行运行 cucumber junit 项目

标签 java junit command-line automation cucumber

<分区>

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

现在我右键单击测试运行器类并作为 junit 测试用例运行。

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

最佳答案

当使用 mvn verify 时使用 Failsafe 并且测试应该相应地命名:

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.

当使用 mvn test 时使用 Surefire 并且测试应该相应地命名:

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.

关于java - 如何使用验证从命令行运行 cucumber junit 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63046740/

相关文章:

java - JSF - JUnit FacesContext 模拟测试

command-line - 如何让 uBoot 与 squashfs 一起工作/uBoot 中的 FDT 是什么?

python - Linux 命令行中 Python 对象类的子类

command-line - Windows 10 : apply theme programmatically

java - 如何在 Java 中将 int[] 转换为 ByteBuffer?

java - 点击查看时将字节数组写入pdf文件

java - 如何正确测试这种定时并发处理服务呢?

java - 获取 SimpleDateFormat 的模式

java - 如何使用 Xstream 从 xml 中删除 namespace 前缀?

java - 在模拟类中初始化私有(private)字段