Behave Pro can export the created Feature and Scenarios to any gherkin compatible test automation tool. For Gradle based projects we have a taks that will export the features directly from JIRA based your projects tasks dependencies.

Gradle task

The Gradle task can be installed automatically by configuring your Gradle scripts to fetch the task and its dependencies using standard Maven resolution.

buildscript {
    repositories {
        maven { url 'http://repo.hindsightsoftware.com/public-maven' }
        mavenCentral()
    }
    dependencies {
        classpath group: 'com.hindsighttesting.behave', name: 'behave-gradle-task', version: '1.0.0-1'
    }
}

The above script will automatically download the task from the Hindsight Maven repository, and make it available to the build script of your projects.

Configuration

Adding a task to download Acceptance Tests from Behave

To download the Acceptance Tests (Feature files) you need to create a task implementing “com.hindsighttesting.behave.gradle.FeaturesTask”. This type has been added by the automatic installation described above.

task behavefeatures(type: com.hindsighttesting.behave.gradle.FeaturesTask) {
    projectKey = '10100'
    server = 'https://behave.pro for Cloud OR JIRA Server URL'
    username = 'Cloud userId OR JIRA Server User'
    password = 'Cloud API key OR JIRA Server Password'
    destinationDir = 'build/generated-test-sources/cucumber'
}

Configuring Cucumber

Don’t forget to execute the Behave Download Task before executing Cucumber, or you won’t have any tests to execute. This can be simply done by adding a dependency from your Cucumber task to the Behave Task.

dependsOn assemble, behavefeatures

Also you will need to tell Cucumber where to find the Acceptance Tests (Feature files) you have downloaded (The “destinationDir” property in the Behave Task)

args = ['-f', 'pretty', '--glue', 'build/classes/test', 'build/generated-test-sources/cucumber']
Did this answer your question?