junit5.TagHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-java-toolkit-JUnit5 Show documentation
Show all versions of selenium-java-toolkit-JUnit5 Show documentation
Selenium-Toolkit is a Java based test-toolkit for selenium-testing with testNg.
The goal of the toolkit is, to suport you in different things like 'how to manage testdata in the source', parallelisation, Webdriver-managemet, reporting and a lot more.
package junit5;
import org.junit.platform.engine.TestTag;
import org.junit.platform.launcher.TestIdentifier;
import java.util.Optional;
public class TagHelper {
private static final String CAPABILITIES = "capabilities=";
private static final String TEST_CONFIG = "testConfig=";
public static boolean hasCapibilityTag(TestIdentifier testIdentifier){
return testIdentifier.getTags().stream().anyMatch(testTag -> testTag.toString().startsWith(CAPABILITIES));
}
public static String[] getCapibilityTag(TestIdentifier testIdentifier){
String[] result = new String[0];
Optional optionalTestTag = testIdentifier.getTags().stream().filter(testTag -> testTag.toString().startsWith(CAPABILITIES)).findFirst();
if(optionalTestTag.isPresent()){
result = optionalTestTag.toString().substring(CAPABILITIES.length()).split(",");
}
return result;
}
public static boolean hasTestConfigTag(TestIdentifier testIdentifier){
return testIdentifier.getTags().stream().anyMatch(testTag -> testTag.toString().startsWith(TEST_CONFIG));
}
public static String[] getTestConfigTag(TestIdentifier testIdentifier){
String result[] = new String[0];
Optional optionalTestTag = testIdentifier.getTags().stream().filter(testTag -> testTag.toString().startsWith(CAPABILITIES)).findFirst();
if(optionalTestTag.isPresent()){
result = optionalTestTag.get().toString().substring(TEST_CONFIG.length()).split(",");
}
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy