[fusion_builder_container hundred_percent=“yes“ overflow=“visible“][fusion_builder_row][fusion_builder_column type=“1_1″ background_position=“left top“ background_color=““ border_size=““ border_color=““ border_style=“solid“ spacing=“yes“ background_image=““ background_repeat=“no-repeat“ padding=““ margin_top=“0px“ margin_bottom=“0px“ class=““ id=““ animation_type=““ animation_speed=“0.3″ animation_direction=“left“ hide_on_mobile=“no“ center_content=“no“ min_height=“none“][fusion_dropcap]W[/fusion_dropcap]ether you wonna start with [/fusion_builder_column][fusion_builder_column type=“1_1″ background_position=“left top“ background_color=““ border_size=““ border_color=““ border_style=“solid“ spacing=“yes“ background_image=““ background_repeat=“no-repeat“ padding=““ margin_top=“0px“ margin_bottom=“0px“ class=““ id=““ animation_type=““ animation_speed=“0.3″ animation_direction=“left“ hide_on_mobile=“no“ center_content=“no“ min_height=“none“][fusion_highlight color=“yellow“]TDD[/fusion_highlight] 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.

[fusion_fontawesome icon=“circle-arrow-right“ circle=“no“ size=“medium“/]

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!

 

[fusion_button color=“green“ size=“small“ link=“http://www.berndrabe.de/wp-content/uploads/2013/07/GenerateTestForDelegateIsSetToSUT.zip“ target=“_blank“]Download Generate Test For Delegate Is Set To SUT[/fusion_button]

 

[fusion_button color=“green“ size=“small“ link=“http://www.berndrabe.de/wp-content/uploads/2013/07/GenerateTestForUIBarButtonItemAction.zip“ target=“_blank“]Download Generate Test For UIBarButtonItem Action[/fusion_button]

 

[fusion_button color=“green“ size=“small“ link=“http://www.berndrabe.de/wp-content/uploads/2013/07/GenerateTestForIBOutletConnected1.zip“ target=“_blank“]Download Generate Test For IBOutlet Connected[/fusion_button]

 

[fusion_button color=“green“ size=“small“ link=“http://www.berndrabe.de/wp-content/uploads/2013/07/GenerateTestForUIButtonAction.zip“ target=“_blank“]Download Generate Test For UIButton Action[/fusion_button]

 [/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]