Test on SteroID

  • Archive
  • RSS
  • Askme

PHP unit testing with Atoum

It’s been a while since I posted here, my position at Plemi and the project Retentio required much time this last months. We’ve been playing with a lot of tools and I wishes I could have more time to share all the goodness of our experiences.

In the path of my previous post about the continuous integration I’d like to talk about atoum, a new framework for PHP unit testing.

In the PHP QA world, Sebastian Bergman is king. He’s the developer of PHPUnit, the powerful and standard framework for unit testing in PHP.

Yet a new challenger just came in the QA Arena: Atoum from Frédéric Hardy. I like to have choices, so I strongly support alternative projects when it’s reasonable, this means when the “philosophy” behind the projects aren’t the same and it’s not a waste of efforts justified by ego.

I tested atoum in 3 projects this last 3 months, One word: awesome. This tool embraces KISS principles. Is PHPUnit complex ? Not really, it just looks complex. Both frameworks are really great: I like the clover-html output of PHPUnit, I like the fluent interface of the atoum’s asserters, etc.

But, I would advise beginners and new comers into the TDD world to start with atoum. The learning curve is unbeatable, the tests are much more “readable” (IMHO) and finally, writing unit tests with atoum is fun.

Here’s a little comparison of asserters usage for example:

This is a major victory for the “underrated unit testing practice”, because when something is fun, people want to play. Atoum does not provide much documentation at the moment, but it’s easy to find what you need in the asserters directory.

As PHPUnit, Atoum provides standard reports:

  • jUnit reports which can be displayed in many continuous integration plateform
  • Clover coverage (will be released soon) thanks to Julien Bianchi

So it will perfectly fit into your continuous integration stack, here at Plemi we already switched. (We won’t migrate our projects on PHPUnit, since there is no point to do a such thing.)

This post doesn’t mentions all the features of PHPUnit and Atoum, mock, test isolation, but right now, with theses two cool tools, you have no excuse to don’t test your PHP code. Try it, love it, atoum is the missing key for the TDD gate.

    • #php
    • #test
    • #unit
    • #atoum
    • #phpunit
  • 1 year ago
  • Comments
  • Permalink
  • Share
    Tweet

About

Avatar Tech stuff experienced by @ludofleury

Keep in touch

  • @ludofleury on Twitter
  • Linkedin Profile
  • ludofleury on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Askme
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr