invoker.invokeConfigurations(null, afterSuiteMethods.values().toArray(new ITestNGMethod[afterSuiteMethods.size()]), xmlSuite, xmlSuite.getAllParameters(), null, /* no parameter values */
.usingConfigMethodsAs(afterSuiteMethods.values()) .forSuite(xmlSuite) .usingParameters(xmlSuite.getAllParameters()) .build(); invoker.getConfigInvoker().invokeConfigurations(arguments);
@Override public void onFinish(ISuite suite) { Reporter.log("Test suite parameters:"); Reporter.log(suite.getXmlSuite().getAllParameters().toString()); }
/** * Before class. * * @param testContext the test context * @throws Exception the exception */ @BeforeClass(alwaysRun = true) protected final void contextInitBeforeClass(ITestContext testContext) throws Exception { Map<String,String> parameters = testContext.getSuite().getXmlSuite().getAllParameters(); if (testContext.getSuite().getParallel().equalsIgnoreCase("classes")) { STEVIA_TEST_BASE_LOG.warn("*************************************************************************************"); STEVIA_TEST_BASE_LOG.warn("*** Driver initialisation phase, current parallel level is @BeforeClass**************"); STEVIA_TEST_BASE_LOG.warn("*************************************************************************************"); initializeStevia(parameters); } }
/** * Before method. * * @param testContext the test context * @throws Exception the exception */ @BeforeMethod(alwaysRun = true) protected final void contextInitBeforeMethod(ITestContext testContext) throws Exception { Map<String,String> parameters = testContext.getSuite().getXmlSuite().getAllParameters(); if (testContext.getSuite().getParallel().equalsIgnoreCase("methods")) { STEVIA_TEST_BASE_LOG.warn("***************************************************************************************"); STEVIA_TEST_BASE_LOG.warn("*** Driver initialisation phase, current parallel level is @BeforeMethod[PANICMODE] ***"); STEVIA_TEST_BASE_LOG.warn("***************************************************************************************"); initializeStevia(parameters); } }
@Override public void onStart(ITestContext context) { Logger logger = getLogger(); logger.debug("Starting tests"); if (logger.isDebugEnabled()) { logger.trace("host: " + context.getHost()); logger.trace("suite name: " + context.getSuite().getName()); logger.trace("parallel: " + context.getSuite().getParallel()); logger.trace("included groups: " + StringUtils.join(context.getIncludedGroups(), ", ")); logger.trace("excluded groups: " + StringUtils.join(context.getExcludedGroups(), ", ")); } if (logger.isTraceEnabled()) { ISuite suite = context.getSuite(); XmlSuite xmlSuite = suite.getXmlSuite(); logger.trace("thread count: " + xmlSuite.getThreadCount()); logger.trace("data provider thread count: " + xmlSuite.getDataProviderThreadCount()); logger.trace("methods: " + StringUtils.join(suite.getAllMethods(), ", ")); logger.trace("excluded methods: " + StringUtils.join(suite.getExcludedMethods(), ", ")); Set<Entry<String, String>> allParameters = xmlSuite.getAllParameters().entrySet(); for (Entry<String, String> entry : allParameters) { logger.trace(entry.getKey() + "='" + entry.getValue() + "'"); } } }
@Override public void onStart(ITestContext context) { Logger logger = getLogger(); logger.debug("Starting tests"); if (logger.isDebugEnabled()) { logger.trace("host: " + context.getHost()); logger.trace("suite name: " + context.getSuite().getName()); logger.trace("parallel: " + context.getSuite().getParallel()); logger.trace("included groups: " + StringUtils.join(context.getIncludedGroups(), ", ")); logger.trace("excluded groups: " + StringUtils.join(context.getExcludedGroups(), ", ")); } if (logger.isTraceEnabled()) { ISuite suite = context.getSuite(); XmlSuite xmlSuite = suite.getXmlSuite(); logger.trace("thread count: " + xmlSuite.getThreadCount()); logger.trace("data provider thread count: " + xmlSuite.getDataProviderThreadCount()); logger.trace("methods: " + StringUtils.join(suite.getAllMethods(), ", ")); logger.trace("excluded methods: " + StringUtils.join(suite.getExcludedMethods(), ", ")); Set<Entry<String, String>> allParameters = xmlSuite.getAllParameters().entrySet(); for (Entry<String, String> entry : allParameters) { logger.trace(entry.getKey() + "='" + entry.getValue() + "'"); } } }
Map<String,String> parameters = testContext.getSuite().getXmlSuite().getAllParameters();
"Official test harness of the OGC conformance testing program (CITE).", this.langCode); Map<String, String> params = suite.getXmlSuite().getAllParameters(); String iut = params.get("iut"); if (null == iut) {
@Override public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory) { for (ISuite suite : suites) { Model model = initializeModel(suite); addTestRequirements(model, suite.getXmlSuite().getTests()); addTestInputs(model, suite.getXmlSuite().getAllParameters()); TestRunSummary summary = new TestRunSummary(suite); this.testRun.addLiteral(CITE.testsPassed, new Integer(summary.getTotalPassed())); this.testRun.addLiteral(CITE.testsFailed, new Integer(summary.getTotalFailed())); this.testRun.addLiteral(CITE.testsSkipped, new Integer(summary.getTotalSkipped())); Literal duration = model.createTypedLiteral(summary.getTotalDuration(), XSDDatatype.XSDduration); this.testRun.addLiteral(DCTerms.extent, duration); this.testRun.addLiteral(CITE.testSuiteType, "testng"); processSuiteResults(model, suite.getResults()); this.testRun.addLiteral(CITE.passedCoreConformanceClasses, passedCoreConformanceClasses); this.earlModel.add(model); } File outputDir = new File(outputDirectory); if (!outputDir.isDirectory()) { outputDir = new File(System.getProperty("java.io.tmpdir")); } try { writeModel(this.earlModel, outputDir, true); } catch (IOException iox) { throw new RuntimeException( "Failed to serialize EARL results to " + outputDir.getAbsolutePath(), iox); } }