News Feed
Jobs Feed
Sections




News Archive
feed this:

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

NetTuts.com:
BDD With Behat
December 24, 2013 @ 09:14:33

On NetTuts.com they've posted an introductory level tutorial for those that are exploring the world of testing and want to get their feet wet using some other tools. In this new post they introduce Behat, a human-readable functional testing tool written in PHP (but not just for PHP applications).

The BDD PHP framework Behat, allows you to test your PHP applications using human-readable sentences to write features and scenarios about how your applications should behave in order to test out its functionality. We can then run these tests to see if our application is behaving as expected. Let's spend about 15 minutes quickly going over Behat's installation process and learn how we can test our PHP applications behavior using the basics.

They help you get the tool installed (via Composer) and show you how to create your first feature file. They use a simple "adder" class for their examples that has two methods - add and display. The article covers features, scenarios and steps - including the code you'll need to add to the context file for any custom steps. Finally, they show how to run the tests and a sample of what the output looks like when everything's successful.

0 comments voice your opinion now!
bdd behat tutorial introduction beginner

Link: http://net.tutsplus.com/tutorials/php/bdd-with-behat

VG Tech:
Using PHP's Built-in Web Server in Behat Tests
August 19, 2013 @ 10:13:16

On the VG Tech blog there's a recent post showing you how you can use the built-in PHP web server to help with running your Behat (a behavior-driven development tool) tests.

Behat is a tool for running acceptance tests for your application. If your application is a web application you will need a web server to execute your tests. [...] Some weeks back I wrote a post showing you how to use PHP's built in web server in PHPUnit. This post will show you how to do the same for Behat when running your acceptance tests.

His example (here on github) shows you how to set up Behat via Composer, run it and start in on your first test. In the test's "setUp" method, it calls out to the command line and starts up the built-in web server if it's not already running. It also checks to see if it can connect to the server to make sure it's accessible. Then, in the "tearDown" method, there's a call to kill off the PHP process based on the PID stored on startup.

0 comments voice your opinion now!
builtin webserver bdd tests behat setup teardown

Link: http://tech.vg.no/2013/08/16/using-phps-built-in-web-server-in-behat-tests

Gonzalo Ayuso:
Building a BDD framework with PHP
August 19, 2013 @ 09:49:57

Gonzalo Ayuso wanted to look into BDD (behavior driven development) in PHP and was looking around for a tool to fit his needs. He didn't find one right away and so decided to create a simple one as a proof of concept to try out the method for himself.

I want to write as less code as I can (it's only a proof of concept), so I will reuse the assertion framework or PHPUnit. As I've seen when studying Behat, we can use the assertion part as standalone functions. We only need to include vendor/phpunit/phpunit/PHPUnit/Framework/Assert/Functions.php file.

He includes the sample code showing his basic interface - a string calculation object being passed into a closure for evaluation by the PHPUnit assertion methods. He also includes an example of using it along with Mockery for creating a mock object and testing based on that.

0 comments voice your opinion now!
bdd behaviordriven development framework proofofconcept poc mockery

Link: http://gonzalo123.com/2013/08/19/building-a-bdd-framework-with-php

Francesco Tassi:
Switching From TDD to BDD With Behat and Symfony2
August 16, 2013 @ 13:27:32

In this new post to his site Francesco Tassi shares his experience making the switch from doing just test-driven development on his Symfony2-based applications to behavior-driven development using Behat, Mink and PHPSpec.

Recently I started a small extra project with a smart fellow from my local PHP User Group, since the project was quite simple and both of us were willing to learn something new, we decided to give BDD a try. In the PHP world BDD means Behat, Mink and PHPSpec. [...] In this post I won't cover all the details about BDD, Behat or PHPSpec, I'd rather describe how I switched from PHPUnit and TDD to BDD (and also show some bits of code).

He talks about the switch in mindset that comes along with adopting BDD and how you think about testing - not what it does, but what it should do. He talks some about test organization, configuration and his process for executing them. There's a bit about working with databases (with fixtures and @BeforeScenario) including the code for the feature file to make it happen.

0 comments voice your opinion now!
tdd testdriven bdd behaviordriven behat symfony2 tutorial

Link: http://www.ftassi.com/blog/2013/08/12/switching-from-tdd-to-bdd-with-behat-and-symfony2

MaltBlue.com:
Why Testing Makes a Project Successful and You Can't Afford to Deny It
April 24, 2013 @ 10:48:15

Matthew Setter has a new article on his MaltBlue site today that suggests that one of the reasons a project is successful is because of effective testing.

Like many of us, despite being told repeatedly how great testing is, the benefits it will bring, the time it will save and how it will improve the quality of my applications, I too considered testing a second-thought. I saw it as something which was both expensive and time-consuming. If I was genuine with you, I'd say I believed it be be nothing more than a "nice to have", after the application was written. If you also feel (or have felt) this way - know that you're not alone.

He realized, though, that the usual false assumptions about testing were just that and starteed getting into testing, TDD and BDD on recent projects. He talks some about some general thoughts around testing like "testing can't be an after-thought" and the fact that it's no always easy. He includes a way of thinking about testing in your application and the confidence good, solid tests can bring.

0 comments voice your opinion now!
testing project success unittest tdd bdd opinion

Link: http://www.maltblue.com/software-development/testing/why-successful-software-includes-testing

Shashikant Jagtap:
Behat2.4 Painless installation with Composer
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.

0 comments voice your opinion now!
behat bdd testing install tutorial composer


Project:
Major Codeception Update (BDD in PHP)
August 08, 2012 @ 11:09:11

The Codeception project (BDD testing in PHP) has gotten a major update to its feature set and has bumped up to v1.1:

Many core classes were refactored to solve the common issues and reduce the level of dark magic inside. Only white magic left. And that's really cool 'cause you don't need to study to source code to implement your custom hooks now. Codeception is rapidly evolving to be the professional testing tool, ready to use by testsers and developers through out the PHP world.

Improvements in this large update include an update to the method of test execution, "grabbers" (helper methods that can extract content from tests), the introduction of XPath support to locate items in the content pulled into the test and the integration with unit testing. Upgrade instructions are also included.

0 comments voice your opinion now!
bdd behaviordriven codeception update


Shashikant Jagtap's Blog:
Enjoy 'MinkExtension' for Behat
May 08, 2012 @ 10: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.

0 comments voice your opinion now!
minkextension mink behat bdd testing frontend selenium


Shashikant Jagtap's Blog:
Adding More Sauce To Behat
April 25, 2012 @ 08:20:55

On his "Let's BDD" blog Shashikant Jagtap looks at the integration of Saucelabs and Behat for even more functionality when creating BDD tests.

On the occasion of Selenium Conference, I met with Noah Sussman talking about "Selenium In the Enterprise: What Went Right, What Went Wrong (So Far)" and one of his slides indicated that, team using Behat and Mink for the functional testing at Etsy. Noah then introduced me to Laura Beth who setup Behat/Mink and SauceLabs integration. Behat-Sauce configuration by Laura Beth is very easy to use. Now, we will see this in action.

Shashikant shows how to clone the github repository for the behat-suacelabs tool Etsy uses, use Composer to get all of the needed dependencies and a sample set of tests showing a sample set of Scenarios and their matching features (code). You can watch a video of the result here.

0 comments voice your opinion now!
saucelabs mink behat bdd integration tutorial


Shashikant Jagtap's Blog:
PHPUnit + Behat/Mink + Page Object The Rockstar Combination of Testing
April 20, 2012 @ 10:49:54

Earlier this month Shashikant Jagtap wrote up a post about a powerful combination in testing your applications - a "rockstar" combo of PHPUnit + Behat/Mink + Page Object to give you a great foundation for BDD (behavior-driven) testing.

Last month, we had discussion about implementing page object pattern in Behat/Mink framework at London Behat Users meetup. Page object pattern is a cool way to make tests maintainable, reusable and readable. Everyone was interested to know more about Page Object Pattern. In this short tutorial, we will implement Mink and PHPUnit combination for functional testing. Mink and PHPUnit combined with Pageness (Page Object) can be used for maintainable and readable tests.

He assumes that you might not have all the tools needed installed, so he walks you through the setup/install of PHPUnit, the PHPUnit-Mink framework and both the Sahi and Selenium drivers. He includes a basic directory structure for the testing and shows how to create some Page Object classes that extend the default TestCase and make calling the remote resource simple. He also includes the steps needed to execute the tests via PHPUnit.

0 comments voice your opinion now!
phpunit behat bdd testing mink pageobject



Community Events











Don't see your event here?
Let us know!


component facebook install package podcast introduction database release hack opinion performance application composer hhvm symfony2 framework language security unittest series

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework