Всем привет. Проблема (Вопрос) заключается в том что я не могу реализовать через cucumberoptions запуск по тегам TestNg. У меня есть файл test.sh и в нем есть команда которая запускает с консоли тесты.
Файл pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>TrekerAutoTest</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.java.version>1.8</project.java.version>
<cucumber.version>6.9.1</cucumber.version>
<testng.version>7.3.0</testng.version>
<allure.version>2.13.8</allure.version>
<maven-surfire-plugin>3.0.0-M5</maven-surfire-plugin>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<failsafe.version>3.0.0-M5</failsafe.version>
<aspectj.version>1.8.10</aspectj.version>
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
<suiteXmlFile>runners/remote.xml</suiteXmlFile>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe.version}</version>
<configuration>
<includes>
<include>RunnerTest.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surfire-plugin}</version>
<configuration>
<systemPropertyVariables>
<allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
</systemPropertyVariables>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.plugin="io.qameta.allure.cucumber6jvm.AllureCucumber6Jvm"
</argLine>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
<trimStackTrace>true</trimStackTrace>
<printSummary>false</printSummary>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.32</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.32</version>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.23.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber6-jvm</artifactId>
<version>${allure.version}</version>
</dependency>
</dependencies>
</project>
Файл TestRunner
package utils;
import io.cucumber.testng.AbstractTestNGCucumberTests;
import io.cucumber.testng.CucumberOptions;
@CucumberOptions(
features = {"src/test/resources/features/TrackerTest.feature"},
glue = {"stepdefs", "utils"},
tags = "@positive or @negative",
plugin = {"pretty"}
)
public class TestRunner extends AbstractTestNGCucumberTests {
}
Файл test.sh
#!/bin/bash
echo "Список тегов:
@test - все тесты
@positive - позитивные тесты
@negative - негативные тесты
"
#read -p "Введите названия тегов: " TAGS
#mvn clean test -Dsurefire.suiteXmlFiles=testng.xml -Dcucumber.filter.tags="$TAGS"
mvn clean test -DcucumberOptions.tags=@negative
mvn clean test -DcucumberOptions.tags=@positive