static void copyAttributes(ITestResult source, ITestResult target) { source .getAttributeNames() .forEach(name -> target.setAttribute(name, source.getAttribute(name))); }
private void addTestResultAttributes(XMLStringBuffer xmlBuffer, ITestResult testResult) { if (testResult.getAttributeNames() != null && testResult.getAttributeNames().size() > 0) { xmlBuffer.push(XMLReporterConfig.TAG_ATTRIBUTES); for (String attrName: testResult.getAttributeNames()) { if (attrName == null) { continue; } Object attrValue = testResult.getAttribute(attrName); Properties attributeAttrs = new Properties(); attributeAttrs.setProperty(XMLReporterConfig.ATTR_NAME, attrName); if (attrValue == null) { attributeAttrs.setProperty(XMLReporterConfig.ATTR_IS_NULL, "true"); xmlBuffer.addEmptyElement(XMLReporterConfig.TAG_ATTRIBUTE, attributeAttrs); } else { xmlBuffer.push(XMLReporterConfig.TAG_ATTRIBUTE, attributeAttrs); xmlBuffer.addCDATA(attrValue.toString()); xmlBuffer.pop(); } } xmlBuffer.pop(); } }
private void addTestResultAttributes(XMLStringBuffer xmlBuffer, ITestResult testResult) { if (testResult.getAttributeNames() != null && testResult.getAttributeNames().size() > 0) { xmlBuffer.push(XMLReporterConfig.TAG_ATTRIBUTES); for (String attrName : testResult.getAttributeNames()) { if (attrName == null) { continue; } Object attrValue = testResult.getAttribute(attrName); Properties attributeAttrs = new Properties(); attributeAttrs.setProperty(XMLReporterConfig.ATTR_NAME, attrName); if (attrValue == null) { attributeAttrs.setProperty(XMLReporterConfig.ATTR_IS_NULL, "true"); xmlBuffer.addEmptyElement(XMLReporterConfig.TAG_ATTRIBUTE, attributeAttrs); } else { xmlBuffer.push(XMLReporterConfig.TAG_ATTRIBUTE, attributeAttrs); xmlBuffer.addCDATA(attrValue.toString()); xmlBuffer.pop(); } } xmlBuffer.pop(); } } }
private void extractAttributes(ITestResult result) { Consumer<String> attribute = each -> attributes.put(each, result.getAttribute(each).toString()); result.getAttributeNames().forEach(attribute); }
private static Map<String, Object> attributesFrom(ITestResult r) { Map<String, Object> attributes = Maps.newHashMap(); for (String key : r.getAttributeNames()) { attributes.put(key, r.getAttribute(key)); } return attributes; } }
private static Map<String, Object> extractAttributes(ITestResult result) { Map<String, Object> attributes = new HashMap<String, Object>(); for (String eachAttribute : result.getAttributeNames()) { attributes.put(eachAttribute, result.getAttribute(eachAttribute)); } return attributes; }
if (!tngResult.getAttributeNames().contains(REQ_ATTR)) return;