Symfony Panther - an introduction and review

dknx01
February 27, 2019

Symfony Panther - an introduction and review

A quick introductin and review about the E2E testing tool Symfony Panther.

Presented at Symfony User Group Berlin

dknx01

February 27, 2019

Annual Pro sale · Save $30

Have presentations of your own?

Share with private links, password protection, and more control over your work.

Transcript

18 slides
  1. About me Erik Witthauer PHP developer for > 10 years

    Twitter: ewnx01 Web aka: dknx01 Speakerdeck: speackerdeck.com/dknx01 currently work: FTI
  2. How to test a web application with(out) PHP • use

    external E2E tools • use monkeys (testing everything manual) • use PHPUnit with ◦ WebTestCase ◦ BrowserKit, DomCrawler ◦ CssSelector • Behat • other testing frameworks
  3. What about ...? Behat • uses CssSelection • hard to

    handle Javascript (loading) • sees “everything” • does not behave like a real browser WebTestCase • use local setup (booting Kernel) • hard to handle Javascript (loading) • sees “everything” • does not behave like a real browser
  4. What about ...? Goutte • uses CssSelection • no Javascript

    handling • sees “everything” • does not behave like a real browser
  5. How to test a web application with(out) PHP • Problems:

    ◦ detection of hidden elements, by CSS ◦ JavaScript changes or error prevent loading ◦ browser blocking (XSS ...)
  6. What is Symfony Panther? • a Browser Testing and Web

    Scrapping Library for PHP • library for E2E testing • executes a real browser (with full JS and CSS support) • build on top of Facebook PHP WebDriver and WebDriver protocol • supports JavaScript execution • implements BrowserKit API • standalone lib
  7. What is Symfony Panther? • shipped with ChromeDriver binaries •

    uses local Chrome • runs headless • compatibles with Selenium server, remote testing services (e.g. BrowserStack, SauceLabs) • experimental GeckoDriver • uses builtin PHP web server
  8. What is Symfony Panther? • can use external based URLs

    (any URL) • can take screenshots • injecting and execute JavaScript on the fly (even asynchrone) • simulate different resolutions (responsive testing)
  9. How to use it class BlogPostControllerTest extends WebTestCase { public

    function testSeeHeadline() { $client = static::createClient(); // Here goes the Code } } class BlogPostControllerPantherTest extends PantherTestCase { public function testSeeHeadline() { $client = static::createPantherClient(); // Here goes the Code } }
  10. End

More Decks by dknx01

Other Decks in Programming