I very recently started working on Selenium. I know to run the testcases on IE we should have Selenium Server. I downloaded and finally got it running on my computer. Can anyone tell me how do i put the Selenium test case from IDE to RC and integrate the RC in PHP? or how to run Selenium RC . Correct me if anything wrong in my understanding.
Note: i searched everything related to Selenium RC but i dint find anything clear. U can give me any valuable link that answers my RC in PHP question.
I wo开发者_运维问答uld really appreciate your help.
I am not sure what you mean by "Selenium test case from IDE to RC". I think you are referring to browser addon for Selenium testing.
Anyhow, to integrate Selenium RC with PHP, you need PHPUnit framework which supports Selenium test cases. You need to do the following steps.
- Download and run Selenium RC server (I think you already done this, great!)
- Write a selenium test case by extending to PHPUnit Selenium Test Case class.
- Then run your test case as you would run any other PHPUnit test cases.
Sample code for how to write a Selenium test case using PHPUnit is as follow.
<?php
require_once 'PHPUnit/Extensions/SeleniumTestCase.php';
class WebTest extends PHPUnit_Extensions_SeleniumTestCase
{
protected function setUp()
{
$this->setBrowser('*firefox');
$this->setBrowserUrl('http://www.example.com/');
}
public function testTitle()
{
$this->open('http://www.example.com/');
$this->assertTitleEquals('Example Web Page');
}
}
?>
For more information, please refer to PHPUnit documentation on Selenium test cases. http://www.phpunit.de/manual/3.1/en/selenium.html
精彩评论