News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthias Noback:
A better PHP testing experience Part I Moving away from assertion-centric testing
July 07, 2014 @ 17:53:45

Matthias Noback has a new post today, part one in a series, looking at moving away from assertion-centric testing and more towards descriptive unit tests.

In the introduction article of this series I quickly mentioned that I think unit testing often focuses too much on assertions. [...] I used to preach these things myself too (yes, "development with tests" often comes with a lot of preaching). But now I don't follow these rules anymore. I will shortly explain my reasons. But before I do, let's take a step back and consider something that is known as the Test framework in a tweet, by Mathias Verraes.

He breaks up the rest of the article into three sections, each with a few paragraphs of description and code where appropriate:

  • Something is the case, or not
  • Only one assertion for each test?
  • Write assertions first and then work towards them?

He talks about the idea of "Arrange Act Assert" and makes some recommendations as to how to be more descriptive in your tests and make them easier to read and follow in the future.

0 comments voice your opinion now!
unittest experience assertion testing descriptive

Link: http://php-and-symfony.matthiasnoback.nl/2014/07/descriptive-unit-tests/

blog comments powered by Disqus

Similar Posts

Wojciech Sznapka's Blog: Fully isolated tests in Symfony2

Community News: PHP 5.5.0 alpha 1 Released for Testing

Debuggable Blog: Unit Testing in CakePHP Part 1 - Introduction to Unit Testing

Mike Naberezny's Blog: Better PHPUnit Group Annotations

Rob Allen's Blog: Unit testing controller actions with Zend_Test_PHPUnit_ControllerTestCase


Community Events





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


interview framework laravel release library language symfony package community list deployment podcast install tips introduction update opinion zendserver series api

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