private TestTag createTestTagFor(ITestResult tr, Class<?> cls) { TestTag testTag = new TestTag(); Properties p2 = new Properties(); p2.setProperty(XMLConstants.ATTR_CLASSNAME, cls.getName()); p2.setProperty(XMLConstants.ATTR_NAME, getTestName(tr)); int status = tr.getStatus(); if (status == ITestResult.SKIP || status == ITestResult.SUCCESS_PERCENTAGE_FAILURE) { testTag.childTag = XMLConstants.SKIPPED; } else if (status == ITestResult.FAILURE) { handleFailure(testTag, tr.getThrowable()); } testTag.properties = p2; return testTag; }
for (ISuite suite : suites) { Map<String, ISuiteResult> suiteResults = suite.getResults(); addMapping(mapping, suite.getExcludedMethods()); for (ISuiteResult sr : suiteResults.values()) { ITestContext tc = sr.getTestContext(); addResults(tc.getPassedTests().getAllResults(), results); addResults(tc.getFailedTests().getAllResults(), results); addResults(tc.getSkippedTests().getAllResults(), results); addResults(tc.getFailedConfigurations().getAllResults(), results); for (ITestResult tr : tc.getPassedConfigurations().getAllResults()) { if (tr.getMethod().isBeforeMethodConfiguration()) { Collection<ITestResult> iTestResults = sort(entry.getValue()); time += getNextConfiguration(befores, tr); time += getNextConfiguration(afters, tr); TestTag testTag = createTestTagFor(tr, cls); testTag.properties.setProperty(XMLConstants.ATTR_TIME, "" + formatTime(time)); testCases.add(testTag); int ignored = getDisabledTestCount(mapping.get(entry.getKey())); testCases.add(createIgnoredTestTagFor(eachMethod)); p1.setProperty(XMLConstants.ATTR_NAME, cls.getName()); p1.setProperty(XMLConstants.ATTR_TESTS, Integer.toString(testCount + ignored)); p1.setProperty(XMLConstants.ATTR_TIME, "" + formatTime(totalTime)); try {
for (ISuite suite : suites) { Map<String, ISuiteResult> suiteResults = suite.getResults(); addMapping(mapping, suite.getExcludedMethods()); for (ISuiteResult sr : suiteResults.values()) { ITestContext tc = sr.getTestContext(); addResults(tc.getPassedTests().getAllResults(), results); addResults(tc.getFailedTests().getAllResults(), results); addResults(tc.getSkippedTests().getAllResults(), results); addResults(tc.getFailedConfigurations().getAllResults(), results); for (ITestResult tr : tc.getPassedConfigurations().getAllResults()) { if (tr.getMethod().isBeforeMethodConfiguration()) { Collection<ITestResult> iTestResults = sort(entry.getValue()); time += getNextConfiguration(befores, tr); time += getNextConfiguration(afters, tr); TestTag testTag = createTestTagFor(tr, cls); testTag.properties.setProperty(XMLConstants.ATTR_TIME, "" + formatTime(time)); testCases.add(testTag); int ignored = getDisabledTestCount(mapping.get(entry.getKey())); testCases.add(createIgnoredTestTagFor(eachMethod)); p1.setProperty(XMLConstants.ATTR_NAME, cls.getName()); p1.setProperty(XMLConstants.ATTR_TESTS, Integer.toString(testCount + ignored)); p1.setProperty(XMLConstants.ATTR_TIME, "" + formatTime(totalTime)); try {
private TestTag createTestTagFor(ITestResult tr, Class<?> cls) { TestTag testTag = new TestTag(); Properties p2 = new Properties(); p2.setProperty(XMLConstants.ATTR_CLASSNAME, cls.getName()); p2.setProperty(XMLConstants.ATTR_NAME, getTestName(tr)); int status = tr.getStatus(); if (status == ITestResult.SKIP || status == ITestResult.SUCCESS_PERCENTAGE_FAILURE) { testTag.childTag = XMLConstants.SKIPPED; } else if (status == ITestResult.FAILURE) { handleFailure(testTag, tr.getThrowable()); } testTag.properties = p2; return testTag; }