[英]Running multiple tests features with cucumber for java selenium serenity tests
我有以下配置來運行特定文件夾中的文件,用於 Java 黃瓜配置(硒測試)。
package com.hero.selenium.test; import io.cucumber.junit.CucumberOptions; import net.serenitybdd.cucumber.CucumberWithSerenity; import org.junit.runner.RunWith; @RunWith(CucumberWithSerenity.class) @CucumberOptions( monochrome = true, features = {"src/test/resources/features/"}, glue = {"com.hero.selenium.test.stepdefinitions"} ) public class MainRunner { }
我知道如何只運行一個文件
features = {"src/test/resources/features/AsiaUsersMutexTest.Feature"},
但是,我只想運行以某個字符串開頭的文件。 讓我們說帶有前綴“AsiaUserTests”的文件。 類似於以下內容
features = {"src/test/resources/features/AsiaUsers*.Feature"},
這導致java.nio.file.InvalidPathException: Illegal char <*>
,所以想知道是否有辦法做到這一點,因為我在網絡中找不到這樣的東西。
我通過在要運行的功能文件上添加@Custom-Tag
來運行它,並按如下方式修改了配置。
包 com.hero.selenium.test;
import io.cucumber.junit.CucumberOptions;
import net.serenitybdd.cucumber.CucumberWithSerenity;
import org.junit.runner.RunWith;
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
monochrome = true,
features = {"src/test/resources/features/"},
glue = {"com.hero.selenium.test.stepdefinitions"},
tags= "@Custom-Tag"
)
public class MainRunner {
}
感謝@lojza 的指導!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.