Cukestyle plugin

Plugin that checks the compliance of BDD feature files (cucumber java) against configurable list of rules.

Лицензия

Лицензия

Категории

Категории

Maven Компиляция и сборка
Группа

Группа

com.github.saiprasadkrishnamurthy
Идентификатор

Идентификатор

cuke-style-maven-plugin
Последняя версия

Последняя версия

1.0
Дата

Дата

Тип

Тип

maven-plugin
Описание

Описание

Cukestyle plugin
Plugin that checks the compliance of BDD feature files (cucumber java) against configurable list of rules.
Ссылка на сайт

Ссылка на сайт

https://github.com/SaiprasadKrishnamurthy/cukestyle-maven-plugin
Система контроля версий

Система контроля версий

https://github.com/SaiprasadKrishnamurthy/cukestyle-maven-plugin

Скачать cuke-style-maven-plugin

Как подключить последнюю версию

<plugin>
    <groupId>com.github.saiprasadkrishnamurthy</groupId>
    <artifactId>cuke-style-maven-plugin</artifactId>
    <version>1.0</version>
</plugin>

Зависимости

compile (10)

Идентификатор библиотеки Тип Версия
org.codehaus.jackson : jackson-mapper-asl jar 1.9.13
org.slf4j : slf4j-simple jar 1.7.7
net.serenity-bdd : serenity-cucumber jar 1.0.15
info.cukes : gherkin jar 2.12.2
com.google.guava : guava jar 18.0
com.fasterxml.jackson.core : jackson-databind jar 2.5.4
org.apache.maven : maven-plugin-api jar 3.3.3
commons-io : commons-io jar 2.4
org.apache.maven : maven-project jar 3.0-alpha-2
org.reflections : reflections jar 0.9.10

test (2)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
org.hamcrest : hamcrest-all jar 1.3

Модули Проекта

Данный проект не имеет модулей.

CukeStyle Maven Plugin

This is a simple extensible cucumber feature files rules checker maven plugin. This currently only supports Cucumber (Java) as a Gherkin implementation. The rules are defined in a json file which is fed into the plugin for checking. More rules can be added in the future without modifying the existing rule implementations.

A sample rules json file would typically look like this.

[
  {
    "ruleId": "UNUSED_STEP_DEFS",
    "ruleDescription": "Number of unused Java step definitions",
    "ruleSeverity": "HIGH",
    "maxThreshold": 0
  },
  {
    "ruleId": "CONJUNCTIONS",
    "ruleDescription": "Number of conjunctions 'and' in a a step",
    "ruleSeverity": "HIGH",
    "minThreshold": 0,
    "maxThreshold": 5
  },
  {
    "ruleId": "EXAMPLES_LIMIT",
    "ruleDescription": "Number of examples in a data table",
    "ruleSeverity": "HIGH",
    "minThreshold": 0,
    "maxThreshold": 10
  }
]

The basic usage is to hook this plugin during the prepare-package phase (before the Functional Tests) are run and get a report of the issues (if any).

To hook this plugin into the pom of the functional tests, the following must be done.

        <plugin>
             <groupId>com.github.saiprasadkrishnamurthy</groupId>
             <artifactId>cuke-style-maven-plugin</artifactId>
             <version>1.0</version>
            <configuration>
                <rulesFilePath>rules.json</rulesFilePath>
                <baseStepDefsPackage>features.steps</baseStepDefsPackage>
                <baseFeatureFilesDir>target/test-classes</baseFeatureFilesDir>
            </configuration>
            <executions>
                <execution>
                    <id>check</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

All the configuration parameters are self explanatory.

An example table is output on the command line as a result of the checks

[INFO] --- cuke-style-maven-plugin:1.0-SNAPSHOT:check (check) @ ui-functional-tests ---
[INFO] Going to check the feature files against the rules: /Users/sai/ui-functional-tests/ui-functional-tests/rules.json
+------------------+----------+--------------------------------------------------------------------------------------------------------+
|       RULE       | SEVERITY |                                              ERROR_MESSAGE                                             |
+------------------+----------+--------------------------------------------------------------------------------------------------------+
|   EXAMPLES_LIMIT |     HIGH |                                                                      /footer.feature (Max allowed: 10) |
|   EXAMPLES_LIMIT |     HIGH |                                                                     /meganav.feature (Max allowed: 10) |
| UNUSED_STEP_DEFS |     HIGH |                   features.steps.CommonPageSteps::link_for_respective_address_should_be_displayed(...) |
| UNUSED_STEP_DEFS |     HIGH |                                         features.steps.CommonPageSteps::links_should_be_displayed(...) |
| UNUSED_STEP_DEFS |     HIGH |            features.steps.ProductDetailsLegacyPageSteps::i_add_a_product_to_the_localised_trolley(...) |
| UNUSED_STEP_DEFS |     HIGH | features.steps.ProductDetailsLegacyPageSteps::i_add_a_product_to_the_localised_OutOfStock_trolley(...) |
+------------------+----------+--------------------------------------------------------------------------------------------------------+

[INFO] Cukestyle Reports generated successfully in /Users/sai/ui-functional-tests/ui-functional-tests/target/cuckestyle_results.csv

For Rule Implementors

Every rule must have an unique ID defined in the "ruleId" field of the JSON. Once you have chosen the ID, you will just need to implement a new rule just by extending the DefaultRule.

All the wiring of the rules would happen automatically.

Версии библиотеки

Версия
1.0