Running PHP Selenium Webdriver tests programmatically, without phpunit command -
my question quite simple. i'm coming python world, it's simple execute selenium testing code within program, writing like:
from selenium import webdriver driver = webdriver.firefox() driver.get("http://www.python.org") driver.close()
when using php, things getting harder: wrote that
require 'vendor/autoload.php'; class mytest extends phpunit_extensions_selenium2testcase { public function setup() { $this->setbrowser('firefox'); $this->setbrowserurl('http://www.python.org'); } public function testtoto() { $this->url('/'); } }
...which kinda works when execute phpunit mytest.php
.
but instanciate test class in php code, , execute selenium commands "programmatically", like:
$mytest = new mytest(); $mytest->testtoto();
and here sucks :(
php fatal error: uncaught exception 'phpunit_extensions_selenium2testcase_exception' message 'there no active session execute 'url' command.
so is there way execute selenium code straight php script without executing command line things phpunit?
edit: trying achieve? project build testing application must able launch tests within ui built end user user friendly drag , drop builder (the user chooses test wants execute first, another, , on). avid ececuting phpunit commands ugly php exec: me, best alternative launch test case methods programmatically!
i think pain comes trying utilize phpunit webdriver integration, without using phpunit.
you can write code python illustration using standalone webdriver implementation (that not need phpunit). recommend 1 written facebook:
https://github.com/facebook/php-webdriver
but there more:
http://docs.seleniumhq.org/docs/03_webdriver.jsp#php
you can utilize these implementations within phpunit tests. don't phpunit webdriver implementation.
with these it's trivial write illustration in php.
php selenium phpunit
No comments:
Post a Comment