RACCommunity / Rex

ReactiveCocoa Extensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test UIKit extensions

neilpa opened this issue · comments

Is there any thoughts on this issue? How it needs to be done?

As I understand it could be comlpeted using functional testing. For example we want to test rex_action of the UIBarButton, so we create an UIBarButtonItem instance, then attach CocoaAction to this button. After that we check that target/action stored properly, and state changed to enabled, according to the behaviour of this function. Is it enough for such extensions tests?

Another option is to use Automation and perform tests that will check UI side also, not only property's changes.

@skyylex Functional/behavioral testing is what I was thinking. I don't want to enter the realm of UI automation testing.

@neilpa, I have one question related to the testing of the UIBarButtonItem rex_action:. To perform rex_action: internals UIBarButtonItem instance needs to be pressed. This press could be simulated programmatically, the only way I know that could be done is using the following line:

UIApplication.sharedApplication().sendAction(barButtonItem.action, to:barButtonItem.target, from:self, forEvent:nil)

And there is a problem here. To create .sharedApplication() test target needs to have filled Host Application setting. And this will affect the whole process of testing. Each test launch will rise iOS Simulator.

What do you think about it?

@skyylex Lets skip that one for now, I don't want to restart the simulator for each test.

@neilpa, I've added some of the UI tests in #59. Please review.