|
From: Yaroslav D. <ya...@wa...> - 2004-04-15 21:31:38
|
Hello guys, I just wanted to share a finding that saved me considerable amount of typing today. But it requires XDebug (www.xdebug.org). ------------------------------ Index: simple_test.php =================================================================== RCS file: /cvsroot/simpletest/simpletest/simple_test.php,v retrieving revision 1.57 diff -r1.57 simple_test.php 269a270 > return TRUE; 271c272,273 < $this->fail($message); --- > $this->fail($message. " "."Called @ ".xdebug_call_file().":".xdebug_call_line()." from ".xdebug_call_function()); > return FALSE; ------------------------------- I.e. when assertTrue() fails, the message also includes the source line number. Before that, when I extensively used constructs like this: $this->assertTrue($this->setField("accounts", "1 Month Pass"), "Failed to set 'accounts' field."); $this->assertTrue($this->setField("username", "yar_auto_test"), "Failed to set 'username' field."); $this->assertTrue($this->setField("fname", "AutomaticTest"), "Failed to set 'fname' field."); $this->assertTrue($this->setField("lname", "ByYar"), "Failed to set 'lname' field."); $this->assertTrue($this->setField("payment", "worldpay"), "Failed to set 'payment' field."); $this->clickSubmit('Submit My Order'); it was sometimes too boring to type in multiple messages, and without these custom messages it was impossible to locate the error. Now it prints: "1) True assertion got False Called @ /var/www/virtualhosts/someproject.com/tests/test.php:82 from testsubscription in testsubscription" Best wishes, Yar |