PHPUnitManual:17.3

From 흡혈양파의 번역工房
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
17.3 PHPUnit_Extensions_Selenium2TestCase

PHPUnit_Extensions_Selenium2TestCase test case 는 WebDriver API 를 사용합니다 (일부만이 구현되어 있습니다).


예17.1 "PHPUnit_Extensions_Selenium2TestCase 의 사용예" 는, http://www.example.com/ 의 <title> element 의 내용을 테스트하는 방법입니다.


예17.1 PHPUnit_Extensions_Selenium2TestCase 의 사용예

<?php
class WebTest extends PHPUnit_Extensions_Selenium2TestCase
{
    protected function setUp()
    {
        $this->setBrowser('firefox');
        $this->setBrowserUrl('http://www.example.com/');
    }
 
    public function testTitle()
    {
        $this->url('http://www.example.com/');
        $this->assertEquals('Example WWW Page', $this->title());
    }
 
}
?>
phpunit WebTest
PHPUnit 3.6.10 by Sebastian Bergmann.

F

Time: 28 seconds, Memory: 3.00Mb

There was 1 failure:

1) WebTest::testTitle
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Example WWW Page'
+'IANA — Example domains'

/home/giorgio/WebTest.php:13

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.


Selenium2TestCare 는 __call() 을 사용하여 구현되어 있습니다. 지원가능목록은 PHPUnit_Extensions_Selenium2TestCase 의 end-to-end test[1] 를 참조하세요.


Notes