Skip to content

Commit

Permalink
Merge pull request #133 from andrewesweet/master
Browse files Browse the repository at this point in the history
cucumber-jvm 5.x compatibility: feature ordering via tags and DocString enrichment via tags or content type
  • Loading branch information
rmpestano authored Apr 20, 2020
2 parents de43e60 + ca8c351 commit 9c06785
Show file tree
Hide file tree
Showing 28 changed files with 1,897 additions and 672 deletions.
125 changes: 120 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ Feature: Calculator

=== Feature ordering

To change the order features will be rendered in living documentation you can add `order comment`:
To change the order features will be rendered in living documentation you can add an `order comment` in cucumber-jvm 1.x only:

.ordererd.feature
.ordered.feature.comment
----
# order: 1
Feature: Calculator
Expand All @@ -253,6 +253,18 @@ Feature: Calculator
----

Or in cucumber-jvm 2.x and later, with an `order tag`:

.ordered.feature.tag
----
@order-1
Feature: Calculator
Scenario: Adding numbers
----


=== Enriching documentation

==== Asciidoc markup in comments
Expand Down Expand Up @@ -305,10 +317,20 @@ image::enrich.png[]

==== Asciidoc markup in DocStrings

You can use Asciidoc markup in https://www.relishapp.com/cucumber/cucumber/docs/gherkin/doc-strings[feature DocStrings], see feature below:
You can use Asciidoc markup in https://www.relishapp.com/cucumber/cucumber/docs/gherkin/doc-strings[feature DocStrings].
The Features below show the different ways of achieving this:

* Step comment `#cukedoctor-discrete` (cucumber-jvm 1.x only)
** Applies to all DocStrings in the commented step
* Content type `asciidoc`
** Must be applied to each DocString you wish to be enriched
* Feature tag `@asciidoc`
** Applies to all DocStrings in the tagged feature
* Scenario tag `@asciidoc`
** Applies to all DocStrings in the tagged scenario

----
Feature: Discrete class feature
Feature: Discrete class feature with step comment
Scenario: Render source code
Expand Down Expand Up @@ -336,6 +358,99 @@ public int sum(int x, int y){
| Cell in column 1, row 2 | Cell in column 2, row 2
| Cell in column 1, row 3 | Cell in column 2, row 3
|====
"""
Feature: Discrete class feature with content type
Scenario: Render source code
Given the following source code
"""asciidoc
[source, java]
-----
public int sum(int x, int y){
int result = x + y;
return result; <1>
}
-----
<1> We can have callouts in living documentation
"""
Scenario: Render table
Given the following table
"""asciidoc
|====
| Cell in column 1, row 1 | Cell in column 2, row 1
| Cell in column 1, row 2 | Cell in column 2, row 2
| Cell in column 1, row 3 | Cell in column 2, row 3
|====
"""
@asciidoc
Feature: Discrete class feature with feature tag
Scenario: Render source code
Given the following source code
"""
[source, java]
-----
public int sum(int x, int y){
int result = x + y;
return result; <1>
}
-----
<1> We can have callouts in living documentation
"""
Scenario: Render table
Given the following table
"""
|====
| Cell in column 1, row 1 | Cell in column 2, row 1
| Cell in column 1, row 2 | Cell in column 2, row 2
| Cell in column 1, row 3 | Cell in column 2, row 3
|====
"""
Feature: Discrete class feature with scenario tag
@asciidoc
Scenario: Render source code
Given the following source code
"""
[source, java]
-----
public int sum(int x, int y){
int result = x + y;
return result; <1>
}
-----
<1> We can have callouts in living documentation
"""
@asciidoc
Scenario: Render table
Given the following table
"""
|====
| Cell in column 1, row 1 | Cell in column 2, row 1
| Cell in column 1, row 2 | Cell in column 2, row 2
| Cell in column 1, row 3 | Cell in column 2, row 3
|====
"""
----
Expand All @@ -344,7 +459,7 @@ The docstrings will be rendered as follows:

image::discrete.png[]

IMPORTANT: By default Cukedoctor will render DocStrings as http://asciidoctor.org/docs/user-manual/\#listing-blocks[asciidoc listing^]. To enable this feature use *# cukedoctor-discrete* comment.
IMPORTANT: By default Cukedoctor will render DocStrings as http://asciidoctor.org/docs/user-manual/\#listing-blocks[asciidoc listing^]. Use the above mechanism to enable this feature.

=== *"Stepless"* documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.Objects;

/**
* Created by rafael-pestano on 01/07/2015.
*/
Expand Down Expand Up @@ -29,6 +31,10 @@ public void setContent_type(String value) {
this.content_type = value;
}

public boolean isDiscrete() {
return Objects.equals(content_type, "asciidoc");
}

@Override
public String toString() {
return value;
Expand Down
Loading

0 comments on commit 9c06785

Please sign in to comment.