Skip to content

Commit

Permalink
refs #76
Browse files Browse the repository at this point in the history
updates readme
  • Loading branch information
rmpestano committed Oct 24, 2016
1 parent d985b5c commit 06e2750
Show file tree
Hide file tree
Showing 11 changed files with 144 additions and 88 deletions.
12 changes: 7 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ____

image::cukedoctor-sample.png[]

The feature file for the above sample can be https://github.com/rmpestano/dbunit-rules/blob/master/cdi/src/test/resources/features/core/core-seed-database.feature[found here^].
The feature file for the above sample can be https://github.com/database-rider/database-rider/blob/master/rider-core/src/test/resources/features/rider-core/core-seed-database.feature[found here^].

Failing steps are rendered as follows:

Expand All @@ -71,6 +71,10 @@ Here are some bdd documentation examples generated by Cukedoctor:
|===
|Project | Living documentation

|https://github.com/database-rider/databae-rider[Database Rider^]
|https://database-rider.github.io/database-rider/#documentation


|https://github.com/asciidoctor/asciidoctor[Asciidoctor^]
|http://rmpestano.github.io/cukedoctor/asciidoctor/asciidoctor-documentation.html[html^] / http://rmpestano.github.io/cukedoctor/asciidoctor/asciidoctor-documentation.pdf[pdf^]

Expand All @@ -86,8 +90,6 @@ Here are some bdd documentation examples generated by Cukedoctor:
|https://github.com/sdkman/sdkman-cli[Sdkman^]
|http://rmpestano.github.io/cukedoctor/sdkman/sdkman-documentation.html[html^] / http://rmpestano.github.io/cukedoctor/sdkman/sdkman-documentation.pdf[pdf^]

|https://github.com/rmpestano/dbunit-rules[DBUnit Rules^]
|http://rmpestano.github.io/dbunit-rules/documentation.html[html^] / http://rmpestano.github.io/dbunit-rules/documentation.pdf[pdf^]

|===

Expand All @@ -99,9 +101,9 @@ Here are some bdd documentation examples generated by Cukedoctor:
If you use maven and execute your cucumber tests through maven you can use cukedoctor-maven plugin.
For more details see https://github.com/rmpestano/cukedoctor/tree/master/cukedoctor-maven-plugin[cukedoctor-maven-plugin].

=== Standalone jar
=== Standalone jar (a.k.a cli)

To use Cukedoctor as a standalone jar you can https://bintray.com/artifact/download/rmpestano/cukedoctor/com/github/cukedoctor/cukedoctor-main/1.0.4/cukedoctor-main-1.0.4.jar[download it here^]. For more details, see https://github.com/rmpestano/cukedoctor/tree/master/cukedoctor-main[cukedoctor-main].
To use Cukedoctor as a standalone jar you can https://bintray.com/artifact/download/rmpestano/cukedoctor/com/github/cukedoctor/cukedoctor-main/1.0.6/cukedoctor-main-1.0.6.jar[download it here^]. For more details, see https://github.com/rmpestano/cukedoctor/tree/master/cukedoctor-main[cukedoctor-main].

=== Converter

Expand Down
4 changes: 2 additions & 2 deletions cukedoctor-converter/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ This module is responsible for generating adoc files from .json cucumber executi
public void shouldSaveDocumentationIntoDisk(){
List<String> pathToCucumberJsonFiles = FileUtil.findJsonFiles("target/test-classes/json-output/");
List<Feature> features = FeatureParser.parse(pathToCucumberJsonFiles);
DocumentAttributes attrs = new DocumentAttributes();
DocumentAttributes attrs = DefaultConfig.getInstance().getDocumentAttributes;
attrs.toc("left").backend("html5")
.docType("book")
.icons("font").numbered(false)
.sectAnchors(true).sectLink(true);
.sectAnchors(true).sectLink(true);
CukedoctorConverter converter = Cukedoctor.instance(features, "Living Documentation", attrs);
converter.setFilename("/target/living_documentation.adoc");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

/**
* Created by pestano on 22/06/15.
* @deprecated use GlobalConfig
* @see GlobalConfig
*/
@Deprecated
public abstract class CukedoctorConfig {
public static final int ERROR_MESSAGE_SIZE = getProperty("ERROR_MESSAGE_SIZE",Integer.class) == null ? 400 : getProperty("ERROR_MESSAGE_SIZE",Integer.class);
public static final String DOCUMENT_TITLE= getProperty("DOCUMENT_TITLE") == null ? "Documentation" : getProperty("DOCUMENT_TITLE");
Expand All @@ -14,23 +17,23 @@ public abstract class CukedoctorConfig {

//lazy evaluation
public static Boolean hideSummarySection(){
return getProperty("HIDE_SUMMARY_SECTION") == null ? GlobalConfig.getInstance().isHideSummarySection() : Boolean.valueOf(getProperty("HIDE_SUMMARY_SECTION"));
return getProperty("HIDE_SUMMARY_SECTION") == null ? GlobalConfig.getInstance().getLayoutConfig().isHideSummarySection() : Boolean.valueOf(getProperty("HIDE_SUMMARY_SECTION"));
}

public static Boolean hideFeaturesSection(){
return getProperty("HIDE_FEATURES_SECTION") == null ? GlobalConfig.getInstance().isHideFeaturesSection() : Boolean.valueOf(getProperty("HIDE_FEATURES_SECTION"));
return getProperty("HIDE_FEATURES_SECTION") == null ? GlobalConfig.getInstance().getLayoutConfig().isHideFeaturesSection() : Boolean.valueOf(getProperty("HIDE_FEATURES_SECTION"));
}

public static Boolean hideStepTime(){
return getProperty("HIDE_STEP_TIME") == null ? GlobalConfig.getInstance().isHideStepTime() : Boolean.valueOf(getProperty("HIDE_STEP_TIME"));
return getProperty("HIDE_STEP_TIME") == null ? GlobalConfig.getInstance().getLayoutConfig().isHideStepTime() : Boolean.valueOf(getProperty("HIDE_STEP_TIME"));
}

public static Boolean hideScenarioKeyword(){
return getProperty("HIDE_SCENARIO_KEYWORD") == null ? GlobalConfig.getInstance().isHideScenarioKeyword() : Boolean.valueOf(getProperty("HIDE_SCENARIO_KEYWORD"));
return getProperty("HIDE_SCENARIO_KEYWORD") == null ? GlobalConfig.getInstance().getLayoutConfig().isHideScenarioKeyword() : Boolean.valueOf(getProperty("HIDE_SCENARIO_KEYWORD"));
}

public static Boolean hideTags(){
return getProperty("HIDE_TAGS") == null ? GlobalConfig.getInstance().isHideTags() : Boolean.valueOf(getProperty("HIDE_TAGS"));
return getProperty("HIDE_TAGS") == null ? GlobalConfig.getInstance().getLayoutConfig().isHideTags() : Boolean.valueOf(getProperty("HIDE_TAGS"));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,7 @@ public class GlobalConfig {

private DocumentAttributes documentAttributes;

private boolean hideFeaturesSection;

private boolean hideSummarySection;

private boolean hideStepTime;

private boolean hideScenarioKeyword;

private boolean hideTags;

private LayoutConfig layoutConfig;

private GlobalConfig() {

Expand Down Expand Up @@ -59,23 +50,6 @@ private static GlobalConfig createInstance() {
return globalConfig;
}


public boolean isHideSummarySection() {
return hideSummarySection;
}

public void setHideSummarySection(boolean hideSummarySection) {
this.hideSummarySection = hideSummarySection;
}

public boolean isHideFeaturesSection() {
return hideFeaturesSection;
}

public void setHideFeaturesSection(boolean hideFeaturesSection) {
this.hideFeaturesSection = hideFeaturesSection;
}

public DocumentAttributes getDocumentAttributes() {
return documentAttributes;
}
Expand All @@ -84,27 +58,11 @@ public void setDocumentAttributes(DocumentAttributes documentAttributes) {
this.documentAttributes = documentAttributes;
}

public boolean isHideStepTime() {
return hideStepTime;
}

public void setHideStepTime(boolean hideStepTime) {
this.hideStepTime = hideStepTime;
}

public boolean isHideScenarioKeyword() {
return hideScenarioKeyword;
}

public void setHideScenarioKeyword(boolean hideScenarioKeyword) {
this.hideScenarioKeyword = hideScenarioKeyword;
}

public boolean isHideTags() {
return hideTags;
public LayoutConfig getLayoutConfig() {
return layoutConfig;
}

public void setHideTags(boolean hideTags) {
this.hideTags = hideTags;
public void setLayoutConfig(LayoutConfig layoutConfig) {
this.layoutConfig = layoutConfig;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.github.cukedoctor.config;

/**
* Created by pestano on 23/10/16.
*
* Documentation layout configuration
*/
public class LayoutConfig {

private boolean hideFeaturesSection;

private boolean hideSummarySection;

private boolean hideStepTime;

private boolean hideScenarioKeyword;

private boolean hideTags;

public boolean isHideFeaturesSection() {
return hideFeaturesSection;
}

public void setHideFeaturesSection(boolean hideFeaturesSection) {
this.hideFeaturesSection = hideFeaturesSection;
}

public boolean isHideSummarySection() {
return hideSummarySection;
}

public void setHideSummarySection(boolean hideSummarySection) {
this.hideSummarySection = hideSummarySection;
}

public boolean isHideStepTime() {
return hideStepTime;
}

public void setHideStepTime(boolean hideStepTime) {
this.hideStepTime = hideStepTime;
}

public boolean isHideScenarioKeyword() {
return hideScenarioKeyword;
}

public void setHideScenarioKeyword(boolean hideScenarioKeyword) {
this.hideScenarioKeyword = hideScenarioKeyword;
}

public boolean isHideTags() {
return hideTags;
}

public void setHideTags(boolean hideTags) {
this.hideTags = hideTags;
}
}
11 changes: 6 additions & 5 deletions cukedoctor-converter/src/main/resources/config/cukedoctor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
hideFeaturesSection: false
hideSummarySection: false
hideStepTime: false
hideScenarioKeyword: false
hideTags: false
layoutConfig:
hideFeaturesSection: false
hideSummarySection: false
hideStepTime: false
hideScenarioKeyword: false
hideTags: false
documentAttributes:
docTitle: "Living Documentation"
backend: "html5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public static void loadFeatures() {

@Before
public void initProperties() {
System.setProperty("HIDE_STEP_TIME", GlobalConfig.getInstance().isHideStepTime() + "");
System.setProperty("HIDE_FEATURES_SECTION", GlobalConfig.getInstance().isHideFeaturesSection() + "");
System.setProperty("HIDE_SUMMARY_SECTION", GlobalConfig.getInstance().isHideSummarySection() + "");
System.setProperty("HIDE_SCENARIO_KEYWORD", GlobalConfig.getInstance().isHideScenarioKeyword() + "");
System.setProperty("HIDE_TAGS", GlobalConfig.getInstance().isHideTags() + "");
System.setProperty("HIDE_STEP_TIME", GlobalConfig.getInstance().getLayoutConfig().isHideStepTime() + "");
System.setProperty("HIDE_FEATURES_SECTION", GlobalConfig.getInstance().getLayoutConfig().isHideFeaturesSection() + "");
System.setProperty("HIDE_SUMMARY_SECTION", GlobalConfig.getInstance().getLayoutConfig().isHideSummarySection() + "");
System.setProperty("HIDE_SCENARIO_KEYWORD", GlobalConfig.getInstance().getLayoutConfig().isHideScenarioKeyword() + "");
System.setProperty("HIDE_TAGS", GlobalConfig.getInstance().getLayoutConfig().isHideTags() + "");
}


Expand Down
31 changes: 26 additions & 5 deletions cukedoctor-main/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public void shouldRenderHtmlForOneFeature(){
"-t", "Living Documentation", <3>
"-f", "html", <4>
"-toc", "left", <5>
"-numbering", "true" <6>
"-numbering", "true", <6>
"-sourceHighlighter"
});
File generatedFile = FileUtil.loadFile("target/document-one.html");
Expand All @@ -42,6 +43,8 @@ java -jar cukedoctor-main.jar
-o "target/document-one"
-p "target/test-classes/json-output/one_passing_one_failing.json"
-t "Living Documentation" -f html
-hideSummarySection
-hideScenarioKeyword
----

=== Maven exec plugin
Expand Down Expand Up @@ -81,12 +84,30 @@ You can disable https://github.com/rmpestano/cukedoctor/tree/master/cukedoctor-e

----
java -jar -Dcukedoctor.disable.filter=123 -Dcukedoctor.disable.theme=abc
cukedoctor-main-1.0.2.jar
cukedoctor-main-1.0.6.jar
-p cucumber-output.json
----

You can download Cukedoctor main https://bintray.com/artifact/download/rmpestano/cukedoctor/com/github/cukedoctor/cukedoctor-main/1.0.2/cukedoctor-main-1.0.2.jar[jar here^]
You can download Cukedoctor main https://bintray.com/artifact/download/rmpestano/cukedoctor/com/github/cukedoctor/cukedoctor-main/1.0.6/cukedoctor-main-1.0.6.jar[jar here^]

== Hide Features and Summary
== Layout configuration

You can hide 'Features' and 'Summary' sections, to do so just specify `-hideFeaturesSection` or `-hideSummarySection` parameters.
Some pieces of documentation can be hidden via configuration.

You can hide `Features` and `Summary` sections, as well as `scenario keyword` which prefixes each scenario and hide `tags` or `step time`. To do so just specify the following arg parameters respectively:

----
java -jar -Dcukedoctor.disable.filter=123 -Dcukedoctor.disable.theme=abc
cukedoctor-main-1.0.6.jar
-p cucumber-output.json
-hideFeaturesSection <1>
-hideSummarySection <2>
-hideScenarioKeyword <3>
-hideStepTime <4>
-hideTags <5>
----
<1> Removes `Features` section so each feature is a section instead of a sub section of `Features`;
<2> Removes summary section
<3> Removes `scenario` keyword which prefixes each scenario;
<4> Removes step time calculation on each step;
<5> Removes tags rendering;
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public void setup() {
newOut = new PrintStream(baos);
defaultOut = System.out;
System.setOut(newOut);
System.setProperty("HIDE_FEATURES_SECTION", Boolean.toString(GlobalConfig.getInstance().isHideFeaturesSection()));
System.setProperty("HIDE_SUMMARY_SECTION", Boolean.toString(GlobalConfig.getInstance().isHideSummarySection()));
System.setProperty("HIDE_SCENARIO_KEYWORD", Boolean.toString(GlobalConfig.getInstance().isHideScenarioKeyword()));
System.setProperty("HIDE_STEP_TIME", Boolean.toString(GlobalConfig.getInstance().isHideStepTime()));
System.setProperty("HIDE_TAGS", Boolean.toString(GlobalConfig.getInstance().isHideTags()));
System.setProperty("HIDE_FEATURES_SECTION", Boolean.toString(GlobalConfig.getInstance().getLayoutConfig().isHideFeaturesSection()));
System.setProperty("HIDE_SUMMARY_SECTION", Boolean.toString(GlobalConfig.getInstance().getLayoutConfig().isHideSummarySection()));
System.setProperty("HIDE_SCENARIO_KEYWORD", Boolean.toString(GlobalConfig.getInstance().getLayoutConfig().isHideScenarioKeyword()));
System.setProperty("HIDE_STEP_TIME", Boolean.toString(GlobalConfig.getInstance().getLayoutConfig().isHideStepTime()));
System.setProperty("HIDE_TAGS", Boolean.toString(GlobalConfig.getInstance().getLayoutConfig().isHideTags()));

}

Expand Down
20 changes: 16 additions & 4 deletions cukedoctor-maven-plugin/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Just declare the plugin in your _pom.xml_:
<plugin>
<groupId>com.github.cukedoctor</groupId>
<artifactId>cukedoctor-maven-plugin</artifactId>
<version>1.0.2</version>
<version>1.0.6</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -51,7 +51,7 @@ NOTE: *plugin* option replaced *format* option which was deprecated in newer cuc
<plugin>
<groupId>com.github.cukedoctor</groupId>
<artifactId>cukedoctor-maven-plugin</artifactId>
<version>1.0.2</version>
<version>1.0.6</version>
<configuration>
<outputFileName>documentation</outputFileName> <1>
<outputDir>docs</outputDir> <2>
Expand Down Expand Up @@ -130,11 +130,23 @@ mvn cukedoctor:execute
|

|hideSummarySection
|When present, this flag hides 'Summary' section
|When present, this flag hides `Summary` section
|

|hideFeaturesSection
|When present, this flag hides 'Features' section
|When present, this flag hides `Features` section
|

|hideScenarioKeyword
|When present, this flag `Scenario` (and `scenario outline`) keyword which prefixes each scenario;
|

|hideStepTime
|When present, this flag hides `step time` calculation on each step;
|

|hideTags
|When present, this flag hides `tags` rendering
|

|===
Expand Down
Loading

0 comments on commit 06e2750

Please sign in to comment.