cedarbdd / cedar

BDD-style testing using Objective-C
http://groups.google.com/group/cedar-discuss
1.19k stars 140 forks source link

Running Individual Specs #394

Closed alexvbush closed 8 years ago

alexvbush commented 8 years ago

Hey guys, how can I run individual specs with Cedar and not the whole test suite?

idoru commented 8 years ago

Hi @alexvbush,

You can do this by changing it()s to fit()

It also works for context() and describe()

As long as there is one fit/fcontext/fdescribe Cedar will only run those particular examples.

alexvbush commented 8 years ago

@idoru ha, interesting. So there's no way to specify what line in a spec file I want to run? I'm thinking of how rspec does it

tooluser commented 8 years ago

Line numbers change while you're working on a file. I think this was chosen because it's more reliable.

On Jun 30, 2016, at 11:57, Alex V Bush notifications@github.com wrote:

@idoru ha, interesting. So there's no way to specify what line in a spec file I want to run? I'm thinking of how rspec does it

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

tjarratt commented 8 years ago

Agreed, fit and fdescribe and fcontext were chosen because they can be done easily while looking at code. It is also possible to write tools that easily add / remove focus (even integrating with the Xcode editor so you can do this with a keyboard shortcut).

Do you have a strong preference for the rspec file name and line number pattern? I'm curious what you like about that system, since it's very different from Cedar (and other BDD frameworks like Gingko or Quick).

Sent From A Very Small Keyboard

On Jun 30, 2016, at 12:19, Joshua Marker notifications@github.com wrote:

Line numbers change while you're working on a file. I think this was chosen because it's more reliable.

On Jun 30, 2016, at 11:57, Alex V Bush notifications@github.com wrote:

@idoru ha, interesting. So there's no way to specify what line in a spec file I want to run? I'm thinking of how rspec does it

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

tooluser commented 8 years ago

I’ve been using rspec lately, pairing, and have seen at least three times this week where people weren’t testing what they thought because line numbers had changed.

I do like RSpec’s focus: ‘category_name’ and subsequent rspec —focus category_name, though. Can be handy.

Line numbers are implementation details.

tjarratt commented 8 years ago

How might the --focus categoryName pattern be ported to Cedar? That's a really interesting idea...

If each spec had a way of specifying it's "category" and we respected a CEDAR_FOCUS_CATEGORY env var... would that be helpful and useful?

Sent From A Very Small Keyboard

On Jun 30, 2016, at 15:39, Joshua Marker notifications@github.com wrote:

I’ve been using rspec lately, pairing, and have seen at least three times this week where people weren’t testing what they thought because line numbers had changed.

I do like RSpec’s focus: ‘category_name’ and subsequent rspec —focus category_name, though. Can be handy.

Line numbers are implementation details. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

alexvbush commented 8 years ago

Like numbers were super useful running a spec you're looking at from vim. The line number you're cursor is on was used to run specific test with rspec On Thu, Jun 30, 2016 at 3:47 PM Tim Jarratt notifications@github.com wrote:

How might the --focus categoryName pattern be ported to Cedar? That's a really interesting idea...

If each spec had a way of specifying it's "category" and we respected a CEDAR_FOCUS_CATEGORY env var... would that be helpful and useful?

Sent From A Very Small Keyboard

On Jun 30, 2016, at 15:39, Joshua Marker notifications@github.com wrote:

I’ve been using rspec lately, pairing, and have seen at least three times this week where people weren’t testing what they thought because line numbers had changed.

I do like RSpec’s focus: ‘category_name’ and subsequent rspec —focus category_name, though. Can be handy.

Line numbers are implementation details. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pivotal/cedar/issues/394#issuecomment-229810243, or mute the thread https://github.com/notifications/unsubscribe/AAS_JSUImgHfNlUxzXQ4dBofE37nnYygks5qREd6gaJpZM4JCW-3 .

tooluser commented 8 years ago

I wonder if you’ve seen cppforlife’s plugin that does exactly that, Tim? Runs the spec the cursor is in?

tjarratt commented 8 years ago

@tooluser yeah :)

I have been maintaining cppforlife's Xcode plugins, since he's moved on past iOS development. Now that Apple has deprecated the old, unofficial Xcode 7 plugin interface, I'm in the process of trying to port them to the Xcode 8 API (née XcodeKit).