SlideShare una empresa de Scribd logo
1 de 47
Descargar para leer sin conexión
Workshop:
Functional testing made easy
with PHPUnit & Selenium
3 November 2017
Poland
Ondřej Machulda
ondrej.machulda@gmail.com
@OndraM
Annotated slides
$ whoami
Ondřej Machulda
@OndraM
Symfony developer & QA automation engineer
+
Selenium, TDD & QA trainer
php-webdriver library co-maintainer
What are you going to learn today?
What is possible to do with Selenium
How to convert manual routine to automated functional tests
Write functional test in a few minutes
Why are functional tests irreplaceable
Execute tests on your machine in a few seconds
Write functional tests in a maintainable manner
Easily find root cause of failed test
Cost of fixing bugs
Source: Barry Boehm, Equity Keynote Address 2007
Time is money. So we want to find bugs as soon as possible after they
are created.
Because fixing them earlier in the development stage would be for us
much faster and thus cheaper.
And automated tests are a way how to accomplish this.
What do we want from tests? FIRST!
Fast
Isolated
Repeatable
Self-validating
Timely
Automated tests should follow the "FIRST" criteria!
Fast – tests must be executed fast, we need to get
fast feedback if there is a bug.
Isolated – tests should not depend on others, on
order of execution, on global state etc. This will
disallow parallelism.
Repeatable – we want to have same stable result
each time they are run on the same application.
Self-validating – test itself should reliably know
whether it passes or not. No human interaction
should be required to ensure test result.
Timely – tests should be written with the code or
maybe before (when applying Test Driven
Development)
Source: https://commons.wikimedia.org/wiki/File:Bicycle_diagram-unif.svg, author Fiestoforo, licence CC BY 3.0
Web app is a machine – like a bicycle. Lots of different parts in different layers, which needs to fit
together to accomplish the one ultimate purpose of the machine – so you can ride the bike.
We usually do test the machine starting from the smallest pieces, because it is easy to test them - you
can easily define their behavior and you can usually easily and fast validate it! Like inputs/outputs of
method and its behavior in edge cases. However, this is not always enough...
If you want to make sure the assembled machine works and everything fits together (eg. you can really
drive & steer the bike), you will test the main business critical scenarios from customer point of view.
Thats why these kind of tests is irreplaceable – its your output quality control. Next one in the QA chain
is usually only the customer, and thats too late :-).
Software Testing Ice-cream Cone
Business
Source: https://watirmelon.blog/2012/01/31/introducing-the-software-testing-ice-cream-cone/, author Alister Scott
However, you should not make manual tests or functional tests the testing layer in which you invest the most
- like we see in this ice-cream cone antipattern.
Test Pyramid
Timecost
FIRST
5 %
15 %
80 %
Test pyramid is a visual guide showing how much time you should invest in which layer of tests. Why this ratio? The
higher layer, the harder is to write and maintain the tests (they don't fulfil the FIRST criteria) and the slower feedback
you have from them. Unit-tests are fast to write and run, stable and helps with code design – so as a developer you
want to primary write them. But remember the bicycle – you could miss a lot without functional tests.
It is useless to run the functional tests only from developers laptop. They are necessary part of continuous
integration and should not be missing in your automated continuous deployment pipeline. As you know – the
faster you find your bugs, the faster and cheaper is to fix them!
Source: https://twitter.com/emilbronikowski/status/808669983639216128
Source: https://twitter.com/emilbronikowski/status/808669983639216128
Source: https://twitter.com/thepracticaldev/status/733908215021199360
Selenium
● Just a browser automation library
● Selenium aka Selenium WebDriver
● Platform and language independent
● Supported by all major browser
● Easy setup
● Not depending on any IDE
● Widely used, actively developed
● Many resources on the Internet
The tool for automated functional tests is Selenium - an
open-source library for browser automation. You tell it what
actions in browser should be done and it executes them. The
WebDriver protocol will also soon be W3C standard and it is
implemented in almost all browsers.
Selenium can...
● Navigate browser to URL (obviously)
● Find element on the page - via CSS / XPath / ...
● Interact with the element
○ Get it contents, location, styles, attributes...
○ Click on in
○ ...
● Take a screenshot
● Fill and submit form
● Change browser windows size
● Navigate through history (back / forward)
● ...
Steward - what it does for you
Test runner
Parallel execution, logs, handle test dependencies...
Convenience layer
Syntax sugar, PHPUnit + php-webdriver integration,
browser setup, screenshots...
https://github.com/lmc-eu/steward
We will also use Steward - an open-source tool built on top of PHPUnit and Symfony components. It is a
test-runner (controlled from CLI) and also extension for PHPUnit, integrating the php-webdriver library
right in your PHPUnit tests.
https://git.io/vFsUR
Here is wiki page with links, commands etc. for following examples:
Setting up local development environment
● Repository with examples for the workshop:
https://github.com/OndraM/selenium-workshop-phpce
cd [your projects directory]
git clone git@github.com:OndraM/selenium-workshop-phpce
cd selenium-workshop-phpce
git checkout step-0
composer install
Start Selenium Server inside Docker
docker run -p 4444:4444 -p 5900:5900 
selenium/standalone-chrome-debug:3.6.0
localhost:4444
localhost:5900
vncviewer 127.0.0.1:5900 # on Linux
open vnc://127.0.0.1:5900 # on Mac
Executing tests using Steward
● Open new terminal window
○ cd selenium-workshop-phpce
● Show Steward help
○ vendor/bin/steward run --help
● run command
○ two required arguments: environment and browser
○ -vvv to set max output verbosity
vendor/bin/steward run staging chrome
vendor/bin/steward run staging chrome -vvv
Implementing first basic test
https://phpce-gz65nia-mxk4rjvb4la6e.eu.platform.sh/
Test scenario:
"Product detail loads basic product information"
1. Open product detail page
2. Check product header is as expected
3. Check product price is as expected
Solution ⇒ git checkout -f step-1 # force
checkout!
Source: https://martinfowler.com/bliki/PageObject.html
Page Object is a design pattern from
Martin Fowler, which suggest interacting
with the webpage UI through an
abstraction – ie. an object with methods
mapping the UI structure and UI
interactions. Because in the tests
scenario you want to interact with the UI,
not with its HTML implementation.
Page objects are also a way how to make
your functional tests maintainable in a
long-term.
Using Page Object in a test
Solution ⇒ git checkout -f step-1-fixed
● Allows to do what user could do & see
● Copies hierarchy of user interface
● Separates test scenario from its HTML implementation
● Its method should return:
○ Primitive data (string, integer, array of strings...)
○ Or another Page Object
● Assertions should be in tests, not inside page object
Page Object - main principles
Extending Page Objects
Test scenario:
"Product could be added to a cart from product detail page"
1. Open product detail page
2. Add product to cart
3. Cart listing is opened
4. Cart contains product added in step 2.
Finding elements
Steward simplified syntax (syntax sugar)
$element = $this->findByCss('.foo');
$element = $this->findByXpath('//table/tr/td[2]//a');
$elements = $this->findMultipleByCss('.foo');
Other element finding strategies
findByClass, findById, findByName, findByLinkText,
findByPartialLinkText, findByTag
Traditional php-webdriver way
$element = $this->wd->findElement(WebDriverBy::cssSelector('.foo'));
$elements = $this->wd->findElements(WebDriverBy::cssSelector('.foo'));
Element selectors - ID, CSS, Xpath...
● ID - best option, if available
○ $this->findByCss('#login-button');
○ $this->findById('login-button');
● CSS selectors - simple to write
○ $this->findByCss('div.header > button.login');
● XPath - if there is no other way
○ $this->findByXpath(
'//table//a[contains(@href,"sticker-repellendus")]
/ancestor::tr/td/span[@class =
"sylius-quantity"]/input'
);
Beware of selectors stability - too specific vs. too generic
Extending Page Objects
Solution ⇒ git checkout -f step-2
Logs, screenshots
Test results overview:
● logs/results.xml
● vendor/bin/steward results [-vvv]
Screenshots, HTML snapshots:
● directory logs/
○ TestCaseName-TestName.png
○ TestCaseName-TestName.html
Extending Page Objects II.
git checkout -f step-3
Test scenario:
"Multiple products could be added to a cart"
1. Open product A detail page
2. Add product A to cart
3. Cart listing is opened
4. Open product B detail page (hint: just add slug)
5. Add product B to cart
6. Cart listing is opened (hint: addToCart() method returns CartPage)
7. Cart contain two products - A and B
(hint: finish getNamesOfProductsInCart() method of CartPage)
Run only one testcase class
vendor/bin/steward run staging chrome -vvv 
--pattern ProductDetailTest.php
Run only one test method of one testcase class:
vendor/bin/steward run staging chrome -vvv 
--pattern ProductDetailTest.php 
--filter shouldAddMultipleProductsToCart
Extending Page Objects II.
git checkout -f step-3
Test scenario:
"Multiple products could be added to a cart"
1. Open product A detail page
2. Add product A to cart
3. Cart listing is opened
4. Open product B detail page (hint: just add slug)
5. Add product B to cart
6. Cart listing is opened (hint: addToCart() method returns CartPage)
7. Cart contain two products - A and B
(hint: finish getNamesOfProductsInCart() method of CartPage)
Solution ⇒ git checkout -f step-3-fixed
Forms
$element = $this->findByName('name');
$element->sendKeys('Some text')
$element->clear()
$element->submit()
<select> elements
$element = $this->findByName('country');
$select = new WebDriverSelect($element);
$select->selectByVisibleText('Poland');
$select->selectByValue('pl');
$select->selectByIndex(13);
Forms example
Test scenario:
"User submits order with products in cart"
1. Prerequisite: have a product in cart
2. Open cart listing
3. Go to Checkout
4. Address form is shown
5. Fill required fields
○ e-mail, first name, last name, street, country (select), city, postcode
6. Submit form
7. Shipping details form is shown
8. ...
git checkout -f step-4
Solution ⇒ git checkout -f step-4-fixed
Waiting ("explicit wait")
● Web is not a synchronous place to be...
● Selenium doesn't know when your actions are finished
(Except loading page via get())
○ Loading page after user clicks to a link
○ Submitting a form
○ Displaying modal window
○ AJAX
○ ...
Waiting - syntax sugar waitFor...() methods
$this->waitForCss('.#modal p');
// or
$this->wd->wait()->until(
WebDriverExpectedCondition::presenceOfElementLocated(
WebDriverBy::cssSelector('#modal p')
)
);
$this->waitForTitle('Search results');
// or
$this->wd->wait()->until(
WebDriverExpectedCondition::titleIs('Search results')
);
Advanced WebDriverExpectedConditions
$this->wd->wait()->until(
WebDriverExpectedCondition::titleIs('text')
);
● titleContains('text'); titleMatches('/.../')
● presenceOfElementLocated($by)
● visibilityOfElementLocated($by)
● elementTextContains($by, 'text'); elementTextIs($by,
'text')
● alertIsPresent()
● urlContains('?login=success'); urlMatches('/.../');
● numberOfWindowsToBe(2)
● not()
● custom callback
https://github.com/facebook/php-webdriver/wiki/HowTo-Wait
Explicit wait example
Test scenario:
"Registered but unlogged user could login during checkout"
1. Prerequisite: have a product in cart
2. Open cart listing
3. Go to Checkout
4. Address form is shown
5. Fill e-mail and password of existing user
○ E-mail: user@example.com / Password: sylius
6. E-mail input will no longer be shown
7. Name of logged user will be shown in the header
8. ...
Solution ⇒ git checkout -f step-5-fixed
git checkout -f step-5
Within one test-case class
/**
* @test
* @depends shouldRegisterUser
* @param string $username
*/
public function shouldLoginUser( $username)
{
...
}
Test dependencies
Amongst more than one test-case
● annotation @delayMinutes and @delayAfter on testcase class
/**
* @delayMinutes 2
* @delayAfter MyContactFormTest
*/
● Steward allows to pass data between testcases
https://github.com/lmc-eu/steward/wiki/Test-dependencies
Test dependencies are evil
☠
File upload
$input = $this->findByName('upload');
$input->setFileDetector(new LocalFileDetector())
->sendKeys('/path/to/image.jpg');
https://simple-u6rzw4q-mxk4rjvb4la6e.eu.platform.sh/upload-simple.html
git checkout -f step-6
Solution ⇒ git checkout -f step-6-fixed
JavaScript execution
Execute synchronous script (doesn't block test execution)
$this->wd->executeScript('
document.body.style.backgroundColor = "red";
');
Execute asynchronous script (wait for callback)
$this->driver->executeAsyncScript('
var callback = arguments[arguments.length - 1];
...
callback();
');
https://simple-u6rzw4q-mxk4rjvb4la6e.eu.platform.sh/hidden.html
git checkout -f step-7
Solution ⇒ git checkout -f step-7-fixed
Selenium can do much more
● Change window size ($this->wd->manage())
● Navigate through browsing history (navigate())
● Switch to different window / iframe / alert (switchTo())
○ github.com/facebook/php-webdriver/wiki/Alert,-tabs,-frames,-iframes
● Move mouse over element (action())
● Run your tests in different browsers
● Run Chrome / Firefox in headless mode (R.I.P. PhantomJS)
Other Steward features
● Annotation @noBrowser
○ Eg. seeding test data via API/database
○ Example: SeedDataTest.php
● Set default window size
● Sauce Labs / BrowserStack / TestingBot integration
○ Example: https://saucelabs.com/u/OndraM
● Pass capabilities (= configuration) to the browser
● Generate test execution timeline
● And more: https://github.com/lmc-eu/steward-example
Debugging tests via Xdebug & PHPStorm
$ vendor/bin/steward run dev chrome --xdebug
https://github.com/lmc-eu/steward/wiki/Debugging-Selenium-tests-With-Steward
Best practices
● Less functional tests is more
● Functional tests are not second-class citizen
● Have a strategy to maintain them
● Do not have long-term broken tests
○ markTestSkipped()
● Use Page Objects
● Unstable (flaky) tests - find root cause, no workarounds
● Tests must be fast
● Implicit wait instead of sleep
● Use self-describing names for tests, methods etc.
Other options how to use Selenium in PHP
There are multiple options how to run Selenium tests in PHP - choose the one that fits your needs!
Steward - integrates php-webdriver into classic PHPUnit-styled tests and also provides parallelization.
Codeception - complex test framework for all layers of tests, which adds BDD-like layer on top of PHPUnit.
Laravel Dusk - another semantics for writing selenium tests in a "Laravel" way, it also includes Laravel integration.
Behat + Mink - BDD way of writing test scenarios, however uses unmaintained library for Selenium integration
Phpunit-selenium - old and outdated extension for PHPUnit
● Steward
● Codeception
● Laravel Dusk
● Behat + Mink
● phpunit-selenium (PHPUnit_Extensions_Selenium2TestCase)
Ondřej Machulda
ondrej.machulda@gmail.com
www.ondrejmachulda.cz
@OndraM
A that's all for today!
✌

Más contenido relacionado

La actualidad más candente

Codeception presentation
Codeception presentationCodeception presentation
Codeception presentationAndrei Burian
 
Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)Adam Štipák
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David TorroijaDavid Torroija
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at TiltDave King
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011Nicholas Zakas
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8nagpalprachi
 
Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Christian Johansen
 
Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Adam Christian
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Sam Becker
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summaryAlan Richardson
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript TestingScott Becker
 
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Роман Лютиков "Web Apps Performance & JavaScript Compilers"Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Роман Лютиков "Web Apps Performance & JavaScript Compilers"Fwdays
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideMek Srunyu Stittri
 
Fullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterFullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterMek Srunyu Stittri
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Jay Friendly
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016Gavin Pickin
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTudor Barbu
 

La actualidad más candente (20)

Codeception presentation
Codeception presentationCodeception presentation
Codeception presentation
 
Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)Testing with Codeception (Webelement #30)
Testing with Codeception (Webelement #30)
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David Torroija
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at Tilt
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8
 
Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)Test-Driven JavaScript Development (JavaZone 2010)
Test-Driven JavaScript Development (JavaZone 2010)
 
Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summary
 
Test your modules
Test your modulesTest your modules
Test your modules
 
Agile JavaScript Testing
Agile JavaScript TestingAgile JavaScript Testing
Agile JavaScript Testing
 
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Роман Лютиков "Web Apps Performance & JavaScript Compilers"Роман Лютиков "Web Apps Performance & JavaScript Compilers"
Роман Лютиков "Web Apps Performance & JavaScript Compilers"
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java side
 
Maven 3.0 at Øredev
Maven 3.0 at ØredevMaven 3.0 at Øredev
Maven 3.0 at Øredev
 
Fullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year laterFullstack End-to-end test automation with Node.js, one year later
Fullstack End-to-end test automation with Node.js, one year later
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8
 
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
How do I write Testable Javascript - Presented at dev.Objective() June 16, 2016
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
 
Testing frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabsTesting frontends with nightwatch & saucelabs
Testing frontends with nightwatch & saucelabs
 

Similar a Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland, November 2017)

Autotests introduction - Codeception + PHP Basics
Autotests introduction - Codeception + PHP BasicsAutotests introduction - Codeception + PHP Basics
Autotests introduction - Codeception + PHP BasicsArtur Babyuk
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Puneet Kala
 
Testing mit Codeception: Full-stack testing PHP framework
Testing mit Codeception: Full-stack testing PHP frameworkTesting mit Codeception: Full-stack testing PHP framework
Testing mit Codeception: Full-stack testing PHP frameworkSusannSgorzaly
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsDECK36
 
Whys and Hows of Automation
Whys and Hows of AutomationWhys and Hows of Automation
Whys and Hows of AutomationvodQA
 
Coldbox developer training – session 4
Coldbox developer training – session 4Coldbox developer training – session 4
Coldbox developer training – session 4Billie Berzinskas
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Controlelliando dias
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Amazon Web Services
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Yan Cui
 
Selenium C# - The Essential Test Automation Guide
Selenium C# - The Essential Test Automation GuideSelenium C# - The Essential Test Automation Guide
Selenium C# - The Essential Test Automation GuideRapidValue
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsAbhijeet Vaikar
 
Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Yan Cui
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation TestingJoomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation TestingShyam Sunder Verma
 
Web Development Foundation & Team Collaboration
Web Development Foundation & Team CollaborationWeb Development Foundation & Team Collaboration
Web Development Foundation & Team CollaborationSupanat Potiwarakorn
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumLiraz Shay
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.comtestingbot
 

Similar a Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland, November 2017) (20)

Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Autotests introduction - Codeception + PHP Basics
Autotests introduction - Codeception + PHP BasicsAutotests introduction - Codeception + PHP Basics
Autotests introduction - Codeception + PHP Basics
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
 
Testing mit Codeception: Full-stack testing PHP framework
Testing mit Codeception: Full-stack testing PHP frameworkTesting mit Codeception: Full-stack testing PHP framework
Testing mit Codeception: Full-stack testing PHP framework
 
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit SoftwaretestsEffizientere WordPress-Plugin-Entwicklung mit Softwaretests
Effizientere WordPress-Plugin-Entwicklung mit Softwaretests
 
Whys and Hows of Automation
Whys and Hows of AutomationWhys and Hows of Automation
Whys and Hows of Automation
 
Coldbox developer training – session 4
Coldbox developer training – session 4Coldbox developer training – session 4
Coldbox developer training – session 4
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Control
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
 
Selenium C# - The Essential Test Automation Guide
Selenium C# - The Essential Test Automation GuideSelenium C# - The Essential Test Automation Guide
Selenium C# - The Essential Test Automation Guide
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
 
Azure from scratch part 4
Azure from scratch part 4Azure from scratch part 4
Azure from scratch part 4
 
Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)
 
Joomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation TestingJoomla Code Quality Control and Automation Testing
Joomla Code Quality Control and Automation Testing
 
Web Development Foundation & Team Collaboration
Web Development Foundation & Team CollaborationWeb Development Foundation & Team Collaboration
Web Development Foundation & Team Collaboration
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Agility Requires Safety
Agility Requires SafetyAgility Requires Safety
Agility Requires Safety
 
Selenium Testing with TestingBot.com
Selenium Testing with TestingBot.comSelenium Testing with TestingBot.com
Selenium Testing with TestingBot.com
 

Más de Ondřej Machulda

Selenium a WebDriver - přítomnost a budoucnost
 Selenium a WebDriver - přítomnost a budoucnost  Selenium a WebDriver - přítomnost a budoucnost
Selenium a WebDriver - přítomnost a budoucnost Ondřej Machulda
 
JSON API: Možná nepotřebujete GraphQL
JSON API: Možná nepotřebujete GraphQLJSON API: Možná nepotřebujete GraphQL
JSON API: Možná nepotřebujete GraphQLOndřej Machulda
 
Trendy a nové možnosti test automation
Trendy a nové možnosti test automationTrendy a nové možnosti test automation
Trendy a nové možnosti test automationOndřej Machulda
 
Funkční testování – chybějící vrchol pyramidy (WebExpo 2016)
Funkční testování – chybějící vrchol pyramidy (WebExpo 2016)Funkční testování – chybějící vrchol pyramidy (WebExpo 2016)
Funkční testování – chybějící vrchol pyramidy (WebExpo 2016)Ondřej Machulda
 
Automatické testování webů v praxi - Barcamp Ostrava 2015
Automatické testování webů v praxi - Barcamp Ostrava 2015Automatické testování webů v praxi - Barcamp Ostrava 2015
Automatické testování webů v praxi - Barcamp Ostrava 2015Ondřej Machulda
 
Jak jsme přepisovali Jobs.cz na Symfony
Jak jsme přepisovali Jobs.cz na SymfonyJak jsme přepisovali Jobs.cz na Symfony
Jak jsme přepisovali Jobs.cz na SymfonyOndřej Machulda
 
OAuth 2.0 a Zend Framework
OAuth 2.0 a Zend FrameworkOAuth 2.0 a Zend Framework
OAuth 2.0 a Zend FrameworkOndřej Machulda
 
Optimistic/Pessimistic Offline Lock
Optimistic/Pessimistic Offline LockOptimistic/Pessimistic Offline Lock
Optimistic/Pessimistic Offline LockOndřej Machulda
 
Hlavní problémy systému on-line rezervace vstupenek do O2 Areny
Hlavní problémy systému on-line rezervace vstupenek do O2 ArenyHlavní problémy systému on-line rezervace vstupenek do O2 Areny
Hlavní problémy systému on-line rezervace vstupenek do O2 ArenyOndřej Machulda
 
Testování systému pro on-line rezervaci vstupenek do O2 Areny
Testování systému pro on-line rezervaci vstupenek do O2 ArenyTestování systému pro on-line rezervaci vstupenek do O2 Areny
Testování systému pro on-line rezervaci vstupenek do O2 ArenyOndřej Machulda
 
Pionýr - stručná historie organizace
Pionýr - stručná historie organizacePionýr - stručná historie organizace
Pionýr - stručná historie organizaceOndřej Machulda
 

Más de Ondřej Machulda (12)

Selenium a WebDriver - přítomnost a budoucnost
 Selenium a WebDriver - přítomnost a budoucnost  Selenium a WebDriver - přítomnost a budoucnost
Selenium a WebDriver - přítomnost a budoucnost
 
JSON API: Možná nepotřebujete GraphQL
JSON API: Možná nepotřebujete GraphQLJSON API: Možná nepotřebujete GraphQL
JSON API: Možná nepotřebujete GraphQL
 
Trendy a nové možnosti test automation
Trendy a nové možnosti test automationTrendy a nové možnosti test automation
Trendy a nové možnosti test automation
 
Funkční testování – chybějící vrchol pyramidy (WebExpo 2016)
Funkční testování – chybějící vrchol pyramidy (WebExpo 2016)Funkční testování – chybějící vrchol pyramidy (WebExpo 2016)
Funkční testování – chybějící vrchol pyramidy (WebExpo 2016)
 
Automatické testování webů v praxi - Barcamp Ostrava 2015
Automatické testování webů v praxi - Barcamp Ostrava 2015Automatické testování webů v praxi - Barcamp Ostrava 2015
Automatické testování webů v praxi - Barcamp Ostrava 2015
 
Jak jsme přepisovali Jobs.cz na Symfony
Jak jsme přepisovali Jobs.cz na SymfonyJak jsme přepisovali Jobs.cz na Symfony
Jak jsme přepisovali Jobs.cz na Symfony
 
OAuth 2.0 a Zend Framework
OAuth 2.0 a Zend FrameworkOAuth 2.0 a Zend Framework
OAuth 2.0 a Zend Framework
 
Optimistic/Pessimistic Offline Lock
Optimistic/Pessimistic Offline LockOptimistic/Pessimistic Offline Lock
Optimistic/Pessimistic Offline Lock
 
Hlavní problémy systému on-line rezervace vstupenek do O2 Areny
Hlavní problémy systému on-line rezervace vstupenek do O2 ArenyHlavní problémy systému on-line rezervace vstupenek do O2 Areny
Hlavní problémy systému on-line rezervace vstupenek do O2 Areny
 
Testování systému pro on-line rezervaci vstupenek do O2 Areny
Testování systému pro on-line rezervaci vstupenek do O2 ArenyTestování systému pro on-line rezervaci vstupenek do O2 Areny
Testování systému pro on-line rezervaci vstupenek do O2 Areny
 
Pionýr - stručná historie organizace
Pionýr - stručná historie organizacePionýr - stručná historie organizace
Pionýr - stručná historie organizace
 
Raid
RaidRaid
Raid
 

Último

INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.CarlotaBedoya1
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Standkumarajju5765
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)Damian Radcliffe
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$kojalkojal131
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...SofiyaSharma5
 

Último (20)

INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
INDIVIDUAL ASSIGNMENT #3 CBG, PRESENTATION.
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night StandHot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
Hot Call Girls |Delhi |Hauz Khas ☎ 9711199171 Book Your One night Stand
 
How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)How is AI changing journalism? (v. April 2024)
How is AI changing journalism? (v. April 2024)
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Dlf City Phase 3 Gurgaon >༒8448380779 Escort Service
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
Call Girls Dubai Prolapsed O525547819 Call Girls In Dubai Princes$
 
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
Low Rate Young Call Girls in Sector 63 Mamura Noida ✔️☆9289244007✔️☆ Female E...
 

Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland, November 2017)

  • 1. Workshop: Functional testing made easy with PHPUnit & Selenium 3 November 2017 Poland Ondřej Machulda ondrej.machulda@gmail.com @OndraM Annotated slides
  • 2. $ whoami Ondřej Machulda @OndraM Symfony developer & QA automation engineer + Selenium, TDD & QA trainer php-webdriver library co-maintainer
  • 3. What are you going to learn today? What is possible to do with Selenium How to convert manual routine to automated functional tests Write functional test in a few minutes Why are functional tests irreplaceable Execute tests on your machine in a few seconds Write functional tests in a maintainable manner Easily find root cause of failed test
  • 4. Cost of fixing bugs Source: Barry Boehm, Equity Keynote Address 2007 Time is money. So we want to find bugs as soon as possible after they are created. Because fixing them earlier in the development stage would be for us much faster and thus cheaper. And automated tests are a way how to accomplish this.
  • 5. What do we want from tests? FIRST! Fast Isolated Repeatable Self-validating Timely Automated tests should follow the "FIRST" criteria! Fast – tests must be executed fast, we need to get fast feedback if there is a bug. Isolated – tests should not depend on others, on order of execution, on global state etc. This will disallow parallelism. Repeatable – we want to have same stable result each time they are run on the same application. Self-validating – test itself should reliably know whether it passes or not. No human interaction should be required to ensure test result. Timely – tests should be written with the code or maybe before (when applying Test Driven Development)
  • 6. Source: https://commons.wikimedia.org/wiki/File:Bicycle_diagram-unif.svg, author Fiestoforo, licence CC BY 3.0 Web app is a machine – like a bicycle. Lots of different parts in different layers, which needs to fit together to accomplish the one ultimate purpose of the machine – so you can ride the bike. We usually do test the machine starting from the smallest pieces, because it is easy to test them - you can easily define their behavior and you can usually easily and fast validate it! Like inputs/outputs of method and its behavior in edge cases. However, this is not always enough... If you want to make sure the assembled machine works and everything fits together (eg. you can really drive & steer the bike), you will test the main business critical scenarios from customer point of view. Thats why these kind of tests is irreplaceable – its your output quality control. Next one in the QA chain is usually only the customer, and thats too late :-).
  • 7. Software Testing Ice-cream Cone Business Source: https://watirmelon.blog/2012/01/31/introducing-the-software-testing-ice-cream-cone/, author Alister Scott However, you should not make manual tests or functional tests the testing layer in which you invest the most - like we see in this ice-cream cone antipattern.
  • 8. Test Pyramid Timecost FIRST 5 % 15 % 80 % Test pyramid is a visual guide showing how much time you should invest in which layer of tests. Why this ratio? The higher layer, the harder is to write and maintain the tests (they don't fulfil the FIRST criteria) and the slower feedback you have from them. Unit-tests are fast to write and run, stable and helps with code design – so as a developer you want to primary write them. But remember the bicycle – you could miss a lot without functional tests.
  • 9. It is useless to run the functional tests only from developers laptop. They are necessary part of continuous integration and should not be missing in your automated continuous deployment pipeline. As you know – the faster you find your bugs, the faster and cheaper is to fix them!
  • 13. Selenium ● Just a browser automation library ● Selenium aka Selenium WebDriver ● Platform and language independent ● Supported by all major browser ● Easy setup ● Not depending on any IDE ● Widely used, actively developed ● Many resources on the Internet The tool for automated functional tests is Selenium - an open-source library for browser automation. You tell it what actions in browser should be done and it executes them. The WebDriver protocol will also soon be W3C standard and it is implemented in almost all browsers.
  • 14. Selenium can... ● Navigate browser to URL (obviously) ● Find element on the page - via CSS / XPath / ... ● Interact with the element ○ Get it contents, location, styles, attributes... ○ Click on in ○ ... ● Take a screenshot ● Fill and submit form ● Change browser windows size ● Navigate through history (back / forward) ● ...
  • 15. Steward - what it does for you Test runner Parallel execution, logs, handle test dependencies... Convenience layer Syntax sugar, PHPUnit + php-webdriver integration, browser setup, screenshots... https://github.com/lmc-eu/steward We will also use Steward - an open-source tool built on top of PHPUnit and Symfony components. It is a test-runner (controlled from CLI) and also extension for PHPUnit, integrating the php-webdriver library right in your PHPUnit tests.
  • 16. https://git.io/vFsUR Here is wiki page with links, commands etc. for following examples:
  • 17. Setting up local development environment ● Repository with examples for the workshop: https://github.com/OndraM/selenium-workshop-phpce cd [your projects directory] git clone git@github.com:OndraM/selenium-workshop-phpce cd selenium-workshop-phpce git checkout step-0 composer install
  • 18. Start Selenium Server inside Docker docker run -p 4444:4444 -p 5900:5900 selenium/standalone-chrome-debug:3.6.0 localhost:4444 localhost:5900 vncviewer 127.0.0.1:5900 # on Linux open vnc://127.0.0.1:5900 # on Mac
  • 19. Executing tests using Steward ● Open new terminal window ○ cd selenium-workshop-phpce ● Show Steward help ○ vendor/bin/steward run --help ● run command ○ two required arguments: environment and browser ○ -vvv to set max output verbosity vendor/bin/steward run staging chrome vendor/bin/steward run staging chrome -vvv
  • 20. Implementing first basic test https://phpce-gz65nia-mxk4rjvb4la6e.eu.platform.sh/ Test scenario: "Product detail loads basic product information" 1. Open product detail page 2. Check product header is as expected 3. Check product price is as expected Solution ⇒ git checkout -f step-1 # force checkout!
  • 21. Source: https://martinfowler.com/bliki/PageObject.html Page Object is a design pattern from Martin Fowler, which suggest interacting with the webpage UI through an abstraction – ie. an object with methods mapping the UI structure and UI interactions. Because in the tests scenario you want to interact with the UI, not with its HTML implementation. Page objects are also a way how to make your functional tests maintainable in a long-term.
  • 22. Using Page Object in a test Solution ⇒ git checkout -f step-1-fixed
  • 23. ● Allows to do what user could do & see ● Copies hierarchy of user interface ● Separates test scenario from its HTML implementation ● Its method should return: ○ Primitive data (string, integer, array of strings...) ○ Or another Page Object ● Assertions should be in tests, not inside page object Page Object - main principles
  • 24. Extending Page Objects Test scenario: "Product could be added to a cart from product detail page" 1. Open product detail page 2. Add product to cart 3. Cart listing is opened 4. Cart contains product added in step 2.
  • 25. Finding elements Steward simplified syntax (syntax sugar) $element = $this->findByCss('.foo'); $element = $this->findByXpath('//table/tr/td[2]//a'); $elements = $this->findMultipleByCss('.foo'); Other element finding strategies findByClass, findById, findByName, findByLinkText, findByPartialLinkText, findByTag Traditional php-webdriver way $element = $this->wd->findElement(WebDriverBy::cssSelector('.foo')); $elements = $this->wd->findElements(WebDriverBy::cssSelector('.foo'));
  • 26. Element selectors - ID, CSS, Xpath... ● ID - best option, if available ○ $this->findByCss('#login-button'); ○ $this->findById('login-button'); ● CSS selectors - simple to write ○ $this->findByCss('div.header > button.login'); ● XPath - if there is no other way ○ $this->findByXpath( '//table//a[contains(@href,"sticker-repellendus")] /ancestor::tr/td/span[@class = "sylius-quantity"]/input' ); Beware of selectors stability - too specific vs. too generic
  • 27. Extending Page Objects Solution ⇒ git checkout -f step-2
  • 28. Logs, screenshots Test results overview: ● logs/results.xml ● vendor/bin/steward results [-vvv] Screenshots, HTML snapshots: ● directory logs/ ○ TestCaseName-TestName.png ○ TestCaseName-TestName.html
  • 29. Extending Page Objects II. git checkout -f step-3 Test scenario: "Multiple products could be added to a cart" 1. Open product A detail page 2. Add product A to cart 3. Cart listing is opened 4. Open product B detail page (hint: just add slug) 5. Add product B to cart 6. Cart listing is opened (hint: addToCart() method returns CartPage) 7. Cart contain two products - A and B (hint: finish getNamesOfProductsInCart() method of CartPage)
  • 30. Run only one testcase class vendor/bin/steward run staging chrome -vvv --pattern ProductDetailTest.php Run only one test method of one testcase class: vendor/bin/steward run staging chrome -vvv --pattern ProductDetailTest.php --filter shouldAddMultipleProductsToCart
  • 31. Extending Page Objects II. git checkout -f step-3 Test scenario: "Multiple products could be added to a cart" 1. Open product A detail page 2. Add product A to cart 3. Cart listing is opened 4. Open product B detail page (hint: just add slug) 5. Add product B to cart 6. Cart listing is opened (hint: addToCart() method returns CartPage) 7. Cart contain two products - A and B (hint: finish getNamesOfProductsInCart() method of CartPage) Solution ⇒ git checkout -f step-3-fixed
  • 32. Forms $element = $this->findByName('name'); $element->sendKeys('Some text') $element->clear() $element->submit() <select> elements $element = $this->findByName('country'); $select = new WebDriverSelect($element); $select->selectByVisibleText('Poland'); $select->selectByValue('pl'); $select->selectByIndex(13);
  • 33. Forms example Test scenario: "User submits order with products in cart" 1. Prerequisite: have a product in cart 2. Open cart listing 3. Go to Checkout 4. Address form is shown 5. Fill required fields ○ e-mail, first name, last name, street, country (select), city, postcode 6. Submit form 7. Shipping details form is shown 8. ... git checkout -f step-4 Solution ⇒ git checkout -f step-4-fixed
  • 34. Waiting ("explicit wait") ● Web is not a synchronous place to be... ● Selenium doesn't know when your actions are finished (Except loading page via get()) ○ Loading page after user clicks to a link ○ Submitting a form ○ Displaying modal window ○ AJAX ○ ...
  • 35. Waiting - syntax sugar waitFor...() methods $this->waitForCss('.#modal p'); // or $this->wd->wait()->until( WebDriverExpectedCondition::presenceOfElementLocated( WebDriverBy::cssSelector('#modal p') ) ); $this->waitForTitle('Search results'); // or $this->wd->wait()->until( WebDriverExpectedCondition::titleIs('Search results') );
  • 36. Advanced WebDriverExpectedConditions $this->wd->wait()->until( WebDriverExpectedCondition::titleIs('text') ); ● titleContains('text'); titleMatches('/.../') ● presenceOfElementLocated($by) ● visibilityOfElementLocated($by) ● elementTextContains($by, 'text'); elementTextIs($by, 'text') ● alertIsPresent() ● urlContains('?login=success'); urlMatches('/.../'); ● numberOfWindowsToBe(2) ● not() ● custom callback https://github.com/facebook/php-webdriver/wiki/HowTo-Wait
  • 37. Explicit wait example Test scenario: "Registered but unlogged user could login during checkout" 1. Prerequisite: have a product in cart 2. Open cart listing 3. Go to Checkout 4. Address form is shown 5. Fill e-mail and password of existing user ○ E-mail: user@example.com / Password: sylius 6. E-mail input will no longer be shown 7. Name of logged user will be shown in the header 8. ... Solution ⇒ git checkout -f step-5-fixed git checkout -f step-5
  • 38. Within one test-case class /** * @test * @depends shouldRegisterUser * @param string $username */ public function shouldLoginUser( $username) { ... } Test dependencies Amongst more than one test-case ● annotation @delayMinutes and @delayAfter on testcase class /** * @delayMinutes 2 * @delayAfter MyContactFormTest */ ● Steward allows to pass data between testcases https://github.com/lmc-eu/steward/wiki/Test-dependencies
  • 40. File upload $input = $this->findByName('upload'); $input->setFileDetector(new LocalFileDetector()) ->sendKeys('/path/to/image.jpg'); https://simple-u6rzw4q-mxk4rjvb4la6e.eu.platform.sh/upload-simple.html git checkout -f step-6 Solution ⇒ git checkout -f step-6-fixed
  • 41. JavaScript execution Execute synchronous script (doesn't block test execution) $this->wd->executeScript(' document.body.style.backgroundColor = "red"; '); Execute asynchronous script (wait for callback) $this->driver->executeAsyncScript(' var callback = arguments[arguments.length - 1]; ... callback(); '); https://simple-u6rzw4q-mxk4rjvb4la6e.eu.platform.sh/hidden.html git checkout -f step-7 Solution ⇒ git checkout -f step-7-fixed
  • 42. Selenium can do much more ● Change window size ($this->wd->manage()) ● Navigate through browsing history (navigate()) ● Switch to different window / iframe / alert (switchTo()) ○ github.com/facebook/php-webdriver/wiki/Alert,-tabs,-frames,-iframes ● Move mouse over element (action()) ● Run your tests in different browsers ● Run Chrome / Firefox in headless mode (R.I.P. PhantomJS)
  • 43. Other Steward features ● Annotation @noBrowser ○ Eg. seeding test data via API/database ○ Example: SeedDataTest.php ● Set default window size ● Sauce Labs / BrowserStack / TestingBot integration ○ Example: https://saucelabs.com/u/OndraM ● Pass capabilities (= configuration) to the browser ● Generate test execution timeline ● And more: https://github.com/lmc-eu/steward-example
  • 44. Debugging tests via Xdebug & PHPStorm $ vendor/bin/steward run dev chrome --xdebug https://github.com/lmc-eu/steward/wiki/Debugging-Selenium-tests-With-Steward
  • 45. Best practices ● Less functional tests is more ● Functional tests are not second-class citizen ● Have a strategy to maintain them ● Do not have long-term broken tests ○ markTestSkipped() ● Use Page Objects ● Unstable (flaky) tests - find root cause, no workarounds ● Tests must be fast ● Implicit wait instead of sleep ● Use self-describing names for tests, methods etc.
  • 46. Other options how to use Selenium in PHP There are multiple options how to run Selenium tests in PHP - choose the one that fits your needs! Steward - integrates php-webdriver into classic PHPUnit-styled tests and also provides parallelization. Codeception - complex test framework for all layers of tests, which adds BDD-like layer on top of PHPUnit. Laravel Dusk - another semantics for writing selenium tests in a "Laravel" way, it also includes Laravel integration. Behat + Mink - BDD way of writing test scenarios, however uses unmaintained library for Selenium integration Phpunit-selenium - old and outdated extension for PHPUnit ● Steward ● Codeception ● Laravel Dusk ● Behat + Mink ● phpunit-selenium (PHPUnit_Extensions_Selenium2TestCase)