Menu

#35 assertLinkById and assertLink blow up on error

closed-rejected
None
5
2010-07-27
2009-10-23
Tarjei Huse
No

When using assertLinkById in a test and the test fails, it causes a fatal error because of a missing test.

Example of the errormessage:
Fatal error: Call to a member function asString() on a non-object in simpletest/simpletest/trunk/web_tester.php on line 1110
Call Stack:
0.0328 4411400 1. simpletest_autorun() simpletest/simpletest/trunk/autorun.php:0
0.0328 4411724 2. run_local_tests() simpletest/simpletest/trunk/autorun.php:28
0.0341 4476968 3. TestSuite->run() simpletest/simpletest/trunk/autorun.php:52
0.0354 4478632 4. SimpleTestCase->run() simpletest/simpletest/trunk/test_case.php:559
0.0366 4483136 5. SimpleErrorTrappingInvoker->invoke() simpletest/simpletest/trunk/test_case.php:144
0.0367 4483964 6. SimpleInvokerDecorator->invoke() simpletest/simpletest/trunk/errors.php:42
0.0367 4483964 7. SimpleExceptionTrappingInvoker->invoke() simpletest/simpletest/trunk/invoker.php:126
0.0367 4484608 8. SimpleInvokerDecorator->invoke() simpletest/simpletest/trunk/exceptions.php:43
0.0367 4484608 9. SimpleInvoker->invoke() simpletest/simpletest/trunk/invoker.php:126
0.0367 4484608 10. VarmepumpeinfoWebTest->test_forhandlersok() simpletest/simpletest/trunk/invoker.php:68
0.6545 4702144 11. WebTestCase->assertLinkById() test_sometest.php:48

I tried to create a failing test for this in acceptancetests:

--- test/acceptance_test.php (revision 1968)
+++ test/acceptance_test.php (working copy)
@@ -319,7 +320,13 @@
$this->assertTrue($this->clickLinkById(1));
$this->assertText('target for the SimpleTest');
}
+ function testLinkIdFollowingFail() {
+ // $this->expectException(); <-- expectException could be usefull for the webtest as well...
+ $this->get($this->samples() . 'link_confirm.php');
+ $this->assertLinkById("test-link-that-does-not-exist");
+ }

But I didn't get it to work.

Discussion

  • Tarjei Huse

    Tarjei Huse - 2009-10-23

    Patch fixing failing assertLinkById causing fatal errors.

     
  • Perrick Penet

    Perrick Penet - 2010-07-27

    It's working for me : I couldn't reproduce the bug with the /trunk version. Your test is indeed failing but not with a fatal error anymore.

    Yours,
    Perrick

     
  • Perrick Penet

    Perrick Penet - 2010-07-27
    • assigned_to: nobody --> pp11
    • status: open --> closed-rejected
     

Log in to post a comment.