4

I'm working on automation test for a big project and I'm using Phpunit for functional test and as a server selenium webdriver.

I want to execute many tests using different browsers, I don't know what's the appropriate configuration to addend my objective, it's in phpunit.xml or in the test class, because in the SetUp() method I can work only with one browser.

This is my SetUp() method

 public function setUp()
 {
    $capabilities = array(\WebDriverCapabilityType::BROWSER_NAME => 'internet explorer');
    $this->webDriver = RemoteWebDriver::create('http://10.157.3.206:4570/wd/hub',$capabilities);
 }

I tried to follow this Link :

http://elnur.pro/using-environment-variables-to-add-flexibility-to-phpunit-tests
But Error is generated , Class Browser Not found

Can anyone help me to resolve this ??

1 Answer 1

0

Solution :

  • Must understand we can not run phpunit tests on multiple browser simultaneously

  • Running test on one browser at a time is only possible option

  • Following snippet is demonstrating default firefox browser for execution

    class myUnitTest extends PHPUnit_Selenium2TestCase {
        try {
           public $browser = getenv("SELENIUM_BROWSER");
        } catch (Exception $e) {
           public $browser = "firefox";
        }
        public function setUp() {
           $this->setBrowser("*".$browser);
        }
     } 
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.