/** * When the testcase fails to initialize (exception in constructor or @Before) there is no * 'testcase' element at all. */ @Bug(6700) public void testErrorInTestInitialization() throws Exception { SuiteResult suiteResult = parseOne(getDataFile("junit-report-6700.xml")); assertEquals(1, suiteResult.getCases().size()); CaseResult result = suiteResult.getCases().get(0); assertEquals(1, result.getFailCount()); assertTrue(result.getErrorStackTrace() != null); }
/** * Retrieves the Notes about the JUnit test. * * @param testCase JUnit test. * @return Notes about the JUnit test. */ private String getJUnitNotes(CaseResult testCase, int buildNumber) { StringBuilder notes = new StringBuilder(); notes.append( Messages.Results_JUnit_NotesForTestCase( testCase.getName(), testCase.getClassName(), testCase.getSkipCount(), testCase.getFailCount(), (testCase.getSuiteResult() != null ? testCase.getSuiteResult().getTimestamp() : null))); /* Added for appending build number and error message */ notes.append("\nBuild no : " + buildNumber); if (null != testCase.getErrorDetails()) { notes.append("\nError Message : " + testCase.getErrorDetails()); } return notes.toString(); }