Be sure you have following setup before proceeding..
- A running Jenkins environment with
- Java 1.8+ installed
- A browser installed (preferably Chrome)
Create a Gwen Workspace Repository
Next, you will need to convert your Gwen project over to a Gwen Workspace. If you have not already done this it is easy to do. Just follow these steps:
- Download and unzip the latest gwen-workspace.zip to a location on your drive
- Copy all your
.metafiles to the
- Check that your features execute successfully by running
gwen features -bin the workspace root
- You can tweak any Gwen properties or wrapper scripts in the workspace if required to tailor your execution.
- Publish your workspace folder to your Git repository
The benefit of using a workspace is that it contains an embedded Gwen Package Manager that will automatically install and configure Gwen for you (so you don’t have to do this manually in the Jenkins environment). If you do not want to use a workspace but would rather utilise your current project setup “as is”, then you will have to do manual installation and configuration work on the Jenkins host to ensure that your features can execute (but the basic setting up of the Jenkins job will be similar to below).
Create a Jenkins Job
Once you have a workspace that is accessible from Git, you are ready to create a Jenkins job to run your workspace.
- Logon to your Jenkins
- Create a new “Freestyle” project and give it a name
- In the “Source Code Management” section, select “Git” and provide your Gwen workspace repository URL and other Git settings
- In the “Build” section, select “Execute Shell” (for linux) or “Execute Windows Batch Command” (for windows), and enter the following command to run Gwen
./gwen features -b -f junit -Dgwen.web.browser.headless=true
gwen features -b -f junit -Dgwen.web.browser.headless=true
-btells Gwen to exit once execution is complete,
-f junittells Gwen to generate JUnit-XML reports, and
-Dgwen.web.browser.headless=truetells Gwen to run the browser in headless mode. You can also pass additional Gwen options if required, like
--parallelfor example if you want to utilise all cores and perform parallel execution.
- In the “Post-build Actions” section, select “Publish JUnit test result report”, and enter the following in the “Test Report XMLs” field.
- Click “Save” when you are done and then run your job