簡體   English   中英

Maven 未使用 mvn clean verify 運行 cucumber 測試

[英]Maven not running cucumber tests with mvn clean verify

我有一個單模塊 Maven 應用程序,但mvn clean verify只會在domain以下運行測試,而不是在以下測試acceptance結構中運行:

com->  x -> acceptance -> AcceptanceTests.java

com->  x -> domain -> <REST_OF_TESTS>

換句話說, mvn clean verify只運行<REST_OF_TESTS>

這是我的AcceptanceTests.java ,它從 IntelliJ IDEA 完美運行:

package com.x.acceptance;

import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;

@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resources", plugin = {"pretty"})
public class AcceptanceTests { }

我的最終目標是使用mvn clean verify在 Makefile 級別從終端運行所有測試,但 Cucumber 測試不會運行。 能否請你幫忙?

謝謝。

使用mvn verify Failsafe 時,測試名稱應遵循以下約定:

https://maven.apache.org/surefire/maven-failsafe-plugin/examples/inclusion-exclusion.html包含和排除測試

默認情況下,Failsafe Plugin 將自動包含所有具有以下通配符模式的測試類:

 "**/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".

如果測試類不遵循任何這些命名約定,則配置 Failsafe Plugin 並指定要包含的測試。

當使用mvn test Surefire 時,測試名稱應遵循以下約定:

https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html包含和排除

默認情況下,Surefire 插件會自動包含所有具有以下通配符模式的測試類:

 "**/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".

如果測試類不遵循任何這些命名約定,則配置 Surefire 插件並指定要包含的測試。

因此,請仔細閱讀您的 class 名稱。 如果這沒有幫助,請嘗試本教程並找出與您的項目的差異。

https://cucumber.io/docs/guides/10-minute-tutorial/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM