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

NetTus.com:
Understanding PhpSpec
September 04, 2014 @ 11:09:42

The NetTuts.com site (well, TutsPlus) has posted a new tutorial that gets you more intimate with PhpSpec, a PHP-based testing tool that lets you define tests as specifications and using behavior-driven development principles. If you need an introduction to the tool, check out this other tutorial first.

If you compare PhpSpec to other testing frameworks, you will find that it is a very sophisticated and opinionated tool. One of the reasons for this, is that PhpSpec is not a testing framework like the ones you already know. Instead, it is a design tool that helps describing behavior of software. A side effect of describing the behavior of software with PhpSpec, is that you will end up with specs that will also serve as tests afterwards. In this article, we will take a look under the hood of PhpSpec and try to gain a deeper understanding of how it works and how to use it.

They provide a quick overview of some of the internals of the PhpSpec tool and a brief look at the difference between BDD (behavior-driven) and TDD (test-driven) development practices. There's also a look at how the tool differs from the popular PHP testing tool PHPUnit. Code examples are provided through out the post with simple tests, making the separation between the methods and tools easier to follow.

0 comments voice your opinion now!
tutorial phpspec testing tool bdd tdd unittest behaviordriven development

Link: http://code.tutsplus.com/tutorials/understanding-phpspec--cms-21915

Matthias Noback:
The PHP testing experience Interview by Fernando Arconada
July 15, 2014 @ 09:54:12

Matthias Noback has a new post today, an interview that was conducted with him by Fernando Arconda about his experience and thoughts around testing in PHP-driven applications.

Fernando Arconada interviewed me about the subject of testing. He is writing a book about testing Symfony2 applications: Testing para Aplicaciones Symfony2. Fernando will translate this interview to Spanish and and add it to his book, together with the articles in my A better PHP testing experience series.

The interview starts with some background on who Matthias is and what kinds of things he's done in the past with BDD and TDD testing. He answers questions about testing, even for small projects, and if the sought after "100% coverage" is a good mark to try for. They discuss tooling and include some recommendations to beginner developers to help them get testing quickly. A large part of the interview also shares some of his thoughts around the "BDD/TDD is dead" debate that happened not too long ago.

0 comments voice your opinion now!
interview fernandoarconda testing bdd tdd unittest

Link: http://php-and-symfony.matthiasnoback.nl/2014/07/the-php-testing-experience-interview-by-fernando-arconada/

NetTuts.com:
A BDD Workflow With Behat and Phpspec
July 04, 2014 @ 14:20:23

NetTuts.com has posted a new tutorial today showing a sample testing BDD workflow using the Behat and PHPSpec testing tools. The BDD (behavior-driven development) approach focuses on using test-driven development and domain-driven design rather than just a unit testing approach.

In this tutorial, we will have a look at two different BDD tools, Behat and phpspec, and see how they can support you in your development process. Learning BDD can be confusing. New methodology, new tools and many questions, such as "what to test?" and "which tools to use?". I hope that this rather simple example will give you ideas to how you can incorporate BDD into your own workflow.

The article isn't a "getting started with BDD" guide, so you'll need to know a bit about the ideas and process before getting into it. He starts with a look at the workflow Taylor Otwell (his inspiration for this) uses and how to install Behat and get to work on a first feature file. He describes the thought process behind the steps and some of the PHP code required to make them work. He then gets to the use of phpspec to mock out a needed "Config" dependency. He works though the rest of the tests and includes the output when all tests are passing.

0 comments voice your opinion now!
bdd workflow phpspec behat taylorotwell tutorial

Link: http://code.tutsplus.com/tutorials/a-bdd-workflow-with-behat-and-phpspec--cms-21601

Inviqa Blog:
How clean is your code?
June 13, 2014 @ 10:55:44

In this latest post to the Inviqa blog they ask the question "how clean is your code?" and offer a few tips to help it get that way (and stay that way).

During the Test Driven Development training (which includes Behat, and PHPspec) run by Marcello Duarte, I was particularly blown away by one of his many and funny analogies… "Would you have any surgery carried out by a doctor who does not wash his hands?" Everybody in the room shook their heads. Of course nobody would. There is too a high risk of complications. In software development 'infected' code can translate to bugs, bad user experience, poor performance and the complete failure of web applications.

He talks briefly about some of the lessons learned in this training session, pointing out that while it's not the easiest method to apply, it pays off in the long run of your code's "hygiene". He points out that the [Inviqa] group's success rate with TDD/BDD has reflected in the bottom line of their enterprise clients too.

0 comments voice your opinion now!
testdrivendevelopment tdd code hygiene training bdd

Link: http://inviqa.com/blog/how-clean-is-your-code/

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

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


Community Events





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


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

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