The full documentation is at GitHub - atdd-bdd/GherkinExecutorBase: This is the base for Gherkin Executor containing Documentation and Examples
You can see an example of a featurex file at:
https://github.com/atdd-bdd/GherkinExecutorForJava/blob/main/src/test/java/examples.featurex
The generated code, as well as the altered glue file are in this directory:: GherkinExecutorForJava/src/test/java/gherkinexecutor/Feature_Examples at main · atdd-bdd/GherkinExecutorForJava · GitHub
To install a Gherkin Executor for your project:
-
Create a new project (or use existing one)
-
Copy
Translateinto the project structure (e.g.src/main/java/gherkinexecutor) -
Create a
src/test/javadirectory if it does not already exist- Or alter
public static final String featureSubDirectory = "src/test/java/";
- Or alter
-
Copy
starting.featurexinto that`directory -
Alter ``public static final String testFramework = "JUnit5"`;to whatever test framework you are using
-
Execute
Translate.javawithstarting.featurexas an argument.
You should see a new directory test/java/gherkinexecutor/Feature_Starting
In that directory, there are four files.
-
The tests are in
Feature_Starting.java -
You need to rename
Feature_Starting_glue.tmpltoFeature_Starting_glue.java. This is the file you will alter to call the production code. -
Run the tests in
Feature_Starting.java -
They should all fail. Create a temperature convertor and alter the glue code to call it.
You can try the application out as a whole or just start using it (as above)
Once you have downloaded the files for either IDE, if you are using a test framework other than JUnit5, you will need to change the following in Configuration.
public static final String testFramework = "JUnit5"; // Could be "JUnit4" or "TestNG"
-
Clone the
GherkinExecutorForJavaproject from https://github.com/atdd-bdd/GherkinExecutorForJava. -
You will see only one file
Translate.javain the gherkinexecutor package.
This file contains all the classes required for translation. -
Run the
Feature_Examples.java file in thegherkinexecutor.Feature_Eaamplespackage. You should see that it successfully runs
four tests, two of which are listed above. ExamineFeature_Examples_glue.javaand see how the glue code calls the production code. -
You can also run
Feature_tic_tac_toein thegherkinexecutor.Feature_Tic_Tac_Toe. -
If you are able to clone, just copy the
Translate.javaandsimple_test.featurexfiles into your project.
-
Create a new project.
-
Download the `GherkinExecutorForJavaForEclipse.zip file from https://github.com/atdd-bdd/GherkinExecutorForJava.
-
Unzip this file into the project you created.
-
You will see only one file
Translate.javain themain.java.gherkinexecutorpackage. This file contains all the classes required for translation. -
Run the
Feature_Examples.java file in thetest.java.gherkinexecutor.Feature_Eaamplespackage. You should see that it successfully runs four tests, two of which are listed above. ExamineFeature_Examples_glue.javaand see how the glue code calls the production code. -
You can also run
Feature_tic_tac_toein thetest.java. gherkinexecutor.Feature_Tic_Tac_Toe. -
There are slight differences between the
Translate.java for IntelliJand forEclipse. (The package names need to include the directory and there is a difference in escape characters for the JSON methods).
OK, the proof is in the pudding. Let's apply Gherkin Executor to your problem.
First, the setup.
-
Create a package "gherkinexecutor" in your project test directory.
-
Copy the
Translatefile from the GherkinExecutor source to your project.
If you wish, you could move the Configuration class into a different file in the gherkinexecutor package. -
Copy one of the files (say simple_test.featurex) into the test directory.
It is specified by the Configuration value. If you want to use a different directory, then change this value. -
Make sure the Java version is at least 15.
public static final String featureSubDirectory = "src/test/java/";
GherkinExecutor can search for all feature files in the directory tree starting with:
public static final String startingFeatureDirectory = featureSubDirectory; // where the directory tree of features is to be found.
So, the feature file should be translated. However, you can also put the name as a program argument to the run
(or add it to the file list in Configuration, e.g.)