Phpunit+selenium Environment Preparation

Source: Internet
Author: User
Tags pear seleniumhq
Phpunit+selenium Environment Construction

This environment set up encountered quite a lot of trouble, finally still can not solve their own, fortunately, a colleague " Frog " help solve the problem! Here put my pro-test steps to everyone listed, hope to provide you with convenience!

Install pear:

Go-pear.phar Download Address:http://download.csdn.net/detail/e421083458/4602207

Download Go-pear.phar file to C:\wamp\bin\php\php5.3.13\PEAR

Then execute the following command:

CD C:\wamp\bin\php\php5.3.13php-d phar.require_hash=0 Pear/go-pear.phar


Then just hit the carriage return and enter Y on Y. After installation it will prompt you to double-click.

C:\wamp\bin\php\php5.3.13\PEAR_ENV.reg to add an environment variable. It is necessary to add PHP to the environment variables for the following operations and for later use.

Upgrade Pear:

Install PHPUnit directly it will prompt the version is too low this is going to upgrade pear.


After the successful upgrade:



After the product upgrade

Installing phpunit

Pear clear-cachepear channel-discover pear.phpunit.depear channel-discover components.ez.nopear channel-discover Pear.symfony-project.compear install-a-F  phpunit/phpunit


Installation succeeded:


Installing the phpunit extension

Pear channel-discover pear.symfony.compear Install phpunit/dbunitpear channel-discover pear.phpunit.depear Install Phpunit/phpunit_story


Success:


Installing the Selenium extension

Pear Install Phpunit/phpunit_selenium


Success:


Debug Selenium

Selenium-server-standalone-2.6.0.jar Download Address:http://download.csdn.net/detail/e421083458/4882037

Open Selenium-server

Java-jar C:\wamp\selenium-server-standalone-2.25.0.jar  -interactive  -log selenium.log


Success:


Installing the selenium IDE plugin for Firefox

Address:http://seleniumhq.org/download/


Click 1.9.0 for selenium IDE installation.

For specific recording methods see:

http://blog.163.com/lgh_2002/blog/static/44017526201259113351146/

Test script:

baiducase.php

 
  Setbrowser ("*firefox");    $this->setbrowserurl ("http://www.baidu.com/");  }  Public Function Testmytestcase ()  {    $this->open ("/");    $this->type ("id=kw", "Hello");    $this->click ("Id=su");    $this->waitforpagetoload ("30000");    $this->assertequals (0,0);  }? >


To start the test:

PHPUnit baiducase.php

Test success:


Reference Documentation:

Http://www.phpunit.de/manual/3.7/en/index.html

http://pear.phpunit.de/

http://seleniumhq.org/download/

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.