Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Wiley Kestner

Posts By

Announcing new WatchKit testing tools in PivotalCoreKit

We’re happy today to announce an open source tool that makes writing tests for WatchKit apps possible. The WatchKit testing tools we’re releasing today are part of PivotalCoreKit, our helper library for iOS projects.

Suppose you want to write a unit test for the following willActivate method:

@implementation MyInterfaceController - (void)willActivate { [super willActivate]; [self.label setText:@"Yay WatchKit!"]; } @end

Using PivotalCoreKit’s new WatchKit testing tools, your test for this method might look something like this:

#import "Cedar.h" #import "MyInterfaceController.h" // #import "PCKInterfaceControllerLoader.h" <-- Only needed when using CocoaPods using namespace Cedar::Matchers; using namespace Cedar::Doubles; SPEC_BEGIN(MyInterfaceControllerSpec) describe(@"MyInterfaceController", ^{ __block PCKInterfaceControllerLoader *loader; __block MyInterfaceController *subject; beforeEach(^{ NSBundle *testBundle = [NSBundle bundleForClass:[self class]]; loader = [[PCKInterfaceControllerLoader alloc] init]; subject = [loader interfaceControllerWithStoryboardName:@"Interface" identifier:@"myId" bundle:testBundle]; }); it(@"should show the correct text", ^{ [subject willActivate]; subject.label should have_received(@selector(setText:)).with(@"Yay WatchKit!"); }); }); SPEC_END

This test is written using Cedar BDD framework, a free, open-source testing framework for Objective-C code developed at Pivotal Labs.

Read more »