/** * @deprecated Use {@code getLocalParameters()} instead * * @return the parameters defined on this <test> tag only */ @Deprecated public Map<String, String> getTestParameters() { return getLocalParameters(); }
/** * @deprecated Use {@code getLocalParameters()} instead * @return the parameters defined on this <test> tag only */ @Deprecated public Map<String, String> getTestParameters() { return getLocalParameters(); }
/** * @return The parameters defined in this test tag and the tags above it. */ public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); if (m_xmlTest != null) { result.putAll(m_xmlTest.getLocalParameters()); } result.putAll(m_parameters); return result; }
/** @return The parameters defined in this test tag and the tags above it. */ public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); if (m_xmlTest != null) { result.putAll(m_xmlTest.getLocalParameters()); } result.putAll(m_parameters); return result; }
@Override public Map<String, String> findMethodParameters(XmlTest test) { return test.getLocalParameters(); }
/** * @return The parameters defined in this suite and all its XmlTests. */ public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); for (Map.Entry<String, String> entry : m_parameters.entrySet()) { result.put(entry.getKey(), entry.getValue()); } for (XmlTest test : getTests()) { Map<String, String> tp = test.getLocalParameters(); for (Map.Entry<String, String> entry : tp.entrySet()) { result.put(entry.getKey(), entry.getValue()); } } return result; }
/** @return The parameters defined in this suite and all its XmlTests. */ public Map<String, String> getAllParameters() { Map<String, String> result = Maps.newHashMap(); for (Map.Entry<String, String> entry : m_parameters.entrySet()) { result.put(entry.getKey(), entry.getValue()); } for (XmlTest test : getTests()) { Map<String, String> tp = test.getLocalParameters(); for (Map.Entry<String, String> entry : tp.entrySet()) { result.put(entry.getKey(), entry.getValue()); } } return result; }
toYaml(result, "parameters", sp2, t.getLocalParameters());
toYaml(result, sp2, t.getLocalParameters());
XmlUtils.dumpParameters(xsb, xmlTest.getLocalParameters());
/** * Clone the <TT>source</TT> <CODE>XmlTest</CODE> by including: * - test attributes * - groups definitions * - parameters * * The <classes> sub element is ignored for the moment. * * @return a clone of the current XmlTest */ @Override public Object clone() { XmlTest result = new XmlTest(getSuite()); result.setName(getName()); result.setIncludedGroups(getIncludedGroups()); result.setExcludedGroups(getExcludedGroups()); result.setJUnit(isJUnit()); result.setParallel(getParallel()); result.setVerbose(getVerbose()); result.setParameters(getLocalParameters()); result.setXmlPackages(getXmlPackages()); result.setTimeOut(getTimeOut()); Map<String, List<String>> metagroups = getMetaGroups(); for (Map.Entry<String, List<String>> group: metagroups.entrySet()) { result.addMetaGroup(group.getKey(), group.getValue()); } return result; }
test.getLocalParameters().put("InheritedFromTest", "InheritedFromTest"); test.getLocalParameters().put("a", "Correct"); break; case PASS_CLASS:
XmlUtils.dumpParameters(xsb, xmlTest.getLocalParameters());
/** * Clone the <TT>source</TT> <CODE>XmlTest</CODE> by including: - test attributes - groups * definitions - parameters * * <p>The <classes> sub element is ignored for the moment. * * @return a clone of the current XmlTest */ @Override public Object clone() { XmlTest result = new XmlTest(getSuite()); result.setName(getName()); result.setIncludedGroups(getIncludedGroups()); result.setExcludedGroups(getExcludedGroups()); result.setJUnit(isJUnit()); result.setParallel(getParallel()); result.setVerbose(getVerbose()); result.setParameters(getLocalParameters()); result.setXmlPackages(getXmlPackages()); result.setTimeOut(getTimeOut()); Map<String, List<String>> metagroups = getMetaGroups(); for (Map.Entry<String, List<String>> group : metagroups.entrySet()) { result.addMetaGroup(group.getKey(), group.getValue()); } return result; }
/** * Generate testng-failed.xml */ private void createXmlTest(ITestContext context, List<ITestNGMethod> methods, XmlTest srcXmlTest) { XmlTest xmlTest = new XmlTest(m_xmlSuite); xmlTest.setName(context.getName() + "(failed)"); xmlTest.setBeanShellExpression(srcXmlTest.getExpression()); xmlTest.setIncludedGroups(srcXmlTest.getIncludedGroups()); xmlTest.setExcludedGroups(srcXmlTest.getExcludedGroups()); xmlTest.setParallel(srcXmlTest.getParallel()); xmlTest.setParameters(srcXmlTest.getLocalParameters()); xmlTest.setJUnit(srcXmlTest.isJUnit()); List<XmlClass> xmlClasses = createXmlClasses(methods, srcXmlTest); xmlTest.setXmlClasses(xmlClasses); }
/** Generate testng-failed.xml */ private void createXmlTest( ITestContext context, List<ITestNGMethod> methods, XmlTest srcXmlTest) { XmlTest xmlTest = new XmlTest(m_xmlSuite); xmlTest.setName(context.getName() + "(failed)"); xmlTest.setScript(srcXmlTest.getScript()); xmlTest.setIncludedGroups(srcXmlTest.getIncludedGroups()); xmlTest.setExcludedGroups(srcXmlTest.getExcludedGroups()); xmlTest.setParallel(srcXmlTest.getParallel()); xmlTest.setParameters(srcXmlTest.getLocalParameters()); xmlTest.setJUnit(srcXmlTest.isJUnit()); List<XmlClass> xmlClasses = createXmlClasses(methods, srcXmlTest); xmlTest.setXmlClasses(xmlClasses); }
String getCurrentSuiteTitle(ITestContext iTestContext) { String suite = iTestContext.getSuite().getName(); String xmlTest = iTestContext.getCurrentXmlTest().getName(); String params = ""; if (!iTestContext.getCurrentXmlTest().getLocalParameters().isEmpty() && AllureConfig.newInstance().areTestNgParametersEnabled()) { params = iTestContext.getCurrentXmlTest().getLocalParameters() .toString().replace("{", "[").replace("}", "]"); } return suite + " : " + xmlTest + params; }
/** * Parses configuration file and extracts values for test environment * * @param context * list of parameters includes values within <suite></suite> and <test></test> * tags */ public synchronized static void initConfig(ITestContext context) { SeLionLogger.getLogger().entering(context); Map<ConfigProperty, String> initialValues = new HashMap<>(); Map<String, String> testParams = context.getCurrentXmlTest().getLocalParameters(); if (!testParams.isEmpty()) { for (ConfigProperty prop : ConfigProperty.values()) { // Check if a selionConfig param resides in the <test> String newValue = testParams.get(prop.getName()); // accept param values that are empty in initialValues. if (newValue != null) { initialValues.put(prop, newValue); } } } ConfigManager.addConfig(context.getCurrentXmlTest().getName(), new LocalConfig(initialValues)); SeLionLogger.getLogger().exiting(); }