2

When doing bdd/testing with JBehave/Thucydides I would like to skip certain scenarios that I know are working temporarily. Eventually, I want to re run the whole test suite. However, as I am developing, re-running old tests just to get to new tests I have written takes too much time.

Here is an example of what I am talking about:

loggingIn.story:

Scenario: logging in as customer
...

Scenario: logging in as admin
...

I know first scenario works, how can I skip it instead of regoing through it when I run the story using JUnit?

From the JBehave website links Meta Info, Meta Filtering

I gathered I could do something as follows:

loggingIn.story:

Scenario: logging in as customer
Meta:
@ignored true
...

Scenario: logging in as admin
Meta:
@ignored false
...

Then when running the test as a JUnit test case, I passed a jvm argument as follows: -Dmetafilter="+ignored".

However, this skips both scenarios instead of just the first.

spcial
  • 1,529
  • 18
  • 40
fgharo91
  • 225
  • 1
  • 3
  • 11
  • You want to skip them forever? Or until a certain point in time? How would JUnit know when to start testing them again? – Nathan Merrill Jul 29 '15 at 20:29
  • I edited my post to clarify. I want to skip them temporarily. JUnit would know to start testing them again when I remove the meta filters I suppose. I don't know too much about the meta filters is why I am asking. – fgharo91 Jul 29 '15 at 20:35

2 Answers2

2

I opened a same question some days before because I had a similar question. However your argument Dmetafilter="+ignored" means that all scenarios with the meta tag @ignored will be executed. You don't have to use true or false after @ignored. If you want to skip all scenarios with the meta tag @ignored you have to use Dmetafilter="-ignored".

I am using something similiar like -Dmetafilter="+run -norun". This means that all sceanrios with the tag @run will be executed and all scenarios with @norun will be skipped (I know, you usually need only one of them but that makes it more clearer for me in the scenarios which should run and which not).

EDIT:

So a example would be:

Szenario: Validation of something
Meta:
@norun
Given ...
spcial
  • 1,529
  • 18
  • 40
  • Hmm I did something now that makes your answer not totally true. I have all my tests annotated with @skip and I am passing the jvm as -Dmetafilter="+skip" so I expected all them to be executed but it skipped all of them. – fgharo91 Jul 30 '15 at 16:57
  • That is strange. Do you have any space characters or something like that? I'm regularly using these meta parameters in my maven run configuration as a goal (e.g. `clean verify serenity:aggregate -Dmetafilter="+category:one"` , in this case all scenarios with tag `@category:one` will be executed others will be skipped and it works fine for me). You can also read it here: http://jbehave.org/reference/stable/meta-filtering.html `where [+|-] indicates if the filter should include or exclude the meta property and [...]` – spcial Jul 31 '15 at 06:18
2

Most of the Jbehave examples I have looked at make use of the Skip metadata to do what you are proposing.

Scenario: logging in as admin
Meta:
@skip
Given ...

Your filter then looks like -Dmetafilter="-skip". You do not need to have on/off values. If it has a skip meta value of then it will be skipped.

Brian S.
  • 363
  • 1
  • 14