Branko Juric edited this page Nov 17, 2018 · 109 revisions

Gwen logo Gwen FAQ

See also:

What is Gwen?

Gwen is a behavior driven automation tool. It is a Gherkin interpreter that accepts behavioral specifications as input and produces automation instructions as output.

What does Gwen do?

Gwen automates things like repetitive web interactions, robotic processes and more.

Is Gwen codeless?

Gwen is mostly codeless but it does however allow you to craft and execute JavaScript for those unique and special cases that fully codeless solutions miss and don't cater for. And there are always such cases in automation.

What is an evaluation engine?

An evaluation engine defines the DSL used to execute features and drive automation.

What engines are available?

Currently, the Gwen-web engine is available. We intend to build and share more engines.

How do I develop a new engine?

See our development guide for a quick introduction and tutorial on building new engines.

Why would I use Gwen over other tools?

  • Automation is driven by plain text features
  • Engines prescribe executable DSLs so you don't have to develop and compile code
  • Gwen is simple to use and has a REPL console. You only need a Java runtime, a text editor, and the command line to use it.
  • Meta features eliminate redundancies and allow you to be as imperative or as declarative as you like in your approach to writing features
  • Step definitions can be composed in a declarative manner
  • Many execution modes are supported

What version of Java do I need?

Java 8 or higher. If you have more than one version of Java installed on your system, you can nominate which one Gwen will run on by setting the JAVA_HOME environment variable.

Does Gwen have a GUI interface?

No. You can do everything on the command line with Gwen.

How do I launch Gwen?

You launch Gwen using the command line interface.

What are the batch and REPL modes?

Batch mode forces Gwen to immediately exit after a given feature or features have executed. You should always invoke Gwen in batch mode on server environments such as build servers. To execute Gwen in batch mode, simply specify the -b or --batch command line switch.

bin/gwen -b features
bin/gwen --batch features

REPL mode leaves the interpreter session open after a given feature or features have executed, allowing you to interactively enter additional steps to execute or inspect bound data in memory. You should use this mode when you want to verify the execution of individual steps that you want to add to your features or when you want to diagnose a failing feature. Gwen runs in this mode by default (in the absence of the -b or --batch switch).

What are the available REPL commands?

See REPL commands.

How do I run a single feature file?

To run the features/floodio/FloodIO.feature file:

bin/gwen features/floodio/FloodIO.feature

How do I run all features files in a directory?

To run all feature files in the features directory, including all feature files in all sub-directories:

bin/gwen features

To run all feature files in the features/floodio directory, including all feature files in all sub-directories:

bin/gwen features/floodio

How do I run multiple features in sequence?

To run multiple feature files or directories of features in sequence:

bin/gwen <feature-or-dir-1> <feature-or-dir-2> .. <feature-or-dir-N>

How do I run multiple features in parallel?

To run multiple feature files or directories in parallel, specify the -| or --parallel option:

bin/gwen -| <feature-or-dir-1> <feature-or-dir-2> .. <feature-or-dir-N> 
bin/gwen --parallel <feature-or-dir-1> <feature-or-dir-2> .. <feature-or-dir-N>

Can I set a ramp up interval for staggered parallel execution?

Yes. Configure the gwen.rampup.interval.seconds runtime setting. If you set this value to 5, the staggered execution will look like this:

|< 0 secs >|<-- feature 1a -->|<-- feature 1b -->|..
|<----- 5 secs >|<-- feature 2a -->|<-- feature 2b -->|..
|<---------- 10 secs >|<-- feature 3a -->|<-- feature 3b -->|..
|<--------------- 15 secs >|<-- feature 4a -->|<-- feature 4b -->|..

How do I compose step definitions?

By declaring a Scenario and annotating it with the @StepDef tag. See StepDefs and Meta for an example.

Can I validate my features?

Yes, see dry run execution and validation

Can I ignore (skip over) features and scenarios at execution time?

Yes, you can either:

  • Annotate them with the @Ignore tag
  • Or annotate them with your your own tag like @MyTag and launch Gwen with the -t ~@MyTag or --tags ~@MyTag option to exclude them from execution

Can I execute certain tagged features and scenarios and exclude all others?

Yes, to execute only those tagged with @MyTag, launch Gwen with the -t @MyTag or --tags @MyTag option to include only those and exclude all others.

How do I generate evaluation reports?

Specify the -r or --report option followed by the directory where you would like the reports to be generated.

For example, to generate the reports to a relative directory named reports:

bin/gwen -r reports
bin/gwen --report reports

The above will generate a HTML report in the reports/html directory and an index page at reports/index.html

Can I generate JUnit-XML reports?

Yes, to generate only JUnit-XML reports, specify the -f or --format option as follows in addition to the -r or --report option:

bin/gwen -r reports -f junit
bin/gwen --report reports --format junit
  • JUnit reports will be written to reports/junit/TEST-*.xml

Can I generate JSON reports?

Yes, to generate cucumber compliant JSON reports, specify the -f or --format option as follows in addition to the -r or --report option:

bin/gwen -r reports -f json
bin/gwen --report reports --format json
  • JSON reports will be written to reports/json/*.json

Can I generate more than one type of report?

Yes, To generate JUnit, JSON, and HTML reports:

bin/gwen -r reports -f "junit,json,html"
bin/gwen --report reports --format "junit,json,html"
  • JUnit reports will be written to reports/junit/TEST-*.xml
  • JSON reports will be written to reports/json/*.json
  • HTML reports will be written to the reports/html directory with an index page at reports/index.html

How can I feed CSV data to my features?

See CSV data feeds.

Can I configure runtime settings?

Yes, see runtime settings

Can I define user settings?

Yes, you can define arbitrary user properties and runtime settings overrides in a local user settings file.

Is string interpolation supported?

Yes, there is support for string interpolation by substitution and by concatenation.

How do I configure logging?

Gwen uses log4j to perform all logging using the configuration shown below. This default configuration is defined in a log4j.properties file bundled in the Gwen binary. To override this and specify your own configuration, add a log4j.configuration=file:/path-to-log4j-config-file entry to your user settings (gwen.properties) file in your user home directory. For more information about log4j, see the log4j FAQ.

# Set root logger level to INFO and append to STDOUT
log4j.rootLogger=INFO, STDOUT

# STDOUT is set to be a ConsoleAppender.
log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender

# STDOUT uses PatternLayout.
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
log4j.appender.STDOUT.layout.ConversionPattern=%p - %m%n

# Gwen logging level
log4j.logger.gwen=INFO

Can I access and work with database data?

Yes, see SQL data bindings

Are scenario outlines supported?

Yes, see Gwen Gets Scenario Outlines

Are data tables supported?

Yes, see:

Can I use Doc Strings?

Yes, see Doc Strings

Can I pass parameters to StepDefs?

Yes, see StepDefs with parameters

Can I compare or match content using templates]

Yes, see Template Matching

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.