Getting started with Substeps

Manual Setup (Maven)

These instructions are for building a maven based project.

  1. Create an ‘acceptance-test’ project.
  2. Include the substeps dependencies

    Firstly add a dependency on the Substeps Bill of Materials (BOM)

    This will include substeps core as well as compatible versions of substeps runners.

    If you wish to run acceptance tests against a web application using selenium webdriver you'll need to add a further dependency:

    If you wish to create your own or use other step implementations then include them as further test dependencies.

    Check Maven Central for the latest versions of these libraries.

  3. Create a directory on the classpath to contain your feature files or sub-directories of feature files (eg src/test/resources/features)
  4. Create a directory on the classpath to contain substep files (eg src/test/resources/substeps)
  5. Create a JUnit class to run the tests in ‘development’ mode:

    If you have bespoke step implementations then add to the list of step implementations above. Additional properties can also be specified, see the JUnit Runner for more details.

  6. create a configuration file localhost.properties and place in the classpath (src/test/resources). This property file will contain all of the environment settings for substeps. Substep libraries might each include their own set of default properties, the values in this file will override the defaults.

  7. To run the tests: Simply run the class as a Junit test; in Eclipse select the AcceptanceTestsRunner class, right click and select Run As, JUnit test

Continuous integration (using Maven)

The substeps maven plugin can execute a number of configurations as part of an integration test.

Each configuration can be tailored to use specific properties, sets of tests or alternate initialisation classes and or step implementations. The plugin adds all the dependencies of the project to it's own set of dependencies to avoid duplication in the pom.

See the Substeps Maven Site for full details of the parameters and options available.

An example Maven Project Object Model (POM)

This example POM is adapted from the sample project, feel free to copy:

Manual setup (Ant)

These instructions are for building an Ant-based project:

  1. Create a project structure of your choice
  2. Import the substeps namespace into the build.xml
  3. Define an Ant taskdef to allow usage of the custom Ant task
  4. Add a target to run your SubSteps configuration
  5. Create a directory on the classpath to contain your feature files or sub-directories of feature files (eg src/test/resources/features).
  6. Create a directory on the classpath to contain substep files (eg src/test/resources/substeps).
  7. Create a junit class to run the tests in ‘development’ mode:

    If you have bespoke step implementations then add to the list of step implementations above. Additional properties can also be specified see the Junit Runner for more details

  8. Create a configuration file localhost.properties and place in the classpath (src/test/resources). This property file will contain all of the environment settings for substeps. Substep libraries might each include their own set of default properties, the values in this file will override the defaults.
  9. To run the tests: Simply run the class as a Junit test; in Eclipse select the AcceptanceTestsRunner class, right click and select Run As, junit test.
  10. An example build.xml file: