 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Inviqa techPortal: Functionally Testing You Application Using Mink
by Chris Cornutt May 02, 2013 @ 13:50:44
On the Inviqa TechPortal today there'a a new post from Konstantin Kudryashov showing you how to use Mink for functional testing (an extension of Behat) of you web application.
Automated testing is big news these days. There's hardly a PHP conference happening without a talk on testing automation or derivative methodologies. TDD (Test-Driven Development) and BDD (Behaviour Driven Development) are all around us. So why should you care about all this? [...] The more complex an application becomes, the harder it is to be sure that each new feature or bug fix won't break the system, and that decreases your overall confidence in your work as developer. That's exactly the reason why you need automated testing - to be confident that you're not breaking important parts of an application.
For his examples he uses a simple Silex-based application (found here on github) that just shows a main page and an "add article" page that returns a preview when submitted. He shows how to get Behat/Mink installed and how to bootstrap PHPUnit to allow you to execute your tests. Also included is a sample test that clicks the "Add Article" link, runs a few checks and fills in some data. The form is submitted and the "preview" page is checked for valid results.
voice your opinion now!
functional testing behat mink phpunit tutorial
Dzone.com: Diving into Behat
by Chris Cornutt April 09, 2013 @ 09:50:34
Giorgio Sironi has a new post to DZone.com today about some of his experiences with Behat, a behavior-driven development testing tool written in PHP. It uses the Gherkin language syntax to define its tests.
I had the occasion to try out and adopt Behat for a particular need in our projects at Onebip. Here is my recount of the experience from a PHPUnit contributor and invested person.
He starts off with a list of situations where he doesn't think that Behat is a good fit for testing including testing of a single object and acceptance tests where comparing the response from more than one test is needed. He suggests that it's more useful for verifying high level business rules than anything. He talks some about the shift they made to using Behat and some of the benefits they found in its use. He finishes up the post by looking at the technical side and includes a warning about letting the size of the FeatureContext file get too large.
voice your opinion now!
behat introduction context technical impact overview benefits
QaFoo.com: Code Coverage with Behat
by Chris Cornutt April 03, 2013 @ 12:37:30
On the QaFoo blog today there's a post for those using the Behat testing tool showing a way to collect code coverage metrics based on your tests using the PHP_CodeCoverage library and phpcov.
There is generally no point in having code coverage for Behat test cases because of their nature: The purpose of an acceptance test is to assert a certain behavior of an application, not to technically test a piece of code. Therefore, there is no point in checking for uncovered code pieces in order to write a Behat test for it. That said, there is still a scenario where you want to peek at code coverage of Behat tests: When creating them as wide-coverage tests before starting to refactor legacy code. Behat in combination with Mink provides you with a great tool for such tests.
They help you get the tools installed and show the code you'll need to add to the application itself to collect the coverage data as the tests execute. It keys off of a file existing/not existing to know if it should execute the coverage or not. The phpcov tool can then be used to generate the HTML output of the coverage information for easy viewing.
voice your opinion now!
code coverage testing functional behat tutorial phpcov phpcodecoverage
QaFoo.com: Behavior Driven Development
by Chris Cornutt March 08, 2013 @ 11:54:21
On the QaFoo blog today there's a new post looking at behavior driven development and a PHP-based tool that makes implementing it in your workflow simpler (Behat).
While unit, integration and system tests - especially combined with the methodology of Test Driven Development (TDD) - are great ways to push the technical correctness of an application forward, they miss out one important aspect: the customer. None of these methods verify that developers actually implement what the customer desires. Behavior Driven Development (BDD) can help to bridge this gap.
The introduce some of the basic concepts behind behavior driven development and include an example of a Gherkin-formatted test example checking a page to ensure if has the correct content. They briefly define the structure of the test then take it into a Behat context and show how it would be implemented.
Of course, the examples shown above are only very rudimentary, missing e.g. variables and other advanced features. However, they should have explained what BDD is all about: Communication
voice your opinion now!
behaviordriven development behat introduction rationale
Gonzalo Ayuso: Managing Windows services with Symfony/Process and PHP
by Chris Cornutt November 01, 2012 @ 10:49:09
In his recent post Gonzalo Ayuso shows how to use Symfony to work with Windows services on the server.
Sometimes I need to stop/start remote Windows services with PHP. It's quite easy to do it with net commnand. This command is a tool for administration of Samba and remote CIFS servers. [...] Today we are going to create a PHP wrapper for [net rpc service].
He uses Behat to create a feature (test) file, the code behind the features and a service class that handles the actual work of interacting with the service (with methods to do things like stop, start and list running services). Examples of its use are also included.
voice your opinion now!
windows services behat feature test class tutorial symfony
Wojciech Sznapka: Export colored Behat scenarios to PDF
by Chris Cornutt September 04, 2012 @ 09:42:49
Wojciech Sznapka has shares his technique for creating colorized exports of Behat tests for use in PDF files:
Behat scenarios are one of the best ways to describe system. UML Use Cases or tons of pages in SRS documents are fine, but hard to understand from the begining, and even harder to maintain in the future. Behat eases this process and also gives opportunity to automate requirements verification. To write Behat scenarios you need a text editor. I've picked my favourite - Vim, which highlights *.feature files syntax. But business people mostly don't use Vim, so I need to figure a way, to expose scenarios in easy and pleasant way.
His solution involves setting up some printing options in vim to export the tests as a Postscript file, setting the "colorscheme" to the default setting so the colors will be retained. The result is exported (via the "hardcopy" command) and can be converted into a PDF (with a result like this).
voice your opinion now!
behat test color export postscript pdf print
Shashikant Jagtap: Behat2.4 Painless installation with Composer
by Chris Cornutt September 03, 2012 @ 08:47:50
Shashikant Jagtap has a new post to his site today showing how to painlessly install Behat (2.4) with the help of the Composer package manager.
Behat has becoming so popular in recent days. Behat has drastic changes in recent days in order to add some cool features into it. [...] In this tutorial, we will see how to upgrade Behat vesion with use of composer . Most of us have been installed Behat with 'pear' packages. behat version installed with pear has no longer supported.
He includes the commands to remove the current PEAR install (if it's there) and what you'll need to add to your "composer.json" file to pull in the main Behat package as well as the Geherkin parser and Mink extension. There's also a command you can use to be sure everything's working correctly.
voice your opinion now!
behat bdd testing install tutorial composer
|
Community Events
Don't see your event here? Let us know!
|