News Feed
Jobs Feed
Sections




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

PHPMaster.com:
Simplifying Test Data Generation with Faker
February 19, 2013 @ 12:09:02

In a new post to PHPMaster.com today, Rakhitha Nimesh takes a look at Faker, a tool that can be used to generate random test case data as a part of your workflow.

Testing is an iterative part of the development process that we carry out to ensure the quality of our code. A large portion of this entails writing test cases and testing each unit of our application using random test data. Actual data for our application comes in when we release it to production, but during the development process we need fake data similar to real data for testing purposes. The popular open source library Faker provides us with the ability to generate different data suitable for a wide range of scenarios.

Faker uses built-in data providers like "Person", "Company", "DateTime" and "UserAgent" to give you randomized output from the data sets you define. Code is included showing how to create the provider in your objects, extending the correct provider and making a request for a property. A real-world example is also included about testing an email marketing engine for address, title, name and content. There's also a little bit added at the end showing how you can increase the randomness of the results returned by "seeding" the Faker engine.

0 comments voice your opinion now!
test data generation faker library object provider tutorial


blog comments powered by Disqus

Similar Posts

Vexxblog: How to convert/encode files to FLV using FFMPEG & PHP

Michelangelo van Dam's Blog: Quality Assurance on PHP projects - PHP_CodeSniffer

PHPMaster.com: Using WampServer for Local Development

PHPMaster.com: How I Faked Scheduled Database Dumps Without Cron

PHPBuilder.com: AJAX and PHP Part 4 - Forms and JavaScript Limitations


Community Events











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


framework opinion component language hhvm package security database hack performance symfony2 support unittest introduction install podcast release facebook composer application

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