This project is read-only.

skipping scenarios

Oct 18, 2012 at 12:16 PM

Is it possible to skip scenarios. So in the e.g. below to skip scenario 1?

 

Background: 

Given I am logged in as "me"

Scenario :1

Given

And

When

Then

 

Scenario:

Given

And

When

Then

Oct 18, 2012 at 9:08 PM

Yes its possible, you use tags.
You need to be running a new-ish build, for example the 0.6 pre-release on nuget.
We have implemented it to be practically the same as cucumber (docs).

So If we add tags to your example like this

Background:
Given I am logged in as "me"

@tag1 @tag2
Scenario :1
Given
....

@tag2 @tag3
Scenario:
Given
....

1. Run all scenarios with @tag1
nbehave-console steps.dll /sf=theFeature.feature --tags:@tag1

2. Run all scenarios with @tag1 OR @tag2
nbehave-console steps.dll /sf=theFeature.feature --tags:@tag1,@tag2

3. Run all scenarios with @tag1 AND @tag2
nbehave-console steps.dll /sf=theFeature.feature --tags:@tag1 --tags:@tag2

4. Run all scenarios that doesnt have tag3
nbehave-console steps.dll /sf=theFeature.feature --tags:~@tag3

Oct 19, 2012 at 8:13 AM
Is there more docs, I need to learn more about the background clause

- Sent from my HTC on 3 -

----- Reply message -----
From: "lazydev" <notifications@codeplex.com>
To: [email removed]
Subject: skipping scenarios [NBehave:399880]
Date: Thu, Oct 18, 2012 9:08 pm


From: lazydev

Yes its possible, you use tags.
You need to be running a new-ish build, for example the 0.6 pre-release on nuget.
We have implemented it to be practically the same as cucumber (docs). So If we add tags to your example like this Background:
Given I am logged in as "me" @tag1 @tag2
Scenario :1
Given
.... @tag2 @tag3
Scenario:
Given
.... 1. Run all scenarios with @tag1
nbehave-console steps.dll /sf=theFeature.feature --tags:@tag1 2. Run all scenarios with @tag1 OR @tag2
nbehave-console steps.dll /sf=theFeature.feature --tags:@tag1,@tag2 3. Run all scenarios with @tag1 AND @tag2
nbehave-console steps.dll /sf=theFeature.feature --tags:@tag1 --tags:@tag2 4. Run all scenarios that doesnt have tag3
nbehave-console steps.dll /sf=theFeature.feature --tags:~@tag3

Oct 19, 2012 at 9:26 AM

I'm behind with the documentation :-(
Until I have updated nbehave's documentation, you can usually look at cucumbers documentation about the Gherkin syntax.

Syntax for background is like a scenario. The difference is that a background (with its steps) are run before each scenario.

Ex:
Feature: X

Background
   Given A
   Given B

Scenario: foo
  Given CC
  When DD
  Then EE

Scenario: bar
  Given MM
  When NN
  Then OO

If you run the above the execution order of all steps are:

Given A
Given B
Given CC
When DD
Then EE

Given A
Given B
Given MM
When NN
Then OO

I hope this helps.

Oct 19, 2012 at 9:36 AM
I appreciate all your help thank you

On 19 October 2012 09:26, lazydev <notifications@codeplex.com> wrote:

From: lazydev

I'm behind with the documentation :-(
Until I have updated nbehave's documentation, you can usually look at cucumbers documentation about the Gherkin syntax.

Syntax for background is like a scenario. The difference is that a background (with its steps) are run before each scenario.

Ex:
Feature: X

Background
Given A
Given B

Scenario: foo
Given CC
When DD
Then EE

Scenario: bar
Given MM
When NN
Then OO

If you run the above the execution order of all steps are:

Given A
Given B
Given CC
When DD
Then EE

Given A
Given B
Given MM
When NN
Then OO

I hope this helps.

Read the full discussion online.

To add a post to this discussion, reply to this email (NBehave@discussions.codeplex.com)

To start a new discussion for this project, email NBehave@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Mar 26, 2013 at 3:11 PM
Never really managed to get this working. If i am using an embedded runner e.g. Resharper, how do i declare this inside a void?
Mar 26, 2013 at 3:34 PM
Never really managed to get this working. If i am using an embedded runner e.g. Resharper, how do i declare this inside a void?
Mar 26, 2013 at 3:34 PM
Never really managed to get this working. If i am using an embedded runner e.g. Resharper, how do i declare this inside a void?
Mar 28, 2013 at 9:41 AM
Edited Mar 28, 2013 at 10:01 AM
I'm not following you, is it tags or backgrounds you cant get to work? or both?

To use the embedded runner se here.
To use the R# runner please use the latest (0.6.2), In 0.6.1 i screwed up the installer :-(
Mar 28, 2013 at 9:48 AM

Sorry I wasn't really clear I meant tags

Wondy

Mar 28, 2013 at 10:06 AM
To skip running scenarios/features using tags you have to use the console runner.

With R# you could perhaps create a test session with only the scenarios you want to run?