Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Dotdev.co:
Acceptance Testing a Laravel and Vue.js Application
May 20, 2016 @ 16:57:28

Mohamed Said has written up an article about acceptance testing a Laravel+Vue.js application with the help of the Selenium WebDriver functionality.

The good thing about writing tests at a mature stage of the project is that many of the basic parts of the application are settled down, major changes have slowed, so deciding the shape of tests can happen in a more solid way. Testing too early, in my opinion, leads to the need of changing tests whenever you change functionality, so it’s work * 2.

This post is about a single type of tests and I think it’s the most interesting one.

He starts with a brief description of what acceptance testing is for those not familiar with the concept. He then gets to the Selenium WebDriver, provides a summary on that as well and points out the main tool they use for their tests: the Javascript driver it provides. the syntax on the driver is a bit difficult to follow so they also suggest layering Nightwatch.js on top to make for simpler, cleaner and easier to read tests. There's also information and (acceptance) testing the backend of the application with various tools, ultimately deciding on the use of Codeception.

tagged: acceptance testing larvel vuejs selenium webdriver nightwatchjs codeception

Link: https://dotdev.co/acceptance-testing-a-laravel-and-vue-js-application-4160b8e96156#.vdxu8in7i

Magium Blog:
3 Best Practices for Selenium Testing when Constructing Your Page
Feb 17, 2016 @ 15:55:26

In a new post to the Magium site Kevin Schroeder shares three helpful tips you can use for the Selenium testing of your application based on some of his recent development on the project.

Having spent now about two months building out Magium there are a couple of things that are worth sharing as I’ve been working through several different versions of Magento. These practices (best practices?) may or may not be “officialized” by the Overlords of the Internet but what I have found is that I have the most trouble when these practices are not executed.

The basic premise behind each of these is that the quickest path to the most specific element is best.

His three tips avoid things like long XPath expressions to locate single items and favor consistency and simplicity:

  • Wrap ALL text in an HTML element – leave no orphaned text
  • If an element has function, identify it.
  • Group data using classes and IDs

He ends the post with a reminder that a well-structured page not only helps with testing but is also a good goal to strive for related to maintainability.

tagged: selenium testing magento tips top3 structure

Link: http://magiumlib.com/blog/3-best-practices-for-selenium-testing-when-constructing-your-page/

SitePoint PHP Blog:
Using the Selenium Web Driver API with PHPUnit
Aug 24, 2015 @ 17:54:56

The SitePoint PHP blog has posted a tutorial showing you how to use the Selenium web driver API from inside of your PHPUnit tests. Selenium is an automation tool that makes testing frontends of applications simpler.

Previously, we demonstrated using Selenium with PHPUnit and used a user subscription form example throughout the article. In this one, we are going to explore Facebook’s webdriver package for emulating a browser. PHPUnit partially supports the Selenium WebDriver API and the work is still in progress. One of the most popular WebDriver API implementations is the Facebook/webdriver package. We will try to accomplish the same validation tests from the previous article using this package.

They help you get the Facebook package installed (via Composer) and create a first simple test class. They create an instance of the RemoteWebDriver object and point it at their local application. A test is then created to navigate to a form, fill in a bit of data and submit it. The results are then checked for a string ("Everything is Good!") to pass the test. He also shows how to have the driver wait for an element to load, possibly one that uses an AJAX request. The post finishes off with a look at some of the other interaction methods (drag and drop, handling popups) and how to run the tests in a "headless" mode not requiring a browser to execute through your system.

tagged: selenium phpunit webdriver api tutorial frontend testing

Link: http://www.sitepoint.com/using-the-selenium-web-driver-api-with-phpunit/

Younes Rafie:
Using Selenium with PHPUnit
Jul 30, 2015 @ 14:51:20

In this tutorial posted to the SitePoint PHP blog Younes Rafie shows you how to combine Selenium with PHPUnit to do acceptance testing on your application. Where PHPUnit and unit testing is more about testing the "pieces" of your application, acceptance testing it more about checking the interface and functionality for correctness according to requirements.

Testing is a really wide subject, whether it be unit testing, functional testing, acceptance testing, etc. In this article, we’re going to see how you can do acceptance testing using Selenium. I will use a practical example to illustrate a real use case. I will assume that you already know how to do unit testing using PHPUnit, or that you at least have a grasp of what it’s all about.

He starts with a few definitions around what acceptance testing is and how Selenium can help in performing these evaluations. He uses a simple user registration page for his tests and includes commands to get PHPUnit+Selenium installed as well as an alias to start the Selenium server. He then creates a first test case, setting up the Selenium "browser" to use in later requests. He then gets to testing the page itself, setting up some data providers for the content to inject into the form both valid and invalid. He shows how to work with the DOM inside of your tests and making both a valid and invalid form submission. He also shows how to use a different browser (he defaults to Firefox) and how to check of the current document is ready for evaluation, that is if all Javascript has fired and finished.

tagged: selenium phpunit acceptance testing unittest tutorial

Link: http://www.sitepoint.com/using-selenium-with-phpunit/

Codeception.com:
Working with PHPUnit and Selenium Webdriver
Nov 21, 2013 @ 18:15:43

On the Codeception site they've recently posted a guide to using PHPUnit and the Selenium Webdriver to easily create functional tests for your application. They make use of the php-webdriver library from Facebook to make the connection inside the tests.

In this post we will explore some basics of user acceptance testing with Selenium. We will do this with classical unit testing framework PHPUnit, web browser Firefox, and with new php-webdriver library recently developed by Facebook. Selenium allows us to record user actions that we do inside a browser and then automate them. PHPUnit will be used to do various assertions and check them for fallacy. And php-webdriver is used to connect PHP with Selenium, in order to do browser manipulation in PHP.

They walk you through the installation process (pretty simple with Composer) and show you how to start up a standalone Selenium server to receive the test commands. From there they start in on the test examples make with PHPUnit, first creating a simple test that connects to Github and looks for "Github" in the page title. They list some of the more complex selector functions and put them to use finding an object by ID. Finally, they include a few handy tips about locating elements, handling "not found" items and some refactoring and test structure suggestions.

tagged: phpunit selenium webdriver facebook tutorial functional testing

Link: http://codeception.com/11-12-2013/working-with-phpunit-and-selenium-webdriver.html

VG Tech Blog:
Selenium Tests
Jun 21, 2013 @ 16:26:30

On the VG Tech blog today there's a new post introducing Selenium testing to those that might not have heard of it before for functional testing. It's a powerful tool that can even be used from inside PHPUnit tests to automate evaluation of your frontend application.

When we develop code at VG we have started to use Selenium tests for continuous integration. This allows us to easy write tests that programmatically checks that last commit didn't break anything.

He describes some of the types of tests Selenium can do and mentions the IDE that can hook into Firefox and record your actions and translate them into tests. This includes the ability to export them to PHPUnit tests (sample code provided) that extend the "PHPUnit_Extensions_SeleniumTestCase." An example screenshot of what the IDE running looks like is also included.

tagged: selenium test introduction phpunit export ide firefox

Link: http://tech.vg.no/2013/06/14/selenium-tests

Andrew Podner:
Functional Testing to Improve Quality Assurance (part 2)
Jun 03, 2013 @ 16:57:40

Andrew Podner has a posted the second part of his series looking at functional testing in PHP applications with Selenum.

In the first post about functional testing, we went through the basics of what functional testing is and how it complements and differs from other types of testing used for software quality assurance. This time, I will spend some time talking about using functional testing in a practical sense to set up a testing suite for a web based software project. [...] Each of these can provide a powerful means of performing automated functional testing and you should select your tool of choice based on what works best for you. I typically find myself using Selenium for functional testing, but again, I would encourage you to look at each available option out there and select the best fit

He walks you through the installation of the Selenium Firefox plugin, some of the basics of its use and how to create and run a simple test. He also looks at a slightly more complex example - filling in a form and validating the resulting page.

tagged: functional testing quality assurance part2 series selenium

Link: http://unassumingphp.com/functional-testing-to-improve-quality-assurance-part-2

Michelangelo van Dam:
UA Testing with Selenium and PHPUnit
May 24, 2013 @ 15:18:40

In this new post to his site Michaelangelo van Dam looks at user acceptance testing with PHPUnit and Selenium.

Last week I spoke at php[tek] 2013 where I explained to people how to get started with Selenium IDE to record user interaction with the web interface, convert them to PHPUnit testcases and automatically execute them on multiple browsers on multiple platforms. The twitter I also received a bunch of questions regarding how to set up multiple platforms and why I used Windows in my presentation to deploy to. So today I deceided it was time to write a full article on this subject.

He introduces Selenium and what kinds of things it can be used to test. He also defines "user acceptance testing" and talks about why they're an important part of the testing ecosystem. He then walks you through the process of getting the testing environment set up, creating a few tests and how to convert them over to PHPUnit tests (using a built-in tool). Screencasts show you each step of the way. He includes a little tweaking you'll need to do to to the test code to get it working with your own Selenium server

tagged: useracceptance testing phpunit selenium introduction

Link: http://www.dragonbe.com/2013/05/ua-testing-with-selenium-and-phpunit.html

Matt Frost:
Starting with Selenium (and Headless on a VM)
Aug 27, 2012 @ 13:16:55

Matt Frost has posted a two part series of some of his experiences in setting up Selenium to execute it in a VM and run tests on your application.

I was a little scared when it came to setting up Selenium, I figured it was going to be difficult to setup and configure. So I was pleasantly surprised when it really wasn't. So here are a few of the mistakes I made; since I use Vagrant to do all my development I actually grabbed Selenium and started from there. Not a good place to start, although as I found out later; not a total dead end.

He includes the initial setup of things like PHPUnit and the Selenium .jar file as well as a sample test that loads a page and checks the title of the page. His second post shows how to set it up in the VM (using Vagrant, xvfb to capture the output and Firefox to execute the tests).

tagged: selenium frontend testing vm vagrant firefox java xvfb

Link:

Shashikant Jagtap's Blog:
Enjoy 'MinkExtension' for Behat
May 08, 2012 @ 15:55:55

In this new post to his blog Shashikant Jagtap talks about a new extension for Behat (the BDD testing tool) that makes working with Mink even easier - MinkExtension.

'MinkExtension' has been just released which has additional services for Behat. This extension has ‘Mink’ instance for your ‘FeatureContext’ and ‘SubContext’. UI testers would be happy now, as they don’t need to create Mink instance every time in order to use Mink API’s.

He points you to an example application you can use to follow along. He includes the commands needed to install the dependencies via Composer and get this extension working (note: it requires PHP 5.4 for some of the traits stuff. If you don't want to use that, comment out the "TraitedFeatureContext.php" file). Also included are the commands to execute the tests with a Selenium server and a list of a few handy new things this extension enables.

tagged: minkextension mink behat bdd testing frontend selenium

Link:


Trending Topics: