Please review the following patch that add a custom css class matching the message group to test results row:
diff -r 161238ccf3ff usr/src/simpletest/simpletest.pages.inc
--- a/usr/src/simpletest/simpletest.pages.inc Sat Nov 28 10:59:53 2009 +0100
+++ b/usr/src/simpletest/simpletest.pages.inc Sat Nov 28 11:18:40 2009 +0100
-274,6 +274,9 @@
$class = 'simpletest-' . $assertion->status;
if ($assertion->message_group == 'Debug') {
$class = 'simpletest-debug';
+ } else if (!empty($assertion->message_group)) {
+ $group_class = strtolower(trim(preg_replace("/[^\w\d]/", "-", $assertion->message_group)));
+ $class .= ' simpletest-' . $group_class;
}
// $rows[] = array('data' => $row, 'class' => array($class));
$rows[] = array('data' => $row, 'class' => $class);
It allows to turn the following assertion:
$this->assertEqual(3000, $user->Chips(), "4.1 If he filled in all profile data, he will receive a starting bonus of 3000 chips booked to his account", 'Spec');
Into this markup in the result:
<tr class="simpletest-fail simpletest-spec odd">
Let me know if it needs more love (like unittest in simpletest.test ?).
Comments
Comment #1
boombatower commentedSeems like a possibility. Just curious what your usecase is.
Comment #2
proppy commentedUse cases is to allow theming of the result page to highlight asserts given their group parameter.