More Related Content Similar to Selenium 2 for PHP(Unit) Similar to Selenium 2 for PHP(Unit) (20) Selenium 2 for PHP(Unit)3. • Who has any experience with automated
testing? (PHPUnit,…)
• Who has used Selenium 1?
• Who has used Selenium 2 / Webdriver?
You?!
5. • Unit testing
• Performance testing
• Load testing
• Integration testing
• Acceptance testing
Testing
7. • Selenium IDE
• Selenium 1
(aka. Selenium RC or Remote Control)
• Selenium 2
(aka. Selenium Webdriver)
• Selenium-Grid
Selenium’s Tool Suite
10. • New possibilities
– File uploads
– Browser functions (back/forward)
– Switch between urls
– Control mouse
• Different behaviour
– Typing into input boxes
– Interacting with invisible elements
– Viewport
Why Selenium 2?
14. • Selenium 1: PHPUnit_Selenium
(Sebastian Bergmann)
• Selenium 2
– REST-Service (Json over HTTP)
– Implementations:
• PHPUnit_Selenium
• https://github.com/chibimagic/WebDriver-PHP/
• http://code.google.com/p/php-webdriver-bindings/
• https://github.com/facebook/php-webdriver
https://github.com/robocoder/php-webdriver
https://github.com/fbrnc/php-webdriver
PHP Api
15. • „A very thin wrapper of WebDriver“
• Server API (Json over HTTP)
php-webdriver
18. • Selenium Testing Framework
• Connects to Selenium 2
• Build on top of php-webdriver
• Developer friendly api to raw Selenium
commands
• Drop-In replacement for PHPUnit-
Selenium
• https://github.com/fbrnc/Menta
Menta
19. • Requires PHP 5.3 (using closures)
• Session management (incl. close on CTRL+C and
fatal php errors)
• Event/Observer
• Configuration Management
• Create Suite Utility
• Listeners
– HTML report (incl. Screenshots)
– Verbose text report
• Components
• Abstract PHPUnit Testcases
• Selenium1 facade
Menta
23. $element = $this->getSession()->element(array(
'using' => WebDriver_Container::XPATH,
'value' => '//ul/li'
);
# ... or ...
$helper =
Menta_ComponentManager::get(
'Menta_Component_Helper_Common');
$element =
$helper->getElement('css=#menu li.first');
Selecting elements
25. • Capabilities
• Menta_SessionManager
• ->getSession($forceNew = false);
• ->activeSessionExists()
• ->closeSession()
• Automatic closing sessions on errors and
end of tests
Session Management
27. • Explict screenshots
• Automatically taking screenshots on errors
and failing tests and embed them into html
report (on client side)
Screenshots