Modify Simpletest's HTML Reporter

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Modify Simpletest's HTML Reporter

Post by Ollie Saunders »

OK I have a failing error like this:
Fail: OF/Testing/TestOfClassEnc.php -> TestOfEnc -> testStrPad -> Equal expectation fails at character 13 with [<IñtërnëT>] and [<IñtërnëT> ] at [/osis/lib/code/php/OF/Testing/TestOfClassEnc.php line 53
Obviously its really difficult to see what the difference is because the browser removes whitespace. So what I'd like to do is modify the reporter to output each character as a list item with some special whitespace characters highlighted somehow. Like this:
Fail: OF/Testing/TestOfClassEnc.php -> TestOfEnc -> testStrPad -> Equal expectation fails at character 13 with [<|I|ñ|t|ë|r|n|ë|T|>] and [<|I|ñ|t|ë|r|n|ë|T|>|sp|\n] at [/osis/lib/code/php/OF/Testing/TestOfClassEnc.php line 53
Only it'll be better because it'll be formatted with HTML and CSS

I've had a look at the source code and I'm damned if I can work out where to go to change this stuff.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

The relevant code is in dumper.php. Specific function is _describeStringDifference()
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Great thanks.

Edit: uh no there's no way I can modify this, its written so as to be complete unmodifyable!
_describeStringDifference() is called by describeDifference() which is called from 7 different places and is escaped somewher so you can't add any HTML.
lastcraft
Forum Commoner
Posts: 80
Joined: Sat Jul 12, 2003 10:31 pm
Location: London

Post by lastcraft »

Hi...
ole wrote:Edit: uh no there's no way I can modify this, its written so as to be complete unmodifyable!
_describeStringDifference() is called by describeDifference() which is called from 7 different places and is escaped somewher so you can't add any HTML.
Yeah, sorry :(. The system of error messages needs a bit of a rethink...or even a think. It's a gnarly bit that grew of it's own accord. Mail me the kind of thing you want to happen, so that I can incorporate it in the next release.

My biggest problem is how to make the dumper type stuff overrideabe without complicating the testing interface. One option is something really crude like...

Code: Select all

SimpleTest::setDumper($dumper);
...but that won't survive the first refactor. If I can build a language of things people want to do, I can then decompose Dumper into something that easier to change. Hence why I need you to describe the problem ;).

yours, Marcus
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Sending you a pm marcus.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

The sort of "diff" display that trac uses would be neat :)
Post Reply