Netbeans (6.8), Selenium and Yii

Netbeans 6.8, Selenium and Yii

Ref.: http://www.yiiframework.com/forum/index.php?/topic/4717-netbeans-68-phpunit-and-yii/

[list=a]

[*]Install PHPunit (If it is not already installed)

[*]Install Testing_Selenium-0.4.3 (pear install Testing_Selenium-beta)

[*]install the Selenium plugin for PHP from the Netbeans development Update Center (Tools->plugins. Select Available Plugins. Search for selenium plugin for PHP. Activate and Click Install button)

[/list]

To create a selenium test

  1. Create a directory for your selenium tests (selenium_tests) under testdrive folder. You may want to use the Files tab.

  2. Right click testdrive project in the Projects tab. Select New > Selenium Test Case for PHP.

[indent]

  • A Select directory for testdrive dialog box pops up.

  • Browse to selenium_tests directory and open.

  • Click OK.

  • A New Selenium Test Case For PHP dialog box pops up.

  • In the File Name text box write ContactTest.

  • Click Finish.

[/indent]

  1. Change this code



    function setUp() {

        $this->setBrowser("*chrome");

        $this->setBrowserUrl("http://change-this-to-the-site-you-are-testing/");

    }


    function testMyTestCase() {

        

    }



with this




function setUp()

  {

    $this->setBrowser("*chrome");

    $this->setBrowserUrl("http://localhost/");

  }


  function testMyTestCase()

  {

    $this->open("/testdrive/");

    $this->assertTrue($this->isTextPresent("Welcome, Guest!"));

    $this->click("link=Contact");

    $this->waitForPageToLoad("30000");

    $this->assertTrue($this->isElementPresent("ContactForm_name"));

    $this->assertTrue($this->isElementPresent("ContactForm_email"));

  }




  1. Right click this file and Run.

Great job! Thank you for sharing your experience.