简体   繁体   中英

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).

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

I got this running by adding @Custom-Tag on features file that I want to run and modified the config as follows.

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"},
        tags= "@Custom-Tag"
)
public class MainRunner {
}

Thanks @lojza for the guidance!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM