[英]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.