/** If this test failed, then return the build number when this test started failing. */ @Override @Exported(visibility = 9) public int getFailedSince() { // If we haven't calculated failedSince yet, and we should, // do it now. if (failedSince == 0 && getFailCount() > 0) { try { List<JUnitSummaryInfo> history = junitDB.summarizeTestCaseHistory( testInfo.getProjectName(), testInfo.getModuleName(), testInfo.getPackageName(), testInfo.getClassName(), testInfo.getCaseName(), 5000); for (JUnitSummaryInfo junitSummaryInfo : history) { int failedBuildNumber = junitSummaryInfo.getBuildNumber(); if (failedBuildNumber < testInfo.getBuildNumber() && (junitSummaryInfo.getFailCount() > 0 || junitSummaryInfo.getErrorCount() > 0)) { failedSince = failedBuildNumber; break; } } if (failedSince == 0) { failedSince = testInfo.getBuildNumber(); } } catch (SQLException sE) { LOGGER.log(Level.SEVERE, sE.getMessage(), sE); } } return failedSince; }
public String getFullName() { return testInfo.getModuleName() + '.' + testInfo.getPackageName() + '.' + testInfo.getClassName() + '.' + testInfo.getCaseName(); }
/** * The stderr of this test. * * @see #getStdout() * @since 1.294 */ @Override @Exported public String getStderr() { StringReaderWriter stderrReaderWriter = new StringReaderWriter(); String result = ""; try { JUnitTestDetailInfo junitTestDetailInfo = junitDB.readTestDetail( testInfo.getBuildNumber(), testInfo.getProjectName(), testInfo.getModuleName(), testInfo.getPackageName(), testInfo.getClassName(), testInfo.getCaseName(), null, stderrReaderWriter); StringWriter sW = new StringWriter(); IOUtil.write(junitTestDetailInfo.getStderr(), sW); result = sW.toString(); if (result == null || result.isEmpty()) { junitTestDetailInfo = junitDB.readTestDetail( testInfo.getBuildNumber(), testInfo.getProjectName(), testInfo.getModuleName(), "<init>", "<init>", "<init>", null, stderrReaderWriter); sW = new StringWriter(); IOUtil.write(junitTestDetailInfo.getStderr(), sW); result = sW.toString(); } } catch (SQLException sE) { LOGGER.log(Level.SEVERE, sE.getMessage(), sE); } catch (IOException iE) { LOGGER.log(Level.SEVERE, iE.getMessage(), iE); } finally { try { stderrReaderWriter.release(); } catch (IOException iE) { LOGGER.log(Level.SEVERE, iE.getMessage(), iE); } } return result; }
private JUnitTestInfo getPreviousTestInfo() { if (previousTestInfo == null) { try { previousTestInfo = junitDB.queryTestCaseForBuildPriorTo( testInfo.getProjectName(), testInfo.getBuildNumber(), testInfo.getModuleName(), testInfo.getPackageName(), testInfo.getClassName(), testInfo.getCaseName()); } catch (SQLException sE) { LOGGER.log(Level.SEVERE, sE.getMessage(), sE); } } return previousTestInfo; }
public JUnitMetricsInfo getMetrics() { if (metrics == null) { try { metrics = junitDB.fetchTestCaseMetrics( testInfo.getBuildNumber(), testInfo.getProjectName(), testInfo.getModuleName(), testInfo.getPackageName(), testInfo.getClassName(), testInfo.getCaseName()); } catch (SQLException sE) { LOGGER.log(Level.SEVERE, sE.getMessage(), sE); } } return metrics; }
/** If there was an error or a failure, this is the text from the message. */ @Override @Exported public String getErrorDetails() { String result = null; try { JUnitTestDetailInfo junitTestDetailInfo = junitDB.readTestDetail( testInfo.getBuildNumber(), testInfo.getProjectName(), testInfo.getModuleName(), testInfo.getPackageName(), testInfo.getClassName(), testInfo.getCaseName(), null, null); result = junitTestDetailInfo.getErrorMessage(); } catch (SQLException sE) { LOGGER.log(Level.SEVERE, sE.getMessage(), sE); } catch (IOException iE) { LOGGER.log(Level.SEVERE, iE.getMessage(), iE); } return result; }
/** * Gets the name of the test, which is returned from {@code TestCase.getName()} * * <p>Note that this may contain any URL-unfriendly character. */ @Exported(visibility = 999) public @Override String getName() { return testInfo.getCaseName(); }
public String getDisplayName() { return testInfo.getCaseName(); }