本文整理汇总了Java中org.testng.ISuite.getName方法的典型用法代码示例。如果您正苦于以下问题:Java ISuite.getName方法的具体用法?Java ISuite.getName怎么用?Java ISuite.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.testng.ISuite
的用法示例。
在下文中一共展示了ISuite.getName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTotalSkippedMethodsForTest
import org.testng.ISuite; //导入方法依赖的package包/类
public int getTotalSkippedMethodsForTest(final String testName)
{
int totalNumberOfSkippedMethodsForTest = 0;
ITestContext overview = null;
for (ISuite suite : suites)
{
suiteName = suite.getName();
Map<String, ISuiteResult> tests = suite.getResults();
for (ISuiteResult r : tests.values())
{
overview = r.getTestContext();
if (testName.equalsIgnoreCase(overview.getName()))
{
totalNumberOfSkippedMethodsForTest = overview.getSkippedTests().getAllMethods().size();
break;
}
}
}
return totalNumberOfSkippedMethodsForTest;
}
示例2: getAllMethodsForTest
import org.testng.ISuite; //导入方法依赖的package包/类
public ITestNGMethod[] getAllMethodsForTest(String testName)
{
ITestContext overview = null;
for (ISuite suite : suites)
{
suiteName = suite.getName();
Map<String, ISuiteResult> tests = suite.getResults();
for (ISuiteResult r : tests.values())
{
overview = r.getTestContext();
if (overview.getName().equalsIgnoreCase(testName))
{
return overview.getAllTestMethods();
}
}
}
return null;
}
示例3: onFinish
import org.testng.ISuite; //导入方法依赖的package包/类
@Override
public void onFinish(ITestContext context) {
final ISuite suite = context.getSuite();
final String suiteName = suite == null ? "[UNKNOWN]" : suite.getName();
final IResultMap passed = context.getPassedTests();
final IResultMap failed = context.getFailedTests();
final IResultMap skipped = context.getSkippedTests();
final int passedCount = passed == null ? -1 : passed.size();
final int failedCount = failed == null ? -1 : failed.size();
final int skippedCount = skipped == null ? -1 : skipped.size();
Log.i(TAG, "Finished test run \"" + suiteName + "\" with "
+ passedCount + " successful tests, "
+ failedCount + " failures and "
+ skippedCount + " tests skipped");
}
示例4: onStart
import org.testng.ISuite; //导入方法依赖的package包/类
@Override
public void onStart( ISuite suite ) {
// get the run name specified by the user
String runName = CommonConfigurator.getInstance().getRunName();
if (runName.equals(CommonConfigurator.DEFAULT_RUN_NAME)) {
// the user did not specify a run name, use the one from TestNG
runName = suite.getName();
}
// start a new run
String hostNameIp = "";
try {
InetAddress addr = InetAddress.getLocalHost();
hostNameIp = addr.getHostName() + "/" + addr.getHostAddress();
} catch (UnknownHostException uhe) {
hostNameIp = null;
}
logger.startRun(runName, CommonConfigurator.getInstance().getOsName(),
CommonConfigurator.getInstance().getProductName(),
CommonConfigurator.getInstance().getVersionName(),
CommonConfigurator.getInstance().getBuildName(), hostNameIp);
logSystemInformation();
logClassPath();
}
示例5: onStart
import org.testng.ISuite; //导入方法依赖的package包/类
public void onStart( ISuite suite ) {
// get the run name specified by the user
String runName = CommonConfigurator.getInstance().getRunName();
if (runName.equals(CommonConfigurator.DEFAULT_RUN_NAME)) {
// the user did not specify a run name, use the one from TestNG
runName = suite.getName();
}
// the following is needed in case when more than one RUN are executed sequentially
// we need to clear some temporary data in the other listener we use
TestNG testNgInstance = TestNG.getDefault();
// cleanup the class level listener
new AtsTestngClassListener().resetTempData();
// cleanup the test level listener
for (ITestListener listener : testNgInstance.getTestListeners()) {
if (listener instanceof AtsTestngTestListener) {
((AtsTestngTestListener) listener).resetTempData();
}
}
// start a new run
String hostNameIp = "";
try {
InetAddress addr = InetAddress.getLocalHost();
hostNameIp = addr.getHostName() + "/" + addr.getHostAddress();
} catch (UnknownHostException uhe) {
hostNameIp = null;
}
logger.startRun(runName, CommonConfigurator.getInstance().getOsName(),
CommonConfigurator.getInstance().getProductName(),
CommonConfigurator.getInstance().getVersionName(),
CommonConfigurator.getInstance().getBuildName(), hostNameIp);
logSystemInformation();
logClassPath();
}
示例6: ReporterAPI
import org.testng.ISuite; //导入方法依赖的package包/类
public ReporterAPI(List<XmlSuite> arg0, List<ISuite> suites, String outputDir) throws IOException
{
this.suites = suites;
for (ISuite suite : suites)
{
suiteName = suite.getName();
parallelRunParam = suite.getParallel();
}
config = ProjectConfigurator.initializeProjectConfigurationsFromFile("project.properties");
}
示例7: getAllTestNames
import org.testng.ISuite; //导入方法依赖的package包/类
public List<String> getAllTestNames()
{
List<String> allTestNames = new ArrayList<String>();
for (ISuite suite : suites)
{
suiteName = suite.getName();
parallelRunParam = suite.getParallel();
Map<String, ISuiteResult> tests = suite.getResults();
for (ISuiteResult r : tests.values())
{
allTestNames.add(r.getTestContext().getName());
}
}
return allTestNames;
}
示例8: getTotalFailedMethodsForTest
import org.testng.ISuite; //导入方法依赖的package包/类
public int getTotalFailedMethodsForTest(String testName)
{
int totalNumberOfFailedMethodsForTest = 0;
ITestContext overview = null;
for (ISuite suite : suites)
{
suiteName = suite.getName();
Map<String, ISuiteResult> tests = suite.getResults();
for (ISuiteResult r : tests.values())
{
overview = r.getTestContext();
if (testName.equalsIgnoreCase(overview.getName()))
{
totalNumberOfFailedMethodsForTest = overview.getFailedTests().getAllMethods().size();
break;
}
}
}
return totalNumberOfFailedMethodsForTest;
}
示例9: onFinish
import org.testng.ISuite; //导入方法依赖的package包/类
@Override
public void onFinish(ISuite suite) {
try {
File jsonfile = new File("target/");
File reportOutputDirectory = new File("target/test-classes/reports/cucumberreports/");
String[] fileNames = jsonfile.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if(name.endsWith(".json"))
return true;
return false;
}
});
for (int i = 0; i < fileNames.length; i++) {
fileNames[i] = jsonfile.getAbsolutePath() + "/" + fileNames[i];
}
List<String> jsonFiles = Arrays.asList(fileNames);
Configuration configuration = new Configuration(reportOutputDirectory, suite.getName());
configuration.setStatusFlags(true, true, true);
ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
reportBuilder.generateReports();
oLog.info("Report Generated : " + configuration.getReportDirectory());
} catch (Exception e) {
oLog.equals(e);
}
}
示例10: SuiteMessage
import org.testng.ISuite; //导入方法依赖的package包/类
public SuiteMessage(final ISuite suite, final boolean startSuiteRun) {
m_suiteName = suite.getName();
m_testMethodCount =suite.getInvokedMethods().size();
m_startSuite = startSuiteRun;
Collection<ITestNGMethod> excludedMethods = suite.getExcludedMethods();
if (excludedMethods != null && excludedMethods.size() > 0) {
m_excludedMethods = Lists.newArrayList();
m_descriptions = Maps.newHashMap();
for (ITestNGMethod m : excludedMethods) {
String methodName = m.getTestClass().getName() + "." + m.getMethodName();
m_excludedMethods.add(methodName);
if (m.getDescription() != null) m_descriptions.put(methodName, m.getDescription());
}
}
}
示例11: onStart
import org.testng.ISuite; //导入方法依赖的package包/类
@Override
public void onStart(ITestContext context) {
final ISuite suite = context.getSuite();
final String suiteName = suite == null ? "[UNKNOWN]" : suite.getName();
final ITestNGMethod[] methods = context.getAllTestMethods();
if (methods == null) {
Log.w(TAG, "No test methods provided by " + suiteName + " (null methods)");
} else if (methods.length < 1) {
Log.w(TAG, "No test methods provided by " + suiteName + " (length=" + methods.length + ")");
} else {
Log.i(TAG, "Starting test run \"" + suiteName + "\" with " + methods.length + " tests");
}
}
示例12: onStart
import org.testng.ISuite; //导入方法依赖的package包/类
public void onStart(ISuite suite) {
parallelMode = suite.getParallel().toLowerCase();// Get parallel mode
// and validate
if (!(parallelMode.equals("false") || parallelMode.equals("tests") || parallelMode
.equals("methods"))) {
throw new SelTestException("Unknow Parallel Mode in Suite file !!");
}
if (browser.equals("ie") && !(parallelMode.equals("false"))) { // Validating
// IE
// parallel
// Mode
log.warn(" IE Does Not Support Parallel Execution !! ");
throw new SelTestException(
"Parallel Not Support Change Suite Config 'parallel= false' "
+ suite.getName());
}
if (!suiteCalled) {
log.info("");
log.info(" ******* STARTED " + suite.getName().toUpperCase()
+ " ******");
log.info("");
String path = new File("./", "src/main/resources/atu.properties")
.getAbsolutePath();
System.setProperty("atu.reporter.config", path);
if (parallelMode.equals("false")) { // Only Parallel Mode supported
// : Tests
createWebDriver();
}
suiteCalled = true;
}
}
示例13: referenceSuite
import org.testng.ISuite; //导入方法依赖的package包/类
private File referenceSuite(XMLStringBuffer xmlBuffer, ISuite suite) {
String relativePath = suite.getName() + File.separatorChar + FILE_NAME;
File suiteFile = new File(config.getOutputDirectory(), relativePath);
Properties attrs = new Properties();
attrs.setProperty(XMLReporterConfig.ATTR_URL, relativePath);
xmlBuffer.addEmptyElement(XMLReporterConfig.TAG_SUITE, attrs);
return suiteFile;
}
示例14: getIncludedModulesForTest
import org.testng.ISuite; //导入方法依赖的package包/类
public List<String> getIncludedModulesForTest(String testName)
{
ITestContext overview = null;
List<String> includedModules = new ArrayList<String>();
String includedModule = "";
String modulesCommaSeparated = config.getProperty("application.modules").replaceAll("\\s+", "");
for (ISuite suite : suites)
{
suiteName = suite.getName();
Map<String, ISuiteResult> tests = suite.getResults();
for (ISuiteResult r : tests.values())
{
overview = r.getTestContext();
if (overview.getName().equalsIgnoreCase(testName))
{
String[] allDefinedModules = null;
if (modulesCommaSeparated == null || modulesCommaSeparated.trim().length() == 0)
{
Assert.fail("ERROR - Modules are not found in properties file");
} else
{
allDefinedModules = new String[modulesCommaSeparated.length()];
allDefinedModules = modulesCommaSeparated.split(",");
}
ITestNGMethod[] allTestMethods = overview.getAllTestMethods();
for (ITestNGMethod testngMethod : allTestMethods)
{
String[] modules = testngMethod.getGroups();
for (String module : modules)
{
for (String moduleName : allDefinedModules)
{
if (module.equalsIgnoreCase(moduleName))
{
if (!(includedModule.contains(module)))
{
includedModules.add(module);
}
}
}
}
}
}
}
}
return includedModules;
}
示例15: getIncludedGroupsForTest
import org.testng.ISuite; //导入方法依赖的package包/类
public List<String> getIncludedGroupsForTest(String testName)
{
ITestContext overview = null;
List<String> includedGroups = new ArrayList<String>();
String includedGroup = "";
String groupsCommaSeparated = config.getProperty("test.groups").replaceAll("\\s+", "");
for (ISuite suite : suites)
{
suiteName = suite.getName();
Map<String, ISuiteResult> tests = suite.getResults();
for (ISuiteResult r : tests.values())
{
overview = r.getTestContext();
if (overview.getName().equalsIgnoreCase(testName))
{
String[] allDefinedGroups = null;
if (groupsCommaSeparated == null || groupsCommaSeparated.trim().length() == 0)
{
Assert.fail("ERROR - Test Groups are not found in properties file");
} else
{
allDefinedGroups = new String[groupsCommaSeparated.length()];
allDefinedGroups = groupsCommaSeparated.split(",");
}
ITestNGMethod[] allTestMethods = overview.getAllTestMethods();
for (ITestNGMethod testngMethod : allTestMethods)
{
String[] groups = testngMethod.getGroups();
for (String group : groups)
{
for (String groupName : allDefinedGroups)
{
if (group.equalsIgnoreCase(groupName))
{
if (!(includedGroup.contains(group)))
{
includedGroups.add(group);
}
}
}
}
}
}
}
}
return includedGroups;
}