Get Updates By E-mail 

Article Written By:
Johann Dowa

A Library For Automatic Testing Of Objective-C And Swift Programs Based On Haskell’s QuickCheck

  •  
  •  
  •  
  •  
  •  

I’ve mentioned a number of libraries and tools for easier testing of Objective-C and Swift programs, most recently and Rspec inspired BDD testing framework for Swift known as Quick.

Here’s an interesting library known as Fox from Jeff Hui for automatic testing of Objective-C and swift programs based on Haskell’s QuickCheck called Fox.

Fox automatically generates test data and this example from the readme shows some simple generation of testing values:

FOXRunner *runner = [[FOXRunner alloc] init];
// reads: for all integers x, y: x + y > x
FOXRunnerResult *result = [runner checkWithNumberOfTests:100
                                                  forAll:FOXTuple(FOXInteger(), FOXInteger())
                                                   then:^FOXPropertyResult(NSArray *tuple) {
    NSInteger x = [tuple[0] integerValue];
    NSInteger y = [tuple[1] integerValue];
    // FOXRequire converts bool into the FOXPropertyResult enum for passing or failing
    return FOXRequire(x + y > x);
}];

// verify
result.succeeded // => NO; failed
result.failingValue // => @[-9, @0]; random values generated

Extensive documentation is included a tutorial to get you started quickly.

You can find Fox on Github here, and more details about Fox can be found over on the documentation page.

An interesting tool for automatic property based testing.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments