[英]Running multiple tests features with cucumber for java selenium serenity tests
I have following config to run the files in specific folder for java cucumber config (selenium 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 { }
I know how to run just one file with我知道如何只运行一个文件
features = {"src/test/resources/features/AsiaUsersMutexTest.Feature"},
However, I want to run just the files starting with some string.但是,我只想运行以某个字符串开头的文件。 Lets say files with prefix "AsiaUserTests".
让我们说带有前缀“AsiaUserTests”的文件。 Something like the following
类似于以下内容
features = {"src/test/resources/features/AsiaUsers*.Feature"},
This results into java.nio.file.InvalidPathException: Illegal char <*>
, so wondering if there is a way to do it as I couldn't find something like this in web.这导致
java.nio.file.InvalidPathException: Illegal char <*>
,所以想知道是否有办法做到这一点,因为我在网络中找不到这样的东西。
I got this running by adding @Custom-Tag
on features file that I want to run and modified the config as follows.我通过在要运行的功能文件上添加
@Custom-Tag
来运行它,并按如下方式修改了配置。
package com.hero.selenium.test;包 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 {
}
Thanks @lojza for the guidance!感谢@lojza 的指导!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.