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

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

Andrew Podner:
Make it Testable-No Matter how Painful it is
April 04, 2013 @ 09:39:27

In a new post Andrew Podner recommends that, as you're doing your day to day development, you try your hardest to create testable code, no matter how painful it is.

I look at the situation we have gotten into by having this problem [of replacing a large legacy application], and frankly, it is like the tech version of 'Scared Straight'. The paranoia of such a far reaching application within the enterprise that absolutely has to deploy successfully and also be very flexible to meet the needs of the future have driven me to the point of near madness in trying to make sure this thing is bulletproof, enter Test Driven Development.

He includes an example situation he recently was faced with in his code...and opted for the "easy" way out (difficult to test). He talks some about the issues, dependencies and coupled code this has created. He does, however, show a solution to the issue - passing in the dependencies as they're needed, not defining them in the method.

For me, writing custom apps in an enterprise environment is not about rapid deployment and looking like a hero. It is about deploying software with a design life of 7-10 years, because the change management involved in deployment is not something you want be be doing over and over again. Testable code with 100% coverage of unit tests, well developed integration testing, and prolific use of tools like PHPUnit & Selenium are part of the development culture because while speed is important, durability is even more critical to business.
0 comments voice your opinion now!
testable code unittest tdd testdriven refactor dependencies

Link: http://unassumingphp.com/make-it-testable-no-matter-how-painful-it-is/

Justin Carmony:
First Serious Attempts with PHPUnit, Composer, and the Omniture API
March 20, 2013 @ 09:37:53

In a new post to his site Justin Carmony shares some of his experiences with doing test-driven development (TDD) for a new project he was working on interfacing with the Omniture API. In it he shares six lessons he learned during the work.

At work we use Omniture for our web analytics, and for a long time I've wanted query our Omniture Data to run some internal reports. I discovered that Omniture has a restful reporting api, and after using it for a little bit I decided it would be nice to write a wrapper library for it. Since I had recently taken the PHP Testing Bootcamp from Chris Hartjes, I decided I wanted write it using Test Driven Development and really get my feet wet. I also decided I wanted to make the library compatible with Composer. After the weekend was over, I had an almost finished library that just requires some more work to be done, but I learned a great deal that I thought I'd share.

He's broken the post up into sections, each with their own summary:

  • TDD is 90% changing the way to write code, and 10% writing tests
  • Understanding Mock Objects is the real key.
  • It takes almost twice as long to write code and tests then just code
  • Its extremely easy to get out of the habit of writing tests.
  • You'll refactor quicker and more often when writing tests
  • Having testable code made me feel much better about sharing the code.
0 comments voice your opinion now!
tdd testdriven development rest api omniture composer lessons


John Cleary:
12 TDDs of Christmas
December 27, 2012 @ 09:17:26

In an effort to spread the good practices that TDD (test-driven development) can bring to your development, John Cleary has proposed what he's calling this "12 TDDs of Christmas" for the end of the year. The goal is to get you doing TDD, one piece at a time, and seeing the benefits.

So here is the challenge. Starting Wednesday 26th Dec and for the following 12 days I'm going to do just one kata per day. I'm calling it the 12 TDDs of Christmas and it would be pretty cool if a few other people out there took up the challenge with me 0 fancy it?

The 12 days started on December 26th, so there's a little catch up work to do, but you're not too far behind. The "katas" are short problems to solve that only require a bit of code to get working. The idea, though, is that you practice with the test-first methods and use these examples as the assertions.

0 comments voice your opinion now!
tdd testdriven development kata learn 12days


Matt Frost:
TDD For the Unconverted
November 20, 2012 @ 12:45:46

Matt Frost has a new post today helping to explain test-driven development (TDD) for the unconverted and some of the things that come with it in practice.

You've heard of Test Driven Development, but you think; "I've got a horrifying monstrosity for a codebase, it's not testable so I can't do TDD". Let me be the first to tell you that you're wrong. I'm not into writing really controversial pieces, castigating people for not doing things a certain way. If you've considered TDD at any point in time, it's because you understand (at least in the theoretical sense) that having predictable software is beneficial. So this is for you, unconverted developer...

He talks about how using TDD can help you build confidence in your code, make debugging issues easier in the project simpler and how - despite the initial time it takes to implement it in the process - it's worth it in the end. He also includes a few helpful suggestions when your team doesn't want to follow the method.

0 comments voice your opinion now!
tdd testdriven development opinion bug confidence process


Chris Hartjes:
5 Minute TDD
August 17, 2012 @ 09:10:05

Chris Hartjes, a big proponent of testing (unit and otherwise) in the PHP community has put together a screencast to show just how easy it can be to get started with TDD (test-driven development) in PHP.

I want to talk about test driven development and show you in five minutes how to set up.

His example uses a common problem - the FizzBuzz test - and shows how to write a simple test to check the output of his "process()" method that it matches his expected results. It's a simple example, but a great (realtime) primer to how the TDD process works.

0 comments voice your opinion now!
tdd testdriven video tutorial screencast fizzbuzz


NetTuts.com:
Let's TDD a Simple App in PHP
August 07, 2012 @ 10:18:07

On NetTuts.com there's a new tutorial that wants to show you a practical approach to using TDD in your development (test-driven development) through a simple project.

In this tutorial, I will present an end-to-end example of a simple application - made strictly with TDD in PHP. I will walk you through each step, one at a time, while explaining the decisions I made in order to get the task done. The example closely follows the rules of TDD: write tests, write code, refactor.

They start off by defining what TDD is (three core rules) and how the PHPUnit tool makes it easy in PHP. They use NetBeans in their examples, but it can be done similarly in any other ID (or command line). They start with some first tests - checking for word wrapping on short string and empty string handling.

0 comments voice your opinion now!
tdd testdriven development tutorial unittest sample application


NetTuts.com:
Test-Driven Development in PHP First Steps
July 17, 2012 @ 10:54:26

On NetTuts.com there's a new tutorial that wants to help you get started with a different sort of testing methodology than you might not have tried before - test driven development:

Let's admit it: the PHP community has lagged a bit, when it comes to advocating test-driven development. We know we should, but, even to this day, a sizable portion of the community does not. In this new series of videos and tutorials, created by the Nettuts+ team, we're hoping to change that. Trust me: it's not as tough as you think.

This first post in their series helps you get the environment set up (including Composer and PHPUnit) and test a basic class. It's a video, but there's links to the software you'll need to install at the end of the post.

0 comments voice your opinion now!
tdd testdriven development unittest introduction tutorial screencast


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


Label Media Blog:
Test Driven Development with PHPUnit
December 03, 2010 @ 08:46:26

New on the Label Media blog today Sam Holman has posted his introductory look at doing Test Driven Development (TDD) with the help of the popular PHP unit testing tool PHPUnit.

I couldn't find any recent surveys looking into the percentage of software development teams that make use of TDD, but i'd hazard a guess that it's probably not as high as it perhaps should be. I think there are a number of reasons for this, but it's primarily all about the people. The technologies are here, you've just got to start using them - which begins by understanding why they should be used. [...] There are a number of test frameworks for PHP, the biggest of which are probably PHPUnit and SimpleTest. My preference is for PHPUnit, which is the one I'll be using here.

He walks you through the basics first - installation of PHPUnit from its PEAR channel and setting up some basics tests. From there he moves into the TDD-ness stage, creating a sample class to test the getting and setting of values from a configuration class. He also provides the class that's something like your end result should be.

0 comments voice your opinion now!
phpunit testdriven development tdd introduction unittest



Community Events





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


release introduction series conference language deployment podcast laravel framework api symfony developer interview development code list threedevsandamaybe tips zendserver community

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