Testing

Testing in the OSX Sandbox

2 minute read Published:

If you’re running Application Unit Tests, and have just enabled entitlements, you will immediately be greeted with an error similar to the following.

RubyMotion Functional Tests with Storyboards

2 minute read Published:

If you’ve been using RubyMotion, you probably noticed that some new testing features were released today. The video in the announcment post and the documentation are pretty good, so I’m just going to share a few things that I had to do to get things working.

Testing Warden-Based Sinatra Apps

2 minute read Published:

I recently integrated Warden into a web service I’ve been building with Sinatra. Unfortunately doing so completely broke some of my tests. I spent a while trying to figure out how to stub out the Warden object before I discovered that Warden already provides support for testing. Awesome. While I could load my config.ru in the test, there are other things in there that I’d rather not deal with while testing. I came up with the following approach, which lets me more or less test the web service in isolation.

Getting Started with Xcode

4 minute read Published:

I finally spent some quality time with Xcode this past weekend. While I haven’t done any real work with it yet, I think it should be a serviceable IDE. The current version of Xcode at the time of this writing is 3.2.3, and it can beĀ downloaded for free from Apple. You do have to register an account if you don’t have one yet, but you don’t have to pay anything until you want to join the iPhone Developer Program. You can’t actually install anything on a mobile device until you subscribe, which mainly gives you a one year certificate that you use to sign your applications.

Simple Stub Creation with Mockito Partial Mocks

3 minute read Published:

When testing code that interacts with lower layers, I often stub out the lower layer to return objects to the code that I’m actually testing. I mostly use stubs generated by a mocking framework, but I occasionally come across cases where the stub needs to do something other than just return a known object. Take the case of a DAO that assigns a generated identifier to a domain object. Here we see a service that takes a name, creates a User object with it, persists the object and returns the generated id to the caller.