Package io.cucumber.query
Class NamingStrategy
- java.lang.Object
-
- io.cucumber.query.NamingStrategy
-
- All Implemented Interfaces:
LineageReducer<String>
public abstract class NamingStrategy extends Object implements LineageReducer<String>
NamesPicklesand other elements in aGherkinDocument.Pickles in a Gherkin document have a name. But represented without the structure of a Gherkin document (e.g. in a flat xml report), these names can lose their meaning. The long naming strategy solves this problem by prefixing an elements name with the names of all its ancestors, optionally including the feature name.
Furthermore, Pickles derived from an example can be named in three ways. Either by their example number (e.g.
Example #3.14) or by their pickle name. If a parameterized pickle name is used, a combination of both can be used.
With the long strategy, using example numbers and the pickle if parameterized, the pickles in this example would be named:Feature: Examples Tables Scenario Outline: Eating <eat> cucumbers Given there are <start> cucumbers When I eat <eat> cucumbers Then I should have <left> cucumbers Examples: These are passing | start | eat | left | | 12 | 5 | 7 | | 20 | 6 | 14 | Examples: These are failing | start | eat | left | | 12 | 20 | 0 | | 0 | 1 | 0 |- Examples Tables - Eating <eat> cucumbers - These are passing - #1.1: Eating 5 cucumbers
- Examples Tables - Eating <eat> cucumbers - These are passing - #1.2: Eating 6 cucumbers
- Examples Tables - Eating <eat> cucumbers - These are failing - #2.1: Eating 20 cucumbers
- Examples Tables - Eating <eat> cucumbers - These are failing - #2.2: Eating 1 cucumbers
And with the short strategy, using pickle names:
- Eating 5 cucumbers
- Eating 6 cucumbers
- Eating 20 cucumbers
- Eating 1 cucumbers
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNamingStrategy.Builderstatic classNamingStrategy.ExampleNamestatic classNamingStrategy.FeatureNamestatic classNamingStrategy.Strategy-
Nested classes/interfaces inherited from interface io.cucumber.query.LineageReducer
LineageReducer.Collector<T>
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static NamingStrategy.Builderstrategy(NamingStrategy.Strategy strategy)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.cucumber.query.LineageReducer
reduce, reduce
-
-
-
-
Method Detail
-
strategy
public static NamingStrategy.Builder strategy(NamingStrategy.Strategy strategy)
-
-