Selecting individual tests to run

5 views
Skip to first unread message

Matthew Flint

unread,
Mar 14, 2011, 8:30:08 AM3/14/11
to UISpec
Hello,

I've just started using UISpec, and wonder how I can select individual
tests to run?

I did see UISpecRunner - which I will investigate - but I think I was
imagining that something would appear in the simulator similar to the
GHUnit UI [1], where you can:

* select which tests run run
* see all passes/failures and console output
* re-run individual tests

Has anyone considered providing similar functionality for UISpec?

Cheers!
Matthew


[1] http://gabriel.github.com/gh-unit/

Rodney Degracia

unread,
Mar 14, 2011, 3:03:23 PM3/14/11
to uis...@googlegroups.com

Matthew,

Matthew,


You can tag a feature or groups of features and then use rake to specify to cucumber to only check the features that have the tags.

For example, create a Rakefile:

require 'rubygems'
require 'cucumber'
require 'cucumber/rake/task'

Cucumber::Rake::Task.new(:your_features_tag) do |t|
t.cucumber_opts = "features --format pretty --tags @your_features_tag"
end


In the relevant feature files, insert @your_features_tag at the top of the feature file.

Then to have cucumber verify those tagged features:
rake your_features_tag

Rodney

> --
> You received this message because you are subscribed to the Google Groups "UISpec" group.
> To post to this group, send email to uis...@googlegroups.com.
> To unsubscribe from this group, send email to uispec+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/uispec?hl=en.
>

Matthew Flint

unread,
Mar 16, 2011, 4:56:16 AM3/16/11
to UISpec
Thanks for your reply Rodney.

I was thinking more about traditional UISpec testing (with specs
written in Objective C) rather than a Ruby/Cucumber solution.

I spent an hour last night playing with TTNavigator [1] and UISpec and
think it would work well with the app I'm planning. It would be quite
possible to drive individual UISpec specs from the simulator itself,
in a similar way to how the GHUnit UI works.

(I'm pretty excited about this, and will report back if I have
anything to show, but would like to get a proof-of-concept first which
doesn't rely on TTNavigator)

Matthew


[1] http://three20.info/article/2010-10-06-URL-Based-Navigation

Blake Watters

unread,
Mar 16, 2011, 7:09:41 AM3/16/11
to uis...@googlegroups.com, UISpec
In our experience at Two Toasters doing functional tests that are written entirely in Obj-c and run within the app under test things begin to get really cumbersome. We've seen lots of painful sequencing issues and had trouble getting state reset completely between tests. Keeping a large suite clean became very time consuming. We have had a much easier time moving the specs Frank/Cucumber

Powered by iBlake!

Matthew Flint

unread,
Mar 17, 2011, 5:32:22 AM3/17/11
to UISpec
Thanks for taking the time to reply Blake.

I do understand the need to reset state reliably - but I was intending
to mock a lot of stuff below the ViewController level, so maintianing
state would be much less of an issue.

(Indeed, in order to use OCMock in the tests, the tests must run
within the app... because otherwise Frank/Cucumber can't possibly set
expectations on the mock object)

So my overall plan is:
1. clear separation between UI (Views and ViewControllers) and a
business tier (including CoreData managed objects)
2. test the UI (Views and ViewControllers) using UISpec, mocking
everything below the ViewControllers
3. test the business rules using GHUnit, with CoreData and networking
stuff mocked where possible

Pete Hodgson

unread,
Mar 17, 2011, 11:43:02 AM3/17/11
to uis...@googlegroups.com, Matthew Flint
Hi Matt,

I'm really interested in this hybrid approach using UISpec for low-level testing of the presentation layer and GHUnit for the rest. Sounds like it could be a nice solution. Please keep us updated on how it works out.

Cheers,
Pete

Matthew Flint

unread,
Mar 31, 2011, 7:42:30 PM3/31/11
to UISpec
OK, I've made a bit of progress, so it's probably time I set it
free...

https://github.com/mflint/RVUITests

This code, which could be a static library:
* discovers specs in a similar way to UISpec
* is integrated into an app in a similar way to UISpec
* presents them in a UI on the phone or simulator
* allows you to run individual specs (using UISpec)
* stores test results in a Core Data database, so...
* failures can easily be re-run

It's relatively immature (and there are some tweaks which would make
it much better), but I reckon it might have reached the point of being
vaguely useful.

Matthew
Reply all
Reply to author
Forward
0 new messages