Issue
I am trying to execute test cases based on tags. I can able to execute a test case if i add one tag but when i try to add multiple tags (tags = {"@regression or "@smoke"}
) I'm getting a syntax error rel="nofollow noreferrer">
Even i tried to use tags = "@smoke or @regression"
this has end up with there are no test for given tag. please let me know the right syntax to handle multiple tags in the runner file
Runner file:
package TestRunner;
import Utility.Constants;
import com.Base.PageBase;
import io.cucumber.junit.CucumberOptions;
import net.serenitybdd.cucumber.CucumberWithSerenity;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import java.io.IOException;
import java.util.List;
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
//plugin = {"pretty"},
tags = {"@regression" or "@smoke"},
//dryRun = true,
features = {"TestSuites/s rc/test/java/features/Account"},
glue = {"StepDefinitions"})
public class AccountsTestRunner extends PageBase {
@BeforeClass
public static void createTestRunnerSuite() throws IOException {
Utility.ExcelReader excelReader = new Utility.ExcelReader();
List<Integer> testIds = excelReader.suiteReader(Constants.ACCOUNTS_SHEET_NAME);
System.out.println(testIds);
// TestBase.createSuite("Account - Regression-QC High Priority Automation Sprint 11-12", testIds, Constants.ACCT_SUITE_ID);
}
}
build.gradle:
defaultTasks 'clean', 'test', 'aggregate'
apply plugin: 'java'
apply plugin: 'net.serenity-bdd.aggregator'
group 'org.automationserenity'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
buildscript {
project.ext {
serenityVersion = '2.3.12'
}
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath('net.serenity-bdd:serenity-gradle-plugin:' + serenityVersion)
}
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
ext {
slf4jVersion = '1.7.7'
serenityCoreVersion = '3.0.5'
junitVersion = '4.11'
assertJVersion = '3.21.0'
logbackVersion = '1.2.3'
serenityCucumberVersion = '3.0.5'
}
dependencies {
implementation 'org.junit.jupiter:junit-jupiter:5.7.0'
// https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.7.0'
//implementation group: 'io.cucumber', name: 'cucumber-java', version: '6.11.0'
implementation group: 'net.serenity-bdd', name: 'serenity-cucumber6', version: '2.3.2'
testImplementation "net.serenity-bdd:serenity-core:${serenityCoreVersion}",
"net.serenity-bdd:serenity-junit:${serenityCoreVersion}",
"net.serenity-bdd:serenity-screenplay:${serenityCoreVersion}",
"net.serenity-bdd:serenity-cucumber:${serenityCucumberVersion}",
//"junit:junit:${junitVersion}",
"org.assertj:assertj-core:${assertJVersion}"
implementation group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.13'
implementation group: 'org.apache.httpcomponents', name: 'httpcore', version: '4.4.14'
implementation group: 'org.json', name: 'json', version: '20210307'
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.3'
implementation 'com.github.javafaker:javafaker:1.0.2'
implementation group: 'org.apache.poi', name: 'poi', version: '5.0.0'
testImplementation group: 'com.jayway.restassured', name: 'rest-assured', version: '2.9.0'
testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '3.2.0'
implementation group: 'io.github.bonigarcia', name: 'webdrivermanager', version: '3.0.0'
implementation group: 'org.jboss.aerogear', name: 'aerogear-otp-java', version: '1.0.0'
// implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '4.0.0-beta-4'
implementation group: 'commons-configuration', name: 'commons-configuration', version: '1.10'
implementation group: 'net.serenity-bdd', name: 'serenity-reports', version: '2.4.51'
// https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml
implementation group: 'org.apache.poi', name: 'poi-ooxml', version: '5.0.0'
// https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
implementation group: 'net.serenity-bdd', name: 'serenity-zalenium', version: '2.3.13'
// https://mvnrepository.com/artifact/io.appium/java-client
implementation group: 'com.applitools', name: 'eyes-selenium-java3', version: '3.208.2'
implementation group: 'com.jayway.jsonpath', name: 'json-path', version: '2.6.0'
}
test {
testLogging.showStandardStreams = true
systemProperties System.getProperties()
}
tasks.withType(Test) {
maxParallelForks = Runtime.runtime.availableProcessors()
filter {
includeTestsMatching "*AccountsTestRunner"
}
}
gradle.startParameter.continueOnFailure = true
test.finalizedBy(aggregate, reports)
dependencies {
implementation 'org.mongodb:mongodb-driver:3.12.10'
implementation group: 'org.mongodb', name: 'mongo-java-driver', version: '3.12.8'
implementation 'org.mongodb:mongodb-driver-sync:4.5.0'
// https://mvnrepository.com/artifact/com.github.ozlerhakan/poiji
implementation group: 'com.github.ozlerhakan', name: 'poiji', version: '3.1.1'
}
Solution
I believe this should compile and work at least:
tags = "@TEST1 or @TEST2"
Answered By - Petratos Marinos
Answer Checked By - Willingham (JavaFixing Volunteer)