Connect to PHPUnit_Framework_TestListener

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
Blockhead
Forum Newbie
Posts: 2
Joined: Wed Mar 09, 2011 5:42 am

Connect to PHPUnit_Framework_TestListener

Post by Blockhead »

Greetings. At me a problem with connection of the PHPUnit_Framework_TestListener.
I use phpUnit 3.5.12
Maximum of that has achieved, it is an inscription about the beginning of the test.
Explain how correctly to connect the given class to tests please.
Blockhead
Forum Newbie
Posts: 2
Joined: Wed Mar 09, 2011 5:42 am

Re: Connect to PHPUnit_Framework_TestListener

Post by Blockhead »

Code: Select all

<?php
require_once 'PHPUnit/Framework.php';
 
include 'ArrayTest.php';
require_once 'SimpleTestListener.php';
 
$suite = new PHPUnit_Framework_TestSuite('ArrayTest');
 
$result = new PHPUnit_Framework_TestResult;
$result->addListener(new SimpleTestListener);
 
$suite->run($result);
?>

Code: Select all

<?php
        require_once 'PHPUnit/Framework.php';
        require_once 'Testing/Selenium.php';
         
        class GoogleTest extends PHPUnit_Framework_TestCase
        {
            private $selenium;
            private $test;
         
            public function setUp()
            {
                $this->selenium = new Testing_Selenium("*chrome", "http://www.google.com");
                $this->selenium->start();
            }
         
            public function tearDown()
            {
                $this->selenium->stop();
            }
         
            public function testGoogle()
            {
                $this->selenium->open("/");
                $this->selenium->type("q", "hello world");
                $this->selenium->click("btnG");
                $this->selenium->waitForPageToLoad(10000);
                $this->assertRegExp("/Поиск в Google/", $this->selenium->getTitle());
            }
        }
?>
I use CMD:
phpunit test.php
On an output:
Class GoogleTest could not be found in test3.php.
Post Reply