Question

file1:

<?php
require_once('simpletest/autorun.php');
require_once('simpletest/web_tester.php');

class TestOfRankings extends WebTestCase {
    function tesetWeAreTopOfGoogle() {
        $this->get('http://poll:8888/index.php/admin/unit_test');
        $this->assertText('this is good');
    }
}
?>

file2:

require_once('simpletest/autorun.php');
require_once('simpletest/web_tester.php');

class MakTest extends WebTestCase {
    function testOneAndOneMakesTwo() {
        $this->get('http://poll:8888/index.php/admin/unit_test');
        $this->assertText('this is good');
    }
}

almost identical files, why do they give me different result?

file1.php
OK
Test cases run: 0/2, Passes: 0, Failures: 0, Exceptions: 0


file2.php
OK
Test cases run: 1/2, Passes: 1, Failures: 0, Exceptions: 0
Was it helpful?

Solution

According to the SimpleTest docs:

When a test case runs, it will search for any method that starts with the string "test" and execute that method. If the method starts "test", it's a test.

In file1 the function name is tesetWeAreTopOfGoogle (this seems to be a typo). Switch to testWeAreTopOfGoogle and you'll be golden.

OTHER TIPS

Your functions probably need to start with test. tesetWeAreTopOfGoogle should be testWeAreTopOfGoogle?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top