Methods Summary |
---|
public void | assertIndexCreated()
if (!new File(System.getProperty("root"),
"src/etc/testcases/taskdefs/optional/junitreport/test/html/index.html").exists()) {
fail("No file index file found");
}
|
private void | expectReportWithText(java.lang.String targetName, java.lang.String text)run a target, assert the index file is there, look for text in the log
executeTarget(targetName);
assertIndexCreated();
if(text!=null) {
assertLogContaining(text);
}
|
protected void | setUp()
configureProject("src/etc/testcases/taskdefs/optional/junitreport.xml");
|
protected void | tearDown()
executeTarget("clean");
|
public void | testEmptyFile()
expectReportWithText("testEmptyFile",
XMLResultAggregator.WARNING_EMPTY_FILE);
|
public void | testIncompleteFile()
expectReportWithText("testIncompleteFile",
XMLResultAggregator.WARNING_IS_POSSIBLY_CORRUPTED);
|
public void | testNoFileJUnitNoFrames()Verifies that no empty junit-noframes.html is generated when frames
output is selected via the default.
Needs reports1 task from junitreport.xml.
executeTarget("reports1");
if (new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/junit-noframes.html").exists())
{
fail("No file junit-noframes.html expected");
}
|
public void | testNoFrames()
executeTarget("testNoFrames");
File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/junit-noframes.html");
// tests one the file object
assertTrue("No junit-noframes.html present. Not generated?", reportFile.exists() );
assertTrue("Cant read the report file.", reportFile.canRead() );
assertTrue("File shouldnt be empty.", reportFile.length() > 0 );
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report
URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) );
InputStream reportStream = reportUrl.openStream();
assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0);
|
public void | testSpecialSignsInHtmlPath()
executeTarget("testSpecialSignsInHtmlPath");
File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html# $%\u00A7&-!report/index.html");
// tests one the file object
assertTrue("No index.html present. Not generated?", reportFile.exists() );
assertTrue("Cant read the report file.", reportFile.canRead() );
assertTrue("File shouldnt be empty.", reportFile.length() > 0 );
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report
URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) );
InputStream reportStream = reportUrl.openStream();
assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0);
|
public void | testSpecialSignsInSrcPath()
executeTarget("testSpecialSignsInSrcPath");
File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/index.html");
// tests one the file object
assertTrue("No index.html present. Not generated?", reportFile.exists() );
assertTrue("Cant read the report file.", reportFile.canRead() );
assertTrue("File shouldnt be empty.", reportFile.length() > 0 );
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report
URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) );
InputStream reportStream = reportUrl.openStream();
assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0);
|
public void | testStackTraceLineBreaks()
expectReportWithText("testStackTraceLineBreaks", null);
FileReader r = null;
try {
r = new FileReader(new File(System.getProperty("root"),
"src/etc/testcases/taskdefs/optional/junitreport/test/html/sampleproject/coins/0_CoinTest.html"));
String report = FileUtils.readFully(r);
assertTrue("output must contain <br>",
report.indexOf("junit.framework.AssertionFailedError: DOEG<br/>")
> -1);
} finally {
FileUtils.close(r);
}
|
public void | testWithParams()
expectLogContaining("testWithParams", "key1=value1,key2=value2");
File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/index.html");
// tests one the file object
assertTrue("No index.html present. Not generated?", reportFile.exists() );
assertTrue("Cant read the report file.", reportFile.canRead() );
assertTrue("File shouldnt be empty.", reportFile.length() > 0 );
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report
URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) );
InputStream reportStream = reportUrl.openStream();
assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0);
|
public void | testWithStyleFromClasspath()
executeTarget("testWithStyleFromClasspath");
File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/index.html");
// tests one the file object
assertTrue("No index.html present. Not generated?", reportFile.exists() );
assertTrue("Cant read the report file.", reportFile.canRead() );
assertTrue("File shouldnt be empty.", reportFile.length() > 0 );
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report
URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) );
InputStream reportStream = reportUrl.openStream();
assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0);
|
public void | testWithStyleFromDir()
executeTarget("testWithStyleFromDir");
File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/index.html");
// tests one the file object
assertTrue("No index.html present. Not generated?", reportFile.exists() );
assertTrue("Cant read the report file.", reportFile.canRead() );
assertTrue("File shouldnt be empty.", reportFile.length() > 0 );
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report
URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) );
InputStream reportStream = reportUrl.openStream();
assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0);
|
public void | testWithStyleFromDirAndXslImport()
executeTarget("testWithStyleFromDirAndXslImport");
File reportFile = new File(System.getProperty("root"), "src/etc/testcases/taskdefs/optional/junitreport/test/html/index.html");
// tests one the file object
assertTrue("No index.html present. Not generated?", reportFile.exists() );
assertTrue("Cant read the report file.", reportFile.canRead() );
assertTrue("File shouldnt be empty.", reportFile.length() > 0 );
// conversion to URL via FileUtils like in XMLResultAggregator, not as suggested in the bug report
URL reportUrl = new URL( FileUtils.getFileUtils().toURI(reportFile.getAbsolutePath()) );
InputStream reportStream = reportUrl.openStream();
assertTrue("This shouldnt be an empty stream.", reportStream.available() > 0);
|
public void | testWrongElement()
expectReportWithText("testWrongElement",
XMLResultAggregator.WARNING_INVALID_ROOT_ELEMENT);
|