org.testng.annotations.TestInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-java-toolkit-testNg Show documentation
Show all versions of selenium-java-toolkit-testNg 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.
The newest version!
package org.testng.annotations;
import org.testng.ITestNGMethod;
import org.testng.ITestResult;
import org.testng.util.Strings;
public class TestInfo implements vendors.grid.TestInfo {
private ITestResult iTestResult = null;
private ITestNGMethod iTestNGMethod = null;
public TestInfo(ITestResult iTestResult) {
this.iTestResult = iTestResult;
}
public TestInfo(ITestNGMethod iTestNGMethod) {
this.iTestNGMethod = iTestNGMethod;
}
@Override
public String getTestname() {
if(iTestNGMethod != null){
String name = TestUtil.getTestAnnotation(iTestNGMethod).testName();
name = Strings.isNotNullAndNotEmpty(name)? name : iTestNGMethod.getMethodName();
return name;
}
if(iTestResult != null && iTestResult.getMethod() != null){
String name = TestUtil.getTestAnnotation(iTestResult.getMethod()).testName();
name = Strings.isNotNullAndNotEmpty(name)? name : iTestResult.getMethod().getMethodName();
return name;
}
return "";
}
@Override
public String getNlPurePath() {
if(iTestNGMethod != null){
String userPath = TestUtil.getTestAnnotation(iTestNGMethod).nlUserPath();
return userPath;
}
if(iTestResult != null && iTestResult.getMethod() != null){
String userPath = TestUtil.getTestAnnotation(iTestResult.getMethod()).nlUserPath();
return userPath;
}
return "";
}
@Override
public Object getMetaKey() {
if(iTestNGMethod != null){
return iTestNGMethod;
}
if(iTestResult != null && iTestResult.getMethod() !=null){
return iTestResult.getMethod();
}
return "";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy