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

Laravel News:
Data-driven testing with PHPUnit
Feb 27, 2018 @ 11:54:24

The Laravel News site has a tutorial posted that approaches a common development task - writing tests - from a data-driven approach rather than a strictly functional one.

Testing your code is an essential part of the development process, but sometimes it could also be expensive when you try to emulate many uses cases based on a set of different input data.

In many cases, you could end up with a massive directory of tests repeating the same block of code over and over for each possible user interaction.

They start with an example of a feature to test (Markdown parsing) and how traditional testing would have methods for each of the transformations. With a data-driven approach they turn the tests around and make use of data providers to set up the initial string, transformer to use and the correct result. Code is included showing an example of this kind of testing for the same Markdown parsing example and what a failure would look like in a dataset with multiple items.

tagged: tutorial provider phpunit testing data datadriven markdown

Link: https://laravel-news.com/data-driven-testing-phpunit

DZone.com:
Test Strategy Patterns
Nov 02, 2010 @ 13:42:40

Giorgio Sironi has started up a new series on DZone.com about some practical testing patterns you can use when writing up unit tests (and other types of testing in some cases) for your applications - the Test Strategy Patterns.

The list so far includes the patterns for:

Keep an eye on this great series. There's more to come that can be quite helpful when you're trying to generate those tests and procedures around them.

tagged: series test strategy pattern recorded scripted datadriven automation

Link: