Menu

#215 HtmlReporter should not declare paintFail

open
Web tester (52)
5
2012-05-07
2012-05-07
Serban
No

I was creating a custom reporter by extending the class HtmlReporter.
I've modified both paintPass($message) and paintFail($message) and noticed that the fails were echoed twice.

class FancyHtmlReporter extends HtmlReporter {

[...]
function paintFail($message) {
parent::paintFail($message);
echo '<span style="background:red; color:white; padding:0 5px;">Fail</span>: ';
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print implode(" -&gt; ", $breadcrumb);
print " -&gt; " . $this->htmlEntities($message) . "<br />\n";
}
[...]

}

This is because FancyHtmlReporter::paintFail($message) calls HtmlReporter($message) through parent::paintFail($message) which duplicates the error message. If I remove paret:paintFail($message), the error doesn't get counted anymore.

I've removed paintFail() method from HtmlReporter() and i'm not getting any duplicate outputs.

PS: you can also replicate this by modifying in /test/visual_test.php the PassesAsWellReporter class, just add a custom paintFail($message) method, and refresh.

Thanks!

Discussion


Log in to post a comment.