mauriciotogneri / green-coffee

Green Coffee
MIT License
231 stars 21 forks source link

Run Specific feature file #16

Closed PankajNalawade closed 6 years ago

PankajNalawade commented 6 years ago

Hi how can I run specific feature file or scneario.

Example:

Scenario1: Test1

Scenario2: Test2

In above case I would like to run only scenario 2 using some tag system, how can I achieve the same?

mauriciotogneri commented 6 years ago

Hi,

Here in the wiki you have a good explanation on how to define tests:

https://github.com/mauriciotogneri/green-coffee/wiki/Test-definition

Let me know if you have more questions.

PankajNalawade commented 6 years ago

Hi @mauriciotogneri ,

Thanks for the solution.

But can't I run all the feature files by providing tag only once somewhere above feature.

Currently to run 2 scenarios I have to put the tag for both as shown below.

Feature: Test something

@TestSuite Scenario1: Test 1

@TestSuite Scenario2: Test2

But if I want to achieve something like below.

@TestSuite Feature: Test something

Scenario1: Test 1

Scenario2: Test2

Then what could be the solution?

mauriciotogneri commented 6 years ago

Hi @PankajNalawade,

I understand now what you mean. Unfortunately, for the moment tags are used in the library to filter scenarios within a feature. You can place a tag on top of a feature but it won't cause any effect.

Because of how the library is done, when you create a GreenCoffeeConfig you can only specify one feature. Therefore, adding a tag at a feature level will provoke to either run all the scenarios or none of them. In that case you can decide instead to run that entire feature or not.

AleksanderMielczarek commented 6 years ago

Actually there is a way to run specific test. I needed to use GreenCoffee together with Android Test Orchestrator which is incompatible with Parameterized tests so I did small annotation processor:

https://github.com/AleksanderMielczarek/GreenCoffeeProcessor.

It will create new class with one test for every scenario.