![Post Category Post Category](http://maniacdev.com/wp-content/plugins/maxblogpress-bring-my-blog-visitors-back/bmbvb-lib/images/category-icon.png)
I’ve mentioned a number of libraries and tools to aid in testing, such as the UIAutomation framework that uses Objective-C.
Here are two libraries created to ease testing submitted by John Tumminaro – Foundry for creating test/mock objects inspired by Ruby’s Factory_girl, and Gizou inspired by Ruby’s MBFaker for generating sample data.
As John states in his submission:
“Foundry (and its sister project Gizou) are two libraries I built due to the lack of really great factory/mock data libraries for Objective-C developers. I really liked my experience with libraries like factory_girl in the Ruby universe and I took a lot of inspiration from it to create these two.”
Foundry allows you to easily build a spec and create objects like this example created from the readme:
…
<ul>
<li>(NSDictionary *)foundryBuildSpecs
{
return @{
@"name": [NSNumber numberWithInteger:FoundryPropertyTypeName],
@"email": [NSNumber numberWithInteger:FoundryPropertyTypeEmail],
@"password": [NSNumber numberWithInteger:FoundryPropertyTypeLoremIpsumShort]
};
}
and create the specs you want like this:
Person *fullPerson = [Person foundryBuild];
<pre><code>// Not enough, let’s make 10 people!
NSArray *bunchOfPeople = [Person foundryBuildNumber:10];
</code></pre>
Gizou provides extensive support for generating test data and not only allows you to create realistic data for names, emails and addresses, but also has support for test images, and nearby locations with a number of nice convenience categories.
Both projects are well documented with some examples included.
You can find Foundry on Github here.
You can find Gizou on Github here.
Two very nice libraries to simplify testing of Objective-C projects.
- Open Source NSString Category Adding Many Ruby Inspired Helper Methods
- New Open Source Visual iOS Testing Framework For Easy Testing Using Coffeescript And Screenshots
- Simple Library Allowing You To Map Views Used In Your Apps
- Objective-C Additions For Ruby Like Iterators And More
- Open Source iOS UIAutomation Test Runner That Supports Coffeescript
Original article: Two Objective-C Libraries For Easier Testing Inspired By Ruby’s Factory Girl And MBFaker
©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.