├── .gitignore ├── .travis.yml ├── CODE_OF_CONDUCT.md ├── README.md ├── build.gradle ├── cucumber.png ├── gradlew ├── settings.gradle └── src └── main └── java └── com └── camiloribeiro ├── RunCucumberTests.java ├── features ├── ExampleOne-FourScenariosOneSecond.feature ├── ExampleOne-OneScenarioSleepsFiveSeconds.feature ├── ExampleOne-OneScenarioSleepsTwoSeconds.feature ├── ExampleThree-FourScenariosOneSecond.feature ├── ExampleThree-OneScenarioSleepsFiveSeconds.feature ├── ExampleThree-OneScenarioSleepsTwoSeconds.feature ├── ExampleTwo-FourScenariosOneSecond.feature ├── ExampleTwo-OneScenarioSleepsFiveSeconds.feature └── ExampleTwo-OneScenarioSleepsTwoSeconds.feature └── steps └── Steps.java /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | gradle 3 | *bat 4 | .idea 5 | .gradle 6 | build 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: groovy 2 | jdk: 3 | - oraclejdk8 4 | before_install: 5 | - gradle wrapper 6 | script: ./gradlew clean build runInParallel 7 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at [INSERT EMAIL ADDRESS]. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Cucumber Gradle Parallel Example 2 | =============================== 3 | 4 | [![Build Status](https://travis-ci.org/camiloribeiro/cucumber-gradle-parallel.svg?branch=master)](https://travis-ci.org/camiloribeiro/cucumber-gradle-parallel) 5 | 6 | ![alt tag](https://raw.githubusercontent.com/camiloribeiro/cucumber-gradle-parallel/master/cucumber.png) 7 | 8 | This is just an example of cucumber jvm running several features in parallel on gradle. 9 | 10 | This project adheres to the Contributor Covenant [code of conduct](CODE_OF_CONDUCT.md). 11 | By participating, you are expected to uphold this code. 12 | 13 | In this example you will find: 14 | 15 | - 9 Feature files running simultaneously in different threads and different jvms 16 | - A cucumber report being generated on top of all results at the end of the test 17 | 18 | The current example run over 47 seconds of testing in a bit more than 5 seconds. It also generates a report in another couple of seconds. 19 | The features used in this exercise are just features with bare sleep inside its steps. It is just to show that it is actyally running simultaneusly. 20 | 21 | You can check other implementations that also try to run in parallel here: 22 | 23 | - https://github.com/theaberrant/gradle-concurrent 24 | - https://github.com/theaberrant/cucumber-jvm-groovy-rest-example 25 | 26 | The report used is: 27 | 28 | - http://www.masterthought.net/section/cucumber-reporting 29 | 30 | Besides the basic configuration, it is not very useful :) 31 | 32 | Try it 33 | ======== 34 | 35 | Make sure you have java installed and gradle https://gradle.org/ 36 | 37 | Clone the repository: 38 | 39 | $ git clone git@github.com:camiloribeiro/cucumber-gradle-parallel.git 40 | 41 | Run in sequence, the usual way: 42 | 43 | $ gradle clean build runInSequence 44 | 45 | Check the total time in the output. Now, run it in parallel: 46 | 47 | $ gradle clean build runInParallel 48 | 49 | Check the report in the output. 50 | Add a file:// + output in your browser, example file:///Users/camilo/cucumber-gradle-parallel/build/reports/cucumber/cucumber-html-reports/overview-features.html 51 | 52 | Have fun. 53 | 54 | LICENSE 55 | ======= 56 | 57 | Copyright 2015 - 2017 Camilo Ribeiro camilo@camiloribeiro.com 58 | 59 | This file is part of Cucumber-gradle.parallel. 60 | 61 | Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 62 | 63 | http://www.apache.org/licenses/LICENSE-2.0 64 | 65 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 66 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | import groovyx.gpars.GParsPool 2 | import net.masterthought.cucumber.ReportBuilder 3 | import net.masterthought.cucumber.Configuration 4 | import net.masterthought.cucumber.Reportable 5 | apply plugin: 'groovy' 6 | apply plugin: 'java' 7 | apply plugin: 'idea' 8 | apply plugin: 'maven' 9 | 10 | buildscript { 11 | repositories { 12 | maven { 13 | url "http://repo.bodar.com" 14 | } 15 | mavenCentral() 16 | } 17 | 18 | dependencies { 19 | classpath "org.codehaus.gpars:gpars:1.2.1", 20 | "net.masterthought:cucumber-reporting:3.5.1" 21 | } 22 | } 23 | 24 | repositories { 25 | maven { 26 | url "http://repo.bodar.com" 27 | } 28 | mavenCentral() 29 | 30 | } 31 | 32 | ext.cukesVersion = '1.2.5' 33 | 34 | dependencies { 35 | 36 | compile group: 'net.masterthought', name: 'cucumber-reporting', version: "3.5.1" 37 | compile group: 'com.googlecode.totallylazy', name: 'totallylazy', version: '1.85' 38 | 39 | compile group: 'info.cukes', name: 'cucumber-junit', version: "$cukesVersion" 40 | compile group: 'info.cukes', name: 'cucumber-core', version: "$cukesVersion" 41 | compile group: 'info.cukes', name: 'cucumber-java8', version: "$cukesVersion" 42 | 43 | compile( 44 | "org.codehaus.groovy:groovy-all:2.4.7" 45 | ) 46 | 47 | compile files("$buildDir/classes/main") 48 | } 49 | 50 | task runInParallel { 51 | doLast { 52 | def testProperties = "-DsomePropertie=somePropertie" 53 | runCucumberTests(testProperties, "~@pending") 54 | } 55 | } 56 | 57 | def runCucumberTests(testProperties, tag) { 58 | def features = fileTree(dir: "${project.projectDir}/src/main/java/com/camiloribeiro/features/").include '**/*.feature' 59 | 60 | GParsPool.withPool(10) { 61 | features.eachParallel { File file -> 62 | exec { 63 | executable "sh" 64 | args "-c", "mkdir -p ${reporting.baseDir}/cucumber" + 65 | "&& java ${testProperties} " + 66 | "-cp ${sourceSets.main.runtimeClasspath.asPath} " + 67 | "cucumber.api.cli.Main " + 68 | "--glue classpath:com.camiloribeiro " + 69 | "${project.projectDir}/src/main/java/com/camiloribeiro/features/${file.name} " + 70 | "--plugin json:${reporting.baseDir}/cucumber/${file.name}.json " + 71 | "--plugin pretty > ${reporting.baseDir}/cucumber/${file.name}.log " + 72 | "--tags ${tag}" 73 | } 74 | println("${file.name}: Scenario output: ${reporting.baseDir}/cucumber/${file.name}.log ") 75 | } 76 | } 77 | generateReport() 78 | } 79 | 80 | task runInSequence() { 81 | doLast { 82 | def arglist = ["-p", "pretty", "-p", "json:${reporting.baseDir}/cucumber/cucumber.json", "--glue", "com.camiloribeiro", 83 | "${project.projectDir}/src/main/java/com/camiloribeiro/features"] 84 | 85 | return javaexec { 86 | main = "cucumber.api.cli.Main" 87 | classpath = sourceSets.main.runtimeClasspath 88 | args = arglist 89 | } 90 | generateReport() 91 | } 92 | } 93 | 94 | def generateReport() { 95 | def jsonReports = fileTree(dir: "${reporting.baseDir}/cucumber/").include '**/*.json'.toString() 96 | File reportOutputDirectory = new File("${reporting.baseDir}/cucumber"); 97 | 98 | List jsonReportFiles = new ArrayList(); 99 | jsonReports.each { File file -> 100 | jsonReportFiles.add("${reporting.baseDir}/cucumber/${file.name}".toString()); 101 | } 102 | 103 | Configuration configuration = new Configuration(reportOutputDirectory, "cucumber-gradle-parallel"); 104 | // optional configuration 105 | configuration.setParallelTesting(true); 106 | configuration.setRunWithJenkins(false); 107 | configuration.setBuildNumber("1988"); 108 | 109 | ReportBuilder reportBuilder = new ReportBuilder(jsonReportFiles, configuration); 110 | Reportable result = reportBuilder.generateReports(); 111 | println("\nReport available on: ${reporting.baseDir}/cucumber/cucumber-html-reports/overview-features.html") 112 | } 113 | 114 | task wrapper(type: Wrapper) { 115 | gradleVersion = '2.10' //we want gradle 2.10 to run this project 116 | } 117 | -------------------------------------------------------------------------------- /cucumber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/camiloribeiro/cucumber-gradle-parallel/6f44deecc9364801f9116c563935a7e25de4888a/cucumber.png -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'cucumber-gradle-parallel' 2 | -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/RunCucumberTests.java: -------------------------------------------------------------------------------- 1 | package com.camiloribeiro; 2 | 3 | import cucumber.api.CucumberOptions; 4 | import cucumber.api.junit.Cucumber; 5 | import org.junit.runner.RunWith; 6 | 7 | @RunWith(Cucumber.class) 8 | @CucumberOptions(tags = {"~@pending"}) 9 | public class RunCucumberTests { 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/features/ExampleOne-FourScenariosOneSecond.feature: -------------------------------------------------------------------------------- 1 | Feature: This just contains four scenarios that sleeps for one second each 2 | 3 | This feature file just sleeps for a 4 seconds (one second each scenario) 4 | It is not meant to do anything, but sleep 5 | So we can prove that it runs in parallel 6 | 7 | Scenario: Example 1 that sleep 1 seconds 8 | Given I have the this useless scenario 9 | When I sleep for 1 seconds 10 | Then It should finnish 11 | 12 | Scenario: Example 2 that sleep 1 seconds 13 | Given I have the this useless scenario 14 | When I sleep for 1 seconds 15 | Then It should finnish 16 | 17 | Scenario: Example 2 that sleep 1 seconds 18 | Given I have the this useless scenario 19 | When I sleep for 1 seconds 20 | Then It should finnish 21 | 22 | Scenario: Example 2 that sleep 1 seconds 23 | Given I have the this useless scenario 24 | When I sleep for 1 seconds 25 | Then It should finnish 26 | -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/features/ExampleOne-OneScenarioSleepsFiveSeconds.feature: -------------------------------------------------------------------------------- 1 | Feature: This just contains one scenario that sleeps for five seconds 2 | 3 | This feature file just sleeps for a 5 seconds 4 | It is not meant to do anything, but sleep 5 | So we can prove that it runs in parallel 6 | 7 | Scenario: Example sleep 5 seconds 8 | Given I have the this useless scenario 9 | When I sleep for 5 seconds 10 | Then It should finnish -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/features/ExampleOne-OneScenarioSleepsTwoSeconds.feature: -------------------------------------------------------------------------------- 1 | Feature: This just contains one scenario that sleeps for two seconds 2 | 3 | This feature file just sleeps for a 2 seconds 4 | It is not meant to do anything, but sleep 5 | So we can prove that it runs in parallel 6 | 7 | Scenario: Example sleep 5 seconds 8 | Given I have the this useless scenario 9 | When I sleep for 2 seconds 10 | Then It should finnish -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/features/ExampleThree-FourScenariosOneSecond.feature: -------------------------------------------------------------------------------- 1 | Feature: This just contains four scenarios that sleeps for one second each 2 | 3 | This feature file just sleeps for a 4 seconds (one second each scenario) 4 | It is not meant to do anything, but sleep 5 | So we can prove that it runs in parallel 6 | 7 | Scenario: Example 1 that sleep 1 seconds - three 8 | Given I have the this useless scenario 9 | When I sleep for 1 seconds 10 | Then It should finnish 11 | 12 | Scenario: Example 2 that sleep 1 seconds - three 13 | Given I have the this useless scenario 14 | When I sleep for 1 seconds 15 | Then It should finnish 16 | 17 | Scenario: Example 2 that sleep 1 seconds - three 18 | Given I have the this useless scenario 19 | When I sleep for 1 seconds 20 | Then It should finnish 21 | 22 | Scenario: Example 2 that sleep 1 seconds - three 23 | Given I have the this useless scenario 24 | When I sleep for 1 seconds 25 | Then It should finnish 26 | -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/features/ExampleThree-OneScenarioSleepsFiveSeconds.feature: -------------------------------------------------------------------------------- 1 | Feature: This just contains one scenario that sleeps for five seconds 2 | 3 | This feature file just sleeps for a 5 seconds 4 | It is not meant to do anything, but sleep 5 | So we can prove that it runs in parallel 6 | 7 | Scenario: Example sleep 5 seconds - three 8 | Given I have the this useless scenario 9 | When I sleep for 5 seconds 10 | Then It should finnish -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/features/ExampleThree-OneScenarioSleepsTwoSeconds.feature: -------------------------------------------------------------------------------- 1 | Feature: This just contains one scenario that sleeps for two seconds 2 | 3 | This feature file just sleeps for a 2 seconds 4 | It is not meant to do anything, but sleep 5 | So we can prove that it runs in parallel 6 | 7 | Scenario: Example sleep 5 seconds - three 8 | Given I have the this useless scenario 9 | When I sleep for 2 seconds 10 | Then It should finnish -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/features/ExampleTwo-FourScenariosOneSecond.feature: -------------------------------------------------------------------------------- 1 | Feature: This just contains four scenarios that sleeps for one second each 2 | 3 | This feature file just sleeps for a 4 seconds (one second each scenario) 4 | It is not meant to do anything, but sleep 5 | So we can prove that it runs in parallel 6 | 7 | Scenario: Example 1 that sleep 1 seconds - two 8 | Given I have the this useless scenario 9 | When I sleep for 1 seconds 10 | Then It should finnish 11 | 12 | Scenario: Example 2 that sleep 1 seconds - two 13 | Given I have the this useless scenario 14 | When I sleep for 1 seconds 15 | Then It should finnish 16 | 17 | Scenario: Example 2 that sleep 1 seconds - two 18 | Given I have the this useless scenario 19 | When I sleep for 1 seconds 20 | Then It should finnish 21 | 22 | Scenario: Example 2 that sleep 1 seconds - two 23 | Given I have the this useless scenario 24 | When I sleep for 1 seconds 25 | Then It should finnish 26 | -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/features/ExampleTwo-OneScenarioSleepsFiveSeconds.feature: -------------------------------------------------------------------------------- 1 | Feature: This just contains one scenario that sleeps for five seconds 2 | 3 | This feature file just sleeps for a 5 seconds 4 | It is not meant to do anything, but sleep 5 | So we can prove that it runs in parallel 6 | 7 | Scenario: Example sleep 5 second - two 8 | Given I have the this useless scenario 9 | When I sleep for 5 seconds 10 | Then It should finnish -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/features/ExampleTwo-OneScenarioSleepsTwoSeconds.feature: -------------------------------------------------------------------------------- 1 | Feature: This just contains one scenario that sleeps for two seconds 2 | 3 | This feature file just sleeps for a 2 seconds 4 | It is not meant to do anything, but sleep 5 | So we can prove that it runs in parallel 6 | 7 | Scenario: Example sleep 5 second - two 8 | Given I have the this useless scenario 9 | When I sleep for 2 seconds 10 | Then It should finnish -------------------------------------------------------------------------------- /src/main/java/com/camiloribeiro/steps/Steps.java: -------------------------------------------------------------------------------- 1 | package com.camiloribeiro.steps; 2 | 3 | import cucumber.api.java.en.Given; 4 | import cucumber.api.java.en.Then; 5 | import cucumber.api.java.en.When; 6 | 7 | public class Steps { 8 | @Given("^I have the this useless scenario$") 9 | public void I_have_the_this_useless_scenario() { 10 | // :D 11 | } 12 | 13 | @When("^I sleep for (\\d+) seconds$") 14 | public void I_sleep_for_seconds(int arg1) throws InterruptedException { 15 | Thread.sleep(arg1 * 1000); 16 | } 17 | 18 | @Then("^It should finnish$") 19 | public void It_should_finnish() { 20 | } 21 | } 22 | --------------------------------------------------------------------------------