News 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:
Getting Started With Phpspec
May 12, 2014 @ 13:55:10

The NetTuts.com site has a new tutorial that want to help get you started with PHPSpec, the PHP-based tool to help with behavior-driven development.

In this short, yet comprehensive, tutorial, we'll have a look at behavior driven development (BDD) with phpspec. Mostly, it will be an introduction to the phpspec tool, but as we go, we'll touch on different BDD concepts. BDD is a hot topic these days and phpspec has gained a lot of attention in the PHP community recently.

They briefly introduce behavior-driven development (BDD) and where the PHPSpec tool fits into the picture. They guide you through installation of the tool (via Composer) and some configuration updates to get things set up. From there, they help you write your first spec, a test to see if a "TaskCollection" can be created. They build on this simple test adding in checks for adding tasks, making the collection countable and working with expectations and promises. The last part of the tutorial mentions how to make custom matchers like "beTrue" and "beFalse" and the output of the full test set.

0 comments voice your opinion now!
phpspec tutorial introduction behaviordriven development bdd

Link: http://code.tutsplus.com/tutorials/getting-started-with-phpspec--cms-20919

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

QaFoo.com:
Webinar Behavior Driven Development with Behat
April 17, 2013 @ 10:44:21

The QaFoo folks have posted information about a webinar they're putting on for those interested in using Behat for doing functional testing on their applications:

I've already written two blog posts here about Behat: Behavior Driven Development and Code Coverage with Behat. If that made you curious or you wanted to learn about Behat anyway, I can highly recommend to join the free webinar on Behavior Driven Development with Behat I'll be giving on May 8th 2013 on behalf of Qafoo in cooperation with Zend.

As mentioned, the webinar is free to attend, but you'll need to sign up to be able to attend.

0 comments voice your opinion now!
webinar behat testing functional tool behaviordriven development

Link: http://qafoo.com/blog/042_webinar_bdd_behat.html

QaFoo.com:
Behavior Driven Development
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
0 comments voice your opinion now!
behaviordriven development behat introduction rationale


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


Chris Hartjes' Blog:
Simple API Testing Using Behat
February 27, 2012 @ 10:09:18

Chris Hartjes has taken some of his first steps to testing a web service with the help of the Behat BDD testing framework. In this new post he shares some of that knowledge and a bit of code to help guide you if you'd like to get started yourself.

I have been trying to push my JavaScript skills lately by first playing around with Node.js to get a feel for event-driven server-side coding and by trying to build something semi-useful using Knockout. [...] After working with PHPUnit's "assert that the result matches expectations" philosophy, switching to using a behavioural approach has changed how I decide to approach actually testing something.

He shows how to define a "scenario" in a more recognizable sort of English. His example is testing a web service to ensure of a few things:

  • the response is JSON
  • it contains at least one transaction
  • the first transaction has an ID, contains two teams and has a description

Included in the post is the resulting Behat test code (generated and modified with his testing details) and an example of the execution of the test.

I think that the BDD approach maps better to a results-oriented methodology when it comes to testing: you are using real-life scenarios to make sure that you are getting back the results you are expecting. In the end. that is still the goal of testing.
0 comments voice your opinion now!
simple api test behaviordriven behat example slim framework


Codeception Blog:
Introduction to Codeception
January 25, 2012 @ 10:19:59

On the Codeception blog there's an introduction to the Codeception tool, a behavior-driven framework written in PHP (in the spirit of Behat).

How often do you see PHP projects with no line of test written? From my experience, this situation happens quite often. We should state the unpleasant fact that tests are not so popular around the PHP world. Surely, the advanced developers with 5+ years of experience in PHP and other programming languages understand importance of testing and PHPUnit usage. But juniors and seniors are just skipping testing and, therefore, produce unstable web applications.

A code example of the framework in use is included in the post - a test on a class using methods like "wantTo", "amOnPage", "fillField" and "click". The installation is pretty simple and it gives you a quick way to start working on acceptance, functional and unit tests. In BDD fashion, the tests are written in a more "natural language" than traditional unit tests making them easier for the non-developers (like QA) to write. Their example loads a page, fills in some form fields and submits the form to check the result.

0 comments voice your opinion now!
behaviordriven development codeception testing tutorial functional


Alessandro Nadalin's Blog:
Behaviour what?
August 30, 2011 @ 09:22:15

In a recent post to his blog Alessandro Nadalin looks at a different approach to development than the usual code-first, ask questions later style, behavior-driven development, and a tool that can help you follow this method - Behat.

Although this requirement is not mandatory, BDD's power is leveraged by using stories. It basically assumes that instead of focusing on tests, we should start our development process writing down a story that a parser can translate into a test (a customer cares about features, not tests) a programmer can implement in order to verify that our software respects that story.

He talks about installing Behat via PEAR, how it can integrate with Symfony (1.4) and an example of a sample story/test file that checks a few things against a basic page. He also points out an interesting and quite useful feature of Behat - outputting the tests in a HTML-formatted result that makes for easy reading by non-developers.

0 comments voice your opinion now!
behat behaviordriven development symfony integration testing


Ibuildings techPortal:
Beyond TDD with PHPSpec
August 03, 2011 @ 09:41:20

On the Ibuildings techPortal today there's a new post from Marcello Duarte following up on his previous post looking at behavior driven development (here) with a look at PHPSpec, a port of RSpec that is the first PHP BDD framework.

PHPSpec is the first ever PHP BDD framework. It is a port of RSpec to PHP created back in 2007 by Padraic Brady and Travis Swicegood. Development in this framework stopped for a while and was reignited last August (2010).

He goes over how to get it installed via PEAR and how to write some sample tests following along the topic from his previous post (handing videos and reviews). He gets into a bit more detail by describing how MVC is handled with PHPSpec and how the Zend Framework command line tool can be used to create a controller that satisfies the test.

0 comments voice your opinion now!
behaviordriven development phpspec testdriven framework



Community Events





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


interview podcast laravel release wordpress list bugfix introduction series application install threedevsandamaybe api code developer community configure unittest language library

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