Test Driven Development with Automator Actions

//Test Driven Development with Automator Actions

Test Driven Development with Automator Actions

Wether you wonna start with
TDD on a existing code base or right from the beginning of your project means also checking for all your IBOutlets to be connected in your view controllers. If you have a bunch of outlets, generating the test methods is a somewhat boring task.
The files attached are automator actions. Just copy it to your ~/Library/Services folder and it will be available in Xcode as a service.

Note that the test methods are based using Jon Reid’s excellent OCHamcrest/OCMockito frameworks.

They all work the same way. Select a single word or a bunch of property definition lines. Right click and select the service you need. If you select a line the automator action automatically skips all lines where a certain key (e.g. UIButton, UIBarButton) couldn’t be found. The generated test are copied to the clipboard.
You can easily generate new services by editing the apple script included in the automator action. Follow the guidelines at the beginning of each script and you save a lot of time.
The included test are good for

  1. The property has a delegate which must be connect to the system under test
  2. The property is a UIBarButtonItem with an action connected. Note that you have to fill in the action method!
  3. The property is an IBOutlet which should be connected
  4. The property is a UIButton with an action connected. Note that you have to fill in the action method!

 

Download Generate Test For Delegate Is Set To SUT

 

Download Generate Test For UIBarButtonItem Action

 

Download Generate Test For IBOutlet Connected

 

Download Generate Test For UIButton Action

 

By |2018-06-06T20:31:48+00:00Mittwoch, Juli 17th, 2013|Test Driven Development|0 Comments

About the Author:

Leave A Comment

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.