Check web page content a failure
It's really nice to see everything working but there will be times when you encounter a problem. For example that certain text is missing from the web page:
examples/php/simpletest/web04.php
<?php require_once(dirname(__FILE__) . '/../../../tools/simpletest/autorun.php'); require_once(dirname(__FILE__) . '/../../../tools/simpletest/web_tester.php'); class TestOfCalculator extends WebTestCase { function testBasicCalc() { $url = 'http://localhost:8081/php/calc/basic_calc.php'; $this->assertTrue($this->get($url)); $this->assertText('Basic Calculator'); $this->assertTitle('Scientific Calculator'); $this->assertText('Real Calculator'); } } ?>
Will fail with the following output
examples/php/simpletest/web04.txt
web04.php Fail: TestOfCalculator -> testBasicCalc -> Text [Real Calculator] not detected in [String: Scientific Calculator Basic Calculator Value: Value:] at [.../examples/php/simpletest/web04.php line 14] 1/1 test cases complete: 3 passes, 1 fails and 0 exceptions.