 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Andrew Podner: Make it Testable-No Matter how Painful it is
by Chris Cornutt 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.
voice your opinion now!
testable code unittest tdd testdriven refactor dependencies
Justin Carmony: First Serious Attempts with PHPUnit, Composer, and the Omniture API
by Chris Cornutt 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.
voice your opinion now!
tdd testdriven development rest api omniture composer lessons
John Cleary: 12 TDDs of Christmas
by Chris Cornutt 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.
voice your opinion now!
tdd testdriven development kata learn 12days
Matt Frost: TDD For the Unconverted
by Chris Cornutt 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.
voice your opinion now!
tdd testdriven development opinion bug confidence process
Chris Hartjes: 5 Minute TDD
by Chris Cornutt 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.
voice your opinion now!
tdd testdriven video tutorial screencast fizzbuzz
NetTuts.com: Let's TDD a Simple App in PHP
by Chris Cornutt 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.
voice your opinion now!
tdd testdriven development tutorial unittest sample application
NetTuts.com: Test-Driven Development in PHP First Steps
by Chris Cornutt 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.
voice your opinion now!
tdd testdriven development unittest introduction tutorial screencast
Ibuildings techPortal: Beyond TDD with PHPSpec
by Chris Cornutt 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.
voice your opinion now!
behaviordriven development phpspec testdriven framework
Label Media Blog: Test Driven Development with PHPUnit
by Chris Cornutt 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.
voice your opinion now!
phpunit testdriven development tdd introduction unittest
NETTUTS.com: The Newbie's Guide to Test-Driven Development
by Chris Cornutt August 17, 2010 @ 11:40:15
On NETTUTS.com today there's a new tutorial to help you get started with effective test-driven development in your PHP applications with SimpleTest.
Testing your code is annoying, but the impact of not doing so can be orders of magnitude more annoying! In this article, we'll use test-driven development to write and test our code more effectively.
They start with the basics - what test-driven development is, why it's a good idea and how the whole process works to improve your code. They opt for a bit simpler route for their testing tool and chose SimpleTest. They show you how to set it up and where to start. In order for TDD to work, you really have to plan out your application so you know what you're testing. They give you an example of a simple script and how to start from failing tests to a working app.
voice your opinion now!
testdriven development tdd tutorial simpletest
|
Community Events
Don't see your event here? Let us know!
|