├── .gitignore ├── .travis.yml ├── LICENSE ├── changelog.md ├── doc ├── site │ ├── css │ │ ├── maven-base.css │ │ ├── maven-theme.css │ │ ├── print.css │ │ └── site.css │ ├── dependencies.html │ ├── dependency-convergence.html │ ├── dependency-info.html │ ├── dependency-management.html │ ├── distribution-management.html │ ├── images │ │ ├── close.gif │ │ ├── collapsed.gif │ │ ├── expanded.gif │ │ ├── external.png │ │ ├── icon_error_sml.gif │ │ ├── icon_info_sml.gif │ │ ├── icon_success_sml.gif │ │ ├── icon_warning_sml.gif │ │ ├── logos │ │ │ ├── build-by-maven-black.png │ │ │ ├── build-by-maven-white.png │ │ │ └── maven-feather.png │ │ └── newwindow.png │ ├── index.html │ ├── issue-tracking.html │ ├── license.html │ ├── plugin-management.html │ ├── plugins.html │ ├── project-info.html │ ├── project-summary.html │ ├── source-repository.html │ └── team-list.html └── style │ ├── eclipse-java-style.xml │ ├── intellij-java-style.xml │ └── style.xml ├── migration.md ├── pom.xml ├── readme.md ├── readme_archive.md └── src ├── it ├── junit │ ├── all-build-in-plugins │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ └── feature1.feature │ │ └── verify.groovy │ ├── build-in-plugins-use-defaults │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ └── feature1.feature │ │ └── verify.groovy │ ├── complex-naming-scheme-counter-length │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ ├── feature2.feature │ │ │ │ ├── feature3.feature │ │ │ │ ├── feature4.feature │ │ │ │ ├── feature5.feature │ │ │ │ └── feature6.feature │ │ └── verify.groovy │ ├── custom-output-directory │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── custom-package │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── custom-plugin-no-output │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ └── feature1.feature │ │ └── verify.groovy │ ├── custom-plugins │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ └── feature1.feature │ │ └── verify.groovy │ ├── custom-template │ │ ├── custom-template-test.vm │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── extents-report │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ ├── cucumber-extents-report-runner.java.vm │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── filter-by-tag │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── filter-by-tag2-negation │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── filter-by-tag3-and │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ ├── feature2.feature │ │ │ │ └── feature3.feature │ │ └── verify.groovy │ ├── filter-by-tag3-or │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ ├── feature2.feature │ │ │ │ └── feature3.feature │ │ └── verify.groovy │ ├── filter-by-tag4 │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ ├── feature2.feature │ │ │ │ ├── feature3.feature │ │ │ │ └── feature4.feature │ │ └── verify.groovy │ ├── filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── filter-by-tag6-override-tags-if-tags-in-cucumber-opts │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ ├── feature2.feature │ │ │ │ └── feature3.feature │ │ └── verify.groovy │ ├── filter-tag-expressions-feature │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ └── feature1.feature │ │ └── verify.groovy │ ├── filter-tag-expressions-scenario │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ └── feature1.feature │ │ └── verify.groovy │ ├── illegal-escape-char │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ └── feature1.feature │ │ └── verify.groovy │ ├── issue_112-tags-in-vm-feature-mode │ │ ├── custom-template-test.vm │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ └── feature1.feature │ │ └── verify.groovy │ ├── issue_112-tags-in-vm-scenario-mode │ │ ├── custom-template-test.vm │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ └── feature1.feature │ │ └── verify.groovy │ ├── issue_15-feature-naming-scheme │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── issue_19-complex-naming-scheme │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── issue_19-multiple-execution │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── issue_43-outline_runner-filter-by-tag │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── github │ │ │ │ │ └── timm │ │ │ │ │ └── Steps.java │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ ├── target │ │ │ ├── cucumber-parallel │ │ │ │ ├── 1.json │ │ │ │ ├── 2.json │ │ │ │ └── 3.json │ │ │ ├── failsafe-reports │ │ │ │ ├── Parallel01IT.txt │ │ │ │ ├── Parallel02IT.txt │ │ │ │ ├── Parallel03IT.txt │ │ │ │ ├── TEST-Parallel01IT.xml │ │ │ │ ├── TEST-Parallel02IT.xml │ │ │ │ ├── TEST-Parallel03IT.xml │ │ │ │ └── failsafe-summary.xml │ │ │ ├── generated-test-sources │ │ │ │ └── cucumber │ │ │ │ │ ├── Parallel01IT.java │ │ │ │ │ ├── Parallel02IT.java │ │ │ │ │ └── Parallel03IT.java │ │ │ ├── maven-archiver │ │ │ │ └── pom.properties │ │ │ ├── maven-status │ │ │ │ └── maven-compiler-plugin │ │ │ │ │ └── testCompile │ │ │ │ │ └── default-testCompile │ │ │ │ │ ├── createdFiles.lst │ │ │ │ │ └── inputFiles.lst │ │ │ ├── simple-it-1.0-SNAPSHOT.jar │ │ │ └── test-classes │ │ │ │ ├── Parallel01IT.class │ │ │ │ ├── Parallel02IT.class │ │ │ │ ├── Parallel03IT.class │ │ │ │ ├── com │ │ │ │ └── github │ │ │ │ │ └── timm │ │ │ │ │ └── Steps.class │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── issue_43-outline_runner │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── issue_50-no-tags │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── issue_76-InconsistentFilters │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── modular-naming-pattern │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ ├── feature2.feature │ │ │ │ ├── feature3.feature │ │ │ │ ├── feature4.feature │ │ │ │ ├── feature5.feature │ │ │ │ └── feature6.feature │ │ └── verify.groovy │ ├── multiple-format │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ ├── no-features-dir │ │ ├── invoker.properties │ │ ├── pom.xml │ │ └── verify.groovy │ ├── no-glue-specified │ │ ├── invoker.properties │ │ ├── pom.xml │ │ ├── src │ │ │ └── test │ │ │ │ └── resources │ │ │ │ └── features │ │ │ │ ├── feature1.feature │ │ │ │ └── feature2.feature │ │ └── verify.groovy │ └── simple-it │ │ ├── pom.xml │ │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ ├── feature1.feature │ │ │ └── feature2.feature │ │ └── verify.groovy ├── settings.xml └── testng │ ├── filter-by-tag │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ ├── feature1.feature │ │ │ └── feature2.feature │ └── verify.groovy │ ├── filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ ├── feature1.feature │ │ │ └── feature2.feature │ └── verify.groovy │ ├── filter-by-tag6-override-tags-if-tags-in-cucumber-opts │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ ├── feature1.feature │ │ │ ├── feature2.feature │ │ │ └── feature3.feature │ └── verify.groovy │ ├── illegal-escape-char │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ └── feature1.feature │ └── verify.groovy │ ├── issue_15-feature-naming-scheme │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ ├── feature1.feature │ │ │ └── feature2.feature │ └── verify.groovy │ ├── issue_50-no-tags │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ ├── feature1.feature │ │ │ └── feature2.feature │ └── verify.groovy │ ├── issue_76-InconsistentFilters │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ ├── feature1.feature │ │ │ └── feature2.feature │ └── verify.groovy │ ├── multiple-format │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ ├── feature1.feature │ │ │ └── feature2.feature │ └── verify.groovy │ ├── output-directory │ ├── pom.xml │ ├── src │ │ └── test │ │ │ └── resources │ │ │ └── features │ │ │ ├── feature1.feature │ │ │ └── feature2.feature │ └── verify.groovy │ └── simple-it │ ├── pom.xml │ ├── src │ └── test │ │ └── resources │ │ └── features │ │ ├── feature1.feature │ │ └── feature2.feature │ └── verify.groovy ├── main ├── java │ └── com │ │ └── github │ │ └── timm │ │ └── cucumber │ │ ├── ModuloCounter.java │ │ ├── generate │ │ ├── CucumberITGenerator.java │ │ ├── CucumberITGeneratorByFeature.java │ │ ├── CucumberITGeneratorByScenario.java │ │ ├── CucumberITGeneratorFactory.java │ │ ├── FileGeneratorConfig.java │ │ ├── GenerateRunnersMojo.java │ │ ├── OverriddenCucumberOptionsParameters.java │ │ ├── ParallelScheme.java │ │ ├── Plugin.java │ │ ├── ScenarioAndLocation.java │ │ └── name │ │ │ ├── ClassNamingScheme.java │ │ │ ├── ClassNamingSchemeFactory.java │ │ │ ├── Counter.java │ │ │ ├── FeatureFileClassNamingScheme.java │ │ │ ├── OneUpCounter.java │ │ │ └── PatternNamingScheme.java │ │ ├── options │ │ ├── RuntimeOptions.java │ │ └── Shellwords.java │ │ └── runtime │ │ ├── TagExpressionOld.java │ │ └── TagPredicate.java └── resources │ ├── array.java.vm │ ├── cucumber-junit-runner.java.vm │ └── cucumber-testng-runner.java.vm └── test ├── java └── com │ └── github │ └── timm │ └── cucumber │ ├── ModuloCounterTest.java │ ├── generate │ ├── CucumberITGeneratorByFeatureTest.java │ ├── CucumberITGeneratorByScenarioTest.java │ ├── CucumberITGeneratorFactoryTest.java │ ├── InstanceCounter.java │ ├── OverriddenCucumberOptionsParametersShouldOverrideParametersWithCucumberOptionsTest.java │ ├── PluginTest.java │ ├── TestFileGeneratorConfig.java │ └── name │ │ ├── ClassNamingSchemeFactoryTest.java │ │ ├── FeatureFileClassNamingSchemeTest.java │ │ └── PatternNamingSchemeTest.java │ ├── options │ └── RuntimeOptionsTest.java │ └── runtime │ └── TagPredicateTest.java └── resources └── features ├── filterByTag.feature └── multiple-example.feature /.gitignore: -------------------------------------------------------------------------------- 1 | cucumber-jvm-parallel-plugin.iml 2 | /target/ 3 | /.settings/ 4 | /.classpath 5 | /.project 6 | pom.xml.tag 7 | pom.xml.releaseBackup 8 | pom.xml.versionsBackup 9 | pom.xml.next 10 | release.properties 11 | .idea/ 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | sudo: false 3 | jdk: 4 | - oraclejdk8 5 | 6 | script: 7 | mvn clean verify -Prun-its 8 | 9 | cache: 10 | directories: 11 | - $HOME/.m2 12 | 13 | before_cache: 14 | - rm -rf $HOME/.m2/repository/com/github/temyers/cucumber-jvm-parallel-plugin/ -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | Changelog 2 | ========= 3 | 4 | 5.0.0 5 | ----- 6 | * PR #165 - Implement Tag expressions 7 | 8 | 4.2.0 9 | ----- 10 | * PR #136 - Fix issue #135 Filter generated classes into non-overlapping groups 11 | * PR #137 - Clean up listfiles order workaround in its 12 | 13 | 4.1.0 14 | ----- 15 | * PR #116 - Fix issue #112. Provide access to feature and scenario objects in custom VM templates. 16 | 17 | 4.0.0 18 | ----- 19 | * PR #105 - Remove filterFeaturesByTags property. Fix issue #77 20 | 21 | 3.0.0 22 | ----- 23 | * PR #99 - Escape Java using Velocity engine. Fix issue #82 24 | * PR #100 - Used containerized builds and cache dependencies 25 | * PR #104 - Add support for custom cucumber plugins. Fix issue #95 26 | 27 | 28 | 2.2.0 29 | ----- 30 | * PR #87 - allow setting of packageName for runners. Closes #45 31 | * PR #85 - Resolve inconsistent filters: Fix issue Issue #76 32 | * PR #86 - use the baseDir of the current project for velocity 33 | 34 | 2.1.0 35 | ----- 36 | * PR #81 - Allow custom templates. Closes #61. 37 | 38 | 2.0.2 39 | ----- 40 | * PR #74 - generate classes by feature creates duplicates 41 | 42 | 2.0.1 43 | ----- 44 | 45 | * PR #72 - parallel scenario filter by tag 46 | 47 | 2.0.0 48 | ----- 49 | * issue 50 - Support generating runners without any tags. 50 | * PR #57 - Use "generate-test-sources" maven build phase rather than "validate" 51 | * PR #68 - Support generating runners per scenario 52 | 53 | 1.3.0 54 | ----- 55 | * Fix issue #49 - remove dots when using feature file naming scheme 56 | * PR #46 - Add checkstyle rules 57 | * Update to use CucumberOptions.plugin, rather than format 58 | * issue #19 Add support for custom naming scheme based on a pattern. 59 | * PR #28 Use "plugin" rather than "format" in Cucumber.Options. Supports cucumber 1.2.2+ 60 | 61 | 1.2.1 62 | ----- 63 | * issue #15 (re-opened) Fix compilations errors generated by 1.2.0 64 | 65 | 1.2.0 66 | ----- 67 | * issue #15 Add option to name the generated test case based on the name of the feature file. 68 | 69 | 1.1.0 70 | ----- 71 | * pr #13 - Added support for generating TestNG runners. 72 | 73 | 1.0.1 74 | ----- 75 | * issue#10 - compilation error on Windows. 76 | * issue#7 - Added support for filtering generated files by tag. 77 | * Added support for cucumber.options command line arguments. -------------------------------------------------------------------------------- /doc/site/css/print.css: -------------------------------------------------------------------------------- 1 | #banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn { 2 | display: none !important; 3 | } 4 | 5 | #bodyColumn, body.docs div.docs { 6 | margin: 0 !important; 7 | border: none !important 8 | } 9 | -------------------------------------------------------------------------------- /doc/site/css/site.css: -------------------------------------------------------------------------------- 1 | /* You can override this file with your own styles */ -------------------------------------------------------------------------------- /doc/site/images/close.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/close.gif -------------------------------------------------------------------------------- /doc/site/images/collapsed.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/collapsed.gif -------------------------------------------------------------------------------- /doc/site/images/expanded.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/expanded.gif -------------------------------------------------------------------------------- /doc/site/images/external.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/external.png -------------------------------------------------------------------------------- /doc/site/images/icon_error_sml.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/icon_error_sml.gif -------------------------------------------------------------------------------- /doc/site/images/icon_info_sml.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/icon_info_sml.gif -------------------------------------------------------------------------------- /doc/site/images/icon_success_sml.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/icon_success_sml.gif -------------------------------------------------------------------------------- /doc/site/images/icon_warning_sml.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/icon_warning_sml.gif -------------------------------------------------------------------------------- /doc/site/images/logos/build-by-maven-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/logos/build-by-maven-black.png -------------------------------------------------------------------------------- /doc/site/images/logos/build-by-maven-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/logos/build-by-maven-white.png -------------------------------------------------------------------------------- /doc/site/images/logos/maven-feather.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/logos/maven-feather.png -------------------------------------------------------------------------------- /doc/site/images/newwindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/doc/site/images/newwindow.png -------------------------------------------------------------------------------- /migration.md: -------------------------------------------------------------------------------- 1 | Migration Notes 2 | =============== 3 | 4 | These notes cover things to be aware of when upgrading the cucumber-jvm-parallel-plugin. 5 | 6 | Migration from version 4.x 7 | ========================== 8 | * Gherkin has been updated to version 5.0.0. You may encounter issues if you do not also upgrade 9 | Cucumber to at least version 2.x.x. 10 | * Tag expressions have upgraded to 1.1.1. See https://docs.cucumber.io/tag-expressions 11 | 12 | Migration from version 3.x 13 | ========================== 14 | * The `filterFeaturesByTags` property has been removed. If you have not set this property to true 15 | remove any tags from your configuration. If you have set it to true you can safely remove it. 16 | 17 | 18 | Migration from version 2.x 19 | ========================== 20 | * The `glue` property now takes a list of `package` elements rather then a list of comma delimited packages. A 21 | `package` contains a single package name to be used as glue. 22 | * The `tags` property now takes a list of `tag` elements rather then a list of comma and quote delimited strings. A 23 | `tag` element can take one or more tags. The semantics are the same as those of the 24 | [the command line]( https://github.com/cucumber/cucumber/wiki/Tags#running-a-subset-of-scenarios). 25 | * The default value for `cucumberOutputDir` has changed from `target/cucumber-parallel` to 26 | `${project.build.directory}/cucumber-parallel` if you were using a build directory other then `target` you can remove 27 | this element. 28 | 29 | 30 | Migration from version 1.x 31 | ========================== 32 | * The default for the `tags` property is now set to no tags. This means that all scenarios shall be executed by default. 33 | If you did not specify the tags parameter, add `"@complete", "@accepted"` to the configuration section. 34 | * A new property `parallelScheme` has been introduced to provide a mechanism for choosing how the feature runners are created. The default is set to SCENARIO, meaning that a runner will be created for each scenario in a feature file, including any examples. This greatly increases the possibility for running scenarios in parallel, but has the impact that any fragile, interdependent, tests may fail unexpectedly. Use the FEATURE property to generate runners as per 1.x -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # cucumber-jvm-parallel-plugin 2 | 3 | # STOP! 4 | 5 | Before reading further, you probably should not be using this plugin. 6 | 7 | As of `cucumber-jvm:4.0.0` parallel execution is supported natively by cucumber. As such, upgrading to Cucumber 4.0.0 is recommended and this plugin is no longer maintained. 8 | 9 | # Legacy documentation 10 | 11 | If you still want to read the documentation, see [readme_archive.md](readme_archive.md) 12 | -------------------------------------------------------------------------------- /src/it/junit/all-build-in-plugins/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/all-build-in-plugins/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 7 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 8 | 9 | assert suite01.isFile() 10 | 11 | String expected01 = 12 | """import org.junit.runner.RunWith; 13 | 14 | import cucumber.api.CucumberOptions; 15 | import cucumber.api.junit.Cucumber; 16 | 17 | @RunWith(Cucumber.class) 18 | @CucumberOptions( 19 | strict = true, 20 | features = {"${feature1.absolutePath}"}, 21 | plugin = {"null", "junit:${buildDirectory.absolutePath}/cucumber-parallel/junit/1.xml", "testng:${buildDirectory.absolutePath}/cucumber-parallel/testng/1.xml", "html:${buildDirectory.absolutePath}/cucumber-parallel/html/1", "pretty", "progress:${buildDirectory.absolutePath}/cucumber-parallel/progress/1.txt", "json:${buildDirectory.absolutePath}/cucumber-parallel/json/1.json", "usage:${buildDirectory.absolutePath}/cucumber-parallel/usage/1.json", "rerun:${buildDirectory.absolutePath}/cucumber-parallel/rerun/1.txt", "default_summary", "null_summary"}, 22 | monochrome = false, 23 | tags = {}, 24 | glue = {"foo"}) 25 | public class Parallel01IT { 26 | }""" 27 | 28 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 29 | -------------------------------------------------------------------------------- /src/it/junit/build-in-plugins-use-defaults/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/build-in-plugins-use-defaults/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 7 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 8 | 9 | assert suite01.isFile() 10 | 11 | String expected01 = 12 | """import org.junit.runner.RunWith; 13 | 14 | import cucumber.api.CucumberOptions; 15 | import cucumber.api.junit.Cucumber; 16 | 17 | @RunWith(Cucumber.class) 18 | @CucumberOptions( 19 | strict = true, 20 | features = {"${feature1.absolutePath}"}, 21 | plugin = {"pretty", "html:${buildDirectory.absolutePath}/cucumber-parallel/1", "json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 22 | monochrome = false, 23 | tags = {}, 24 | glue = {"foo"}) 25 | public class Parallel01IT { 26 | }""" 27 | 28 | 29 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 30 | -------------------------------------------------------------------------------- /src/it/junit/complex-naming-scheme-counter-length/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/complex-naming-scheme-counter-length/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/complex-naming-scheme-counter-length/src/test/resources/features/feature3.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/complex-naming-scheme-counter-length/src/test/resources/features/feature4.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/complex-naming-scheme-counter-length/src/test/resources/features/feature5.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/complex-naming-scheme-counter-length/src/test/resources/features/feature6.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/custom-output-directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | Output results to a custom directory 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | 47 | 48 | foo 49 | bar 50 | 51 | target/my-custom-dir 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/it/junit/custom-output-directory/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel01IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/custom-output-directory/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature2 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/custom-output-directory/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java") 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java") 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature") 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature") 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import org.junit.runner.RunWith; 18 | 19 | import cucumber.api.CucumberOptions; 20 | import cucumber.api.junit.Cucumber; 21 | 22 | @RunWith(Cucumber.class) 23 | @CucumberOptions( 24 | strict = true, 25 | features = {"${feature1.absolutePath}"}, 26 | plugin = {"json:${buildDirectory.absolutePath}/my-custom-dir/1.json"}, 27 | monochrome = false, 28 | tags = {}, 29 | glue = {"foo", "bar"}) 30 | public class Parallel01IT { 31 | }""" 32 | 33 | String expected02 = 34 | """import org.junit.runner.RunWith; 35 | 36 | import cucumber.api.CucumberOptions; 37 | import cucumber.api.junit.Cucumber; 38 | 39 | @RunWith(Cucumber.class) 40 | @CucumberOptions( 41 | strict = true, 42 | features = {"${feature2.absolutePath}"}, 43 | plugin = {"json:${buildDirectory.absolutePath}/my-custom-dir/2.json"}, 44 | monochrome = false, 45 | tags = {}, 46 | glue = {"foo", "bar"}) 47 | public class Parallel02IT { 48 | }""" 49 | 50 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 51 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 52 | 53 | -------------------------------------------------------------------------------- /src/it/junit/custom-package/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | foo.bar 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/it/junit/custom-package/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/custom-package/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/custom-package/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/foo/bar/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/foo/bar/Parallel02IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """package foo.bar; 18 | 19 | import org.junit.runner.RunWith; 20 | 21 | import cucumber.api.CucumberOptions; 22 | import cucumber.api.junit.Cucumber; 23 | 24 | @RunWith(Cucumber.class) 25 | @CucumberOptions( 26 | strict = true, 27 | features = {"${feature1.absolutePath}"}, 28 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 29 | monochrome = false, 30 | tags = {}, 31 | glue = {"foo", "bar"}) 32 | public class Parallel01IT { 33 | }""" 34 | 35 | String expected02 = 36 | """package foo.bar; 37 | 38 | import org.junit.runner.RunWith; 39 | 40 | import cucumber.api.CucumberOptions; 41 | import cucumber.api.junit.Cucumber; 42 | 43 | @RunWith(Cucumber.class) 44 | @CucumberOptions( 45 | strict = true, 46 | features = {"${feature2.absolutePath}"}, 47 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 48 | monochrome = false, 49 | tags = {}, 50 | glue = {"foo", "bar"}) 51 | public class Parallel02IT { 52 | }""" 53 | 54 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 55 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 56 | 57 | -------------------------------------------------------------------------------- /src/it/junit/custom-plugin-no-output/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/custom-plugin-no-output/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 6 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 7 | 8 | assert suite01.isFile() 9 | 10 | String expected01 = 11 | """import org.junit.runner.RunWith; 12 | 13 | import cucumber.api.CucumberOptions; 14 | import cucumber.api.junit.Cucumber; 15 | 16 | @RunWith(Cucumber.class) 17 | @CucumberOptions( 18 | strict = true, 19 | features = {"${feature1.absolutePath}"}, 20 | plugin = {"path.to.my.formaters.NoOutputFormatter"}, 21 | monochrome = false, 22 | tags = {}, 23 | glue = {"path.to.my.formaters"}) 24 | public class Parallel01IT { 25 | }""" 26 | 27 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 28 | -------------------------------------------------------------------------------- /src/it/junit/custom-plugins/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/custom-plugins/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 7 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 8 | 9 | assert suite01.isFile() 10 | 11 | String expected01 = 12 | """import org.junit.runner.RunWith; 13 | 14 | import cucumber.api.CucumberOptions; 15 | import cucumber.api.junit.Cucumber; 16 | 17 | @RunWith(Cucumber.class) 18 | @CucumberOptions( 19 | strict = true, 20 | features = {"${feature1.absolutePath}"}, 21 | plugin = {"path.to.my.formaters.CustomHtmlFormatter:${buildDirectory.absolutePath}/cucumber-parallel/1.html", "path.to.my.formaters.CustomJsonFormatter:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 22 | monochrome = false, 23 | tags = {}, 24 | glue = {"path.to.my.formaters"}) 25 | public class Parallel01IT { 26 | }""" 27 | 28 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 29 | -------------------------------------------------------------------------------- /src/it/junit/custom-template/custom-template-test.vm: -------------------------------------------------------------------------------- 1 | // This is a custom template for $className -------------------------------------------------------------------------------- /src/it/junit/custom-template/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | custom-template 9 | 1.0-SNAPSHOT 10 | 11 | Output using a custom velocity template 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-testng 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | 47 | 48 | foo 49 | bar 50 | 51 | custom-template-test.vm 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/it/junit/custom-template/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Custom File for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/Parallel01IT.java" should exist 7 | And it should contain: 8 | """ 9 | // This is a custom template for Parallel01IT 10 | """ -------------------------------------------------------------------------------- /src/it/junit/custom-template/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature2 2 | 3 | Scenario: Generate Custom File for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/Parallel02IT.java" should exist 7 | And it should contain: 8 | """ 9 | // This is a custom template for Parallel02IT 10 | """ -------------------------------------------------------------------------------- /src/it/junit/custom-template/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | def outputPath = "target/generated-test-sources/cucumber/" 6 | File suite01 = new File(basedir, outputPath + "Parallel01IT.java") 7 | File suite02 = new File(basedir, outputPath + "Parallel02IT.java") 8 | 9 | assert suite01.isFile() 10 | assert suite02.isFile() 11 | 12 | String expected01 = "// This is a custom template for Parallel01IT" 13 | String expected02 = "// This is a custom template for Parallel02IT" 14 | 15 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 16 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 17 | 18 | -------------------------------------------------------------------------------- /src/it/junit/extents-report/src/test/resources/cucumber-extents-report-runner.java.vm: -------------------------------------------------------------------------------- 1 | #parse("/array.java.vm") 2 | #if ($packageName) 3 | package $packageName; 4 | 5 | #end 6 | import org.junit.AfterClass; 7 | import org.junit.BeforeClass; 8 | import org.junit.runner.RunWith; 9 | 10 | import cucumber.api.CucumberOptions; 11 | import cucumber.api.junit.Cucumber; 12 | import com.cucumber.listener.Reporter; 13 | 14 | import java.io.File; 15 | 16 | @RunWith(Cucumber.class) 17 | @CucumberOptions( 18 | strict = $strict, 19 | features = {"$featureFile"}, 20 | plugin = #stringArray($plugins), 21 | monochrome = $monochrome, 22 | #if(!$featureFile.contains(".feature:") && $tags) 23 | tags = #stringArray($tags), 24 | #end 25 | glue = #stringArray($glue)) 26 | public class $className { 27 | 28 | @BeforeClass 29 | public static void beforeClass(){ 30 | //Do things 31 | } 32 | 33 | @AfterClass 34 | public static void afterClass(){ 35 | Reporter.loadXMLConfig(new File("src/test/resources/extent-config.xml")); 36 | Reporter.setSystemInfo("user", System.getProperty("user.name")); 37 | Reporter.setSystemInfo("os", "Mac OSX"); 38 | Reporter.setTestRunnerOutput("Sample test runner output message"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/it/junit/extents-report/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/extents-report/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @feature1 2 | Feature: Feature1 3 | 4 | Scenario: Matching tags are included 5 | Then this feature should should be included 6 | 7 | Scenario: Another Matching tags are included 8 | Then this feature should should be included 9 | 10 | Scenario: Yet another Matching tags are included 11 | Then this feature should should be included 12 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @feature2 2 | Feature: Feature2 3 | 4 | Scenario: Non Matching tags are excluded 5 | Then this feature should should be excluded 6 | 7 | Scenario: More Non Matching tags are excluded 8 | Then this feature should should be excluded 9 | 10 | Scenario: And more Non Matching tags are excluded 11 | Then this feature should should be excluded 12 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | 12 | assert suite01.isFile() 13 | // Only one file should be created 14 | assert !suite02.isFile() 15 | 16 | String expected01 = 17 | """import org.junit.runner.RunWith; 18 | 19 | import cucumber.api.CucumberOptions; 20 | import cucumber.api.junit.Cucumber; 21 | 22 | @RunWith(Cucumber.class) 23 | @CucumberOptions( 24 | strict = true, 25 | features = {"${feature.absolutePath}"}, 26 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 27 | monochrome = false, 28 | tags = {"@feature1"}, 29 | glue = {"foo", "bar"}) 30 | public class Parallel01IT { 31 | }""" 32 | 33 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 34 | 35 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag2-negation/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @feature1 2 | Feature: Feature1 3 | 4 | Scenario: Excluded tags are ignored 5 | Then this file will be excluded 6 | 7 | Scenario: Another Scenario 8 | Then this file will be excluded 9 | 10 | Scenario: Yet another Scenario 11 | Then this file will be excluded 12 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag2-negation/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @feature2 2 | Feature: Feature2 3 | 4 | Scenario: Matching tags 5 | Then this file will be included 6 | 7 | Scenario: More Matching tags 8 | Then this file will be included 9 | 10 | Scenario: Even more Matching tags 11 | Then this file will be included 12 | 13 | Scenario: Even even more Matching tags 14 | Then this file will be included -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag2-negation/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert; 2 | 3 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 4 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 5 | 6 | assert suite01.isFile() 7 | assert !suite02.isFile() 8 | 9 | String expected = "feature2.feature" 10 | 11 | Assert.assertTrue(suite01.text.contains(expected)) 12 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag3-and/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @feature1 2 | Feature: Feature1 3 | 4 | @required 5 | Scenario: Matching tags are included 6 | Then this feature should should be included 7 | 8 | @required 9 | Scenario: More Matching tags are included 10 | Then this feature should should be included 11 | 12 | Scenario: Missing tags are excluded 13 | Then this feature should should be excluded 14 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag3-and/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @feature2 2 | Feature: Feature2 3 | 4 | @required 5 | Scenario: Matching tags are included 6 | Then this feature should should be included 7 | 8 | 9 | Scenario: Missing tags are excluded 10 | Then this feature should should be excluded 11 | 12 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag3-and/src/test/resources/features/feature3.feature: -------------------------------------------------------------------------------- 1 | @feature3 2 | Feature: Feature3 3 | 4 | Scenario: Non matching tags are ignored 5 | Then this feature should should be ignored 6 | 7 | Scenario: More Non matching tags are ignored 8 | Then this feature should should be ignored 9 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag3-and/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert; 2 | 3 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 4 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 5 | 6 | assert suite01.isFile() 7 | // Only one file should be created 8 | assert !suite02.isFile() 9 | 10 | String expected01 = "feature1.feature" 11 | 12 | Assert.assertTrue(suite01.text.contains(expected01)) 13 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag3-or/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @feature1 2 | Feature: Feature1 3 | 4 | Scenario: Matching tags are included 5 | Then this feature should should be included 6 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag3-or/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @feature2 2 | Feature: Feature2 3 | 4 | Scenario: Matching tags are included 5 | Then this feature should should be included 6 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag3-or/src/test/resources/features/feature3.feature: -------------------------------------------------------------------------------- 1 | @feature3 2 | Feature: Feature3 3 | 4 | Scenario: Non matching tags are ignored 5 | Then this feature should should be ignored -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag3-or/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert; 2 | 3 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 4 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 5 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel03IT.java"); 6 | 7 | assert suite01.isFile() 8 | assert suite02.isFile() 9 | assert !suite03.isFile() 10 | 11 | String expected01 = "feature1.feature" 12 | String expected02 = "feature2.feature" 13 | 14 | Assert.assertTrue(suite01.text.contains(expected01)) 15 | Assert.assertTrue(suite02.text.contains(expected02)) 16 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag4/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @unwanted 2 | Feature: Feature1 3 | 4 | @includeMe 5 | Scenario: Required and excluded tags in the same file 6 | Then this file will be included 7 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag4/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @includeMe 2 | Feature: Feature2 3 | 4 | Scenario: Required tag is included only 5 | Then this file will be included -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag4/src/test/resources/features/feature3.feature: -------------------------------------------------------------------------------- 1 | @unwanted 2 | Feature: Feature2 3 | 4 | Scenario: Excluded tag only 5 | Then this file will be excluded -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag4/src/test/resources/features/feature4.feature: -------------------------------------------------------------------------------- 1 | @otherTag 2 | Feature: Feature2 3 | 4 | Scenario: No required/excluded tags 5 | Then this file will be excluded -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag4/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert; 2 | 3 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 4 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 5 | 6 | assert suite01.isFile() 7 | assert !suite02.isFile() 8 | 9 | String expected01 = "feature2.feature" 10 | Assert.assertTrue(suite01.text.contains(expected01)) 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @feature1 2 | Feature: Feature1 3 | 4 | Scenario: Matching tags are included 5 | Then this feature should should be included 6 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @feature2 2 | Feature: Feature2 3 | 4 | Scenario: Non-matching tags are excluded 5 | Then this feature should should be excluded 6 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | 12 | assert suite01.isFile() 13 | // Only one file should be created 14 | assert !suite02.isFile() 15 | 16 | String expected01 = 17 | """import org.junit.runner.RunWith; 18 | 19 | import cucumber.api.CucumberOptions; 20 | import cucumber.api.junit.Cucumber; 21 | 22 | @RunWith(Cucumber.class) 23 | @CucumberOptions( 24 | strict = true, 25 | features = {"${feature.absolutePath}"}, 26 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 27 | monochrome = false, 28 | tags = {"@feature1"}, 29 | glue = {"foo", "bar"}) 30 | public class Parallel01IT { 31 | }""" 32 | 33 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 34 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @feature1 @override 2 | Feature: Feature1 3 | 4 | Scenario: Matching override tags are included 5 | Then this feature should be included 6 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @feature2 @override 2 | Feature: Feature2 3 | 4 | Scenario: Matching override tags are included 5 | Then this feature should be included 6 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/src/test/resources/features/feature3.feature: -------------------------------------------------------------------------------- 1 | @feature3 2 | Feature: Feature3 3 | 4 | Scenario: Non-matching override tags are excluded 5 | Then this feature should be excluded 6 | -------------------------------------------------------------------------------- /src/it/junit/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel03IT.java"); 10 | 11 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 12 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 13 | 14 | assert suite01.isFile() 15 | assert suite02.isFile() 16 | // Only two files should be created 17 | assert !suite03.isFile() 18 | 19 | String expected01 = 20 | """import org.junit.runner.RunWith; 21 | 22 | import cucumber.api.CucumberOptions; 23 | import cucumber.api.junit.Cucumber; 24 | 25 | @RunWith(Cucumber.class) 26 | @CucumberOptions( 27 | strict = true, 28 | features = {"${feature1.absolutePath}"}, 29 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 30 | monochrome = false, 31 | tags = {"@override"}, 32 | glue = {"foo", "bar"}) 33 | public class Parallel01IT { 34 | }""" 35 | 36 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 37 | 38 | String expected02 = 39 | """import org.junit.runner.RunWith; 40 | 41 | import cucumber.api.CucumberOptions; 42 | import cucumber.api.junit.Cucumber; 43 | 44 | @RunWith(Cucumber.class) 45 | @CucumberOptions( 46 | strict = true, 47 | features = {"${feature2.absolutePath}"}, 48 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 49 | monochrome = false, 50 | tags = {"@override"}, 51 | glue = {"foo", "bar"}) 52 | public class Parallel02IT { 53 | }""" 54 | 55 | 56 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 57 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) -------------------------------------------------------------------------------- /src/it/junit/filter-tag-expressions-feature/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | @europe and not (@germany) 47 | 48 | 49 | foo 50 | bar 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/it/junit/filter-tag-expressions-feature/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @europe 2 | Feature: Feature1 3 | 4 | Scenario: Generate Junit Runner for each feature file 5 | Given I have feature files 6 | When I generate Maven sources 7 | Then the file "target/generated-test-sources/1IT.java" should exist 8 | And it should contain: 9 | 10 | @germany 11 | Scenario: Generate Junit Runner for each feature file second 12 | Given I have feature files 13 | When I generate Maven sources 14 | Then the file "target/generated-test-sources/1IT.java" should exist 15 | And it should contain: 16 | -------------------------------------------------------------------------------- /src/it/junit/filter-tag-expressions-feature/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | 9 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 10 | 11 | assert suite01.isFile() 12 | 13 | String expected01 = 14 | """import org.junit.runner.RunWith; 15 | 16 | import cucumber.api.CucumberOptions; 17 | import cucumber.api.junit.Cucumber; 18 | 19 | @RunWith(Cucumber.class) 20 | @CucumberOptions( 21 | strict = true, 22 | features = {"${feature1.absolutePath}"}, 23 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 24 | monochrome = false, 25 | tags = {"@europe and not (@germany)"}, 26 | glue = {"foo", "bar"}) 27 | public class Parallel01IT { 28 | }""" 29 | 30 | 31 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) -------------------------------------------------------------------------------- /src/it/junit/filter-tag-expressions-scenario/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @europe 2 | Feature: Feature1 3 | 4 | Scenario: Generate Junit Runner for each feature file 5 | Given I have feature files 6 | When I generate Maven sources 7 | Then the file "target/generated-test-sources/1IT.java" should exist 8 | And it should contain: 9 | 10 | @germany 11 | Scenario: Generate Junit Runner for each feature file second 12 | Given I have feature files 13 | When I generate Maven sources 14 | Then the file "target/generated-test-sources/1IT.java" should exist 15 | And it should contain: 16 | -------------------------------------------------------------------------------- /src/it/junit/filter-tag-expressions-scenario/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | 12 | assert suite01.isFile() 13 | assert !suite02.isFile() 14 | 15 | String expected01 = 16 | """import org.junit.runner.RunWith; 17 | 18 | import cucumber.api.CucumberOptions; 19 | import cucumber.api.junit.Cucumber; 20 | 21 | @RunWith(Cucumber.class) 22 | @CucumberOptions( 23 | strict = true, 24 | features = {"${feature1.absolutePath}:4"}, 25 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 26 | monochrome = false, 27 | glue = {"foo", "bar"}) 28 | public class Parallel01IT { 29 | }""" 30 | 31 | 32 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) -------------------------------------------------------------------------------- /src/it/junit/illegal-escape-char/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | target\cucumber-reports 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/it/junit/illegal-escape-char/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-reports/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/illegal-escape-char/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | 9 | File feature = new File(basedir, "/src/test/resources/features/feature1.feature"); 10 | 11 | assert suite01.isFile() 12 | 13 | String expected01 = 14 | """import org.junit.runner.RunWith; 15 | 16 | import cucumber.api.CucumberOptions; 17 | import cucumber.api.junit.Cucumber; 18 | 19 | @RunWith(Cucumber.class) 20 | @CucumberOptions( 21 | strict = true, 22 | features = {"${feature.absolutePath}"}, 23 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-reports/1.json"}, 24 | monochrome = false, 25 | tags = {}, 26 | glue = {"foo", "bar"}) 27 | public class Parallel01IT { 28 | }""" 29 | 30 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 31 | -------------------------------------------------------------------------------- /src/it/junit/issue_112-tags-in-vm-feature-mode/custom-template-test.vm: -------------------------------------------------------------------------------- 1 | /* 2 | The feature tags are: 3 | #foreach($tag in $feature.getTags() ) 4 | $tag.getName() 5 | #end 6 | 7 | The scenario definition tags are: 8 | #foreach($tag in $scenario.getTags() ) 9 | $tag.getName() 10 | #end 11 | 12 | */ -------------------------------------------------------------------------------- /src/it/junit/issue_112-tags-in-vm-feature-mode/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | issue_112-feature-scenario-tags-in-vm 9 | 1.0-SNAPSHOT 10 | 11 | Output of scenario and feature tags in custom velocity template 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-testng 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | 47 | 48 | foo 49 | bar 50 | 51 | FEATURE 52 | custom-template-test.vm 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/junit/issue_112-tags-in-vm-feature-mode/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @featureTag 2 | @myOtherFeatureTag("Value") 3 | Feature: Feature1 4 | 5 | @scenarioTag1 6 | @myOtherScenarioTag("Value") 7 | Scenario: Ensure Velocity feature variable available for scenario 8 | Given I have feature files with tags on feature and scenarios 9 | And I have a custom VM file using the supplied feature 10 | When I generate runners per scenario 11 | Then the file "target/generated-test-sources/Parallel01IT.java" should exist 12 | And it should contain: 13 | """ 14 | // This is a custom template for Parallel01IT 15 | """ 16 | 17 | @outlineTag 18 | @myOtherScenarioOutlineTag("Value") 19 | Scenario Outline: Ensure Velocity feature variable available for scenario outline 20 | Given I have a scenario with tags on feature and scenarios with 2 examples 21 | When I generate runners per scenario 22 | Then a runner should be created for example 23 | And the file "target/generated-test-sources/Parallel02IT.java" should exist 24 | And the file "target/generated-test-sources/Parallel03IT.java" should exist 25 | 26 | 27 | Examples: 28 | | example | 29 | | foo | 30 | | bar | 31 | -------------------------------------------------------------------------------- /src/it/junit/issue_112-tags-in-vm-feature-mode/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java") 6 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java") 7 | 8 | assert suite01.isFile() 9 | assert !suite02.isFile() 10 | 11 | String expected01 = 12 | """ 13 | /* 14 | The feature tags are: 15 | @featureTag 16 | @myOtherFeatureTag(\\"Value\\") 17 | 18 | The scenario definition tags are: 19 | 20 | */ 21 | """ 22 | 23 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) -------------------------------------------------------------------------------- /src/it/junit/issue_112-tags-in-vm-scenario-mode/custom-template-test.vm: -------------------------------------------------------------------------------- 1 | /* 2 | The feature tags are: 3 | #foreach($tag in $feature.getTags() ) 4 | $tag.getName() 5 | #end 6 | 7 | The scenario definition tags are: 8 | #foreach($tag in $scenario.getTags() ) 9 | $tag.getName() 10 | #end 11 | 12 | */ -------------------------------------------------------------------------------- /src/it/junit/issue_112-tags-in-vm-scenario-mode/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | issue_112-feature-scenario-tags-in-vm 9 | 1.0-SNAPSHOT 10 | 11 | Output of scenario and feature tags in custom velocity template 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-testng 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | 47 | 48 | foo 49 | bar 50 | 51 | SCENARIO 52 | custom-template-test.vm 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/junit/issue_112-tags-in-vm-scenario-mode/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @featureTag 2 | @myOtherFeatureTag("Value") 3 | Feature: Feature1 4 | 5 | @scenarioTag1 6 | @myOtherScenarioTag("Value") 7 | Scenario: Ensure Velocity feature variable available for scenario 8 | Given I have feature files with tags on feature and scenarios 9 | And I have a custom VM file using the supplied feature 10 | When I generate runners per scenario 11 | Then the file "target/generated-test-sources/Parallel01IT.java" should exist 12 | And it should contain: 13 | """ 14 | // This is a custom template for Parallel01IT 15 | """ 16 | 17 | @outlineTag 18 | @myOtherScenarioOutlineTag("Value") 19 | Scenario Outline: Ensure Velocity feature variable available for scenario outline 20 | Given I have a scenario with tags on feature and scenarios with 2 examples 21 | When I generate runners per scenario 22 | Then a runner should be created for example 23 | And the file "target/generated-test-sources/Parallel02IT.java" should exist 24 | And the file "target/generated-test-sources/Parallel03IT.java" should exist 25 | 26 | 27 | Examples: 28 | | example | 29 | | foo | 30 | | bar | 31 | -------------------------------------------------------------------------------- /src/it/junit/issue_112-tags-in-vm-scenario-mode/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java") 6 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java") 7 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel03IT.java") 8 | 9 | assert suite01.isFile() 10 | assert suite02.isFile() 11 | assert suite03.isFile() 12 | 13 | String expected01 = 14 | """ 15 | /* 16 | The feature tags are: 17 | @featureTag 18 | @myOtherFeatureTag(\\"Value\\") 19 | 20 | The scenario definition tags are: 21 | @scenarioTag1 22 | @myOtherScenarioTag(\\"Value\\") 23 | 24 | */ 25 | """ 26 | 27 | String expected02 = 28 | """ 29 | /* 30 | The feature tags are: 31 | @featureTag 32 | @myOtherFeatureTag(\\"Value\\") 33 | 34 | The scenario definition tags are: 35 | @outlineTag 36 | @myOtherScenarioOutlineTag(\\"Value\\") 37 | 38 | */ 39 | """ 40 | 41 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 42 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 43 | 44 | -------------------------------------------------------------------------------- /src/it/junit/issue_15-feature-naming-scheme/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | feature-title 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/it/junit/issue_15-feature-naming-scheme/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/issue_15-feature-naming-scheme/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/issue_15-feature-naming-scheme/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Feature101IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Feature202IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import org.junit.runner.RunWith; 18 | 19 | import cucumber.api.CucumberOptions; 20 | import cucumber.api.junit.Cucumber; 21 | 22 | @RunWith(Cucumber.class) 23 | @CucumberOptions( 24 | strict = true, 25 | features = {"${feature1.absolutePath}"}, 26 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 27 | monochrome = false, 28 | tags = {}, 29 | glue = {"foo", "bar"}) 30 | public class Feature101IT { 31 | }""" 32 | 33 | String expected02 = 34 | """import org.junit.runner.RunWith; 35 | 36 | import cucumber.api.CucumberOptions; 37 | import cucumber.api.junit.Cucumber; 38 | 39 | @RunWith(Cucumber.class) 40 | @CucumberOptions( 41 | strict = true, 42 | features = {"${feature2.absolutePath}"}, 43 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 44 | monochrome = false, 45 | tags = {}, 46 | glue = {"foo", "bar"}) 47 | public class Feature202IT { 48 | }""" 49 | 50 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 51 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 52 | -------------------------------------------------------------------------------- /src/it/junit/issue_19-complex-naming-scheme/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | pattern 50 | Foo{f}{c}IT 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/junit/issue_19-complex-naming-scheme/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/issue_19-complex-naming-scheme/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/issue_19-complex-naming-scheme/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/FooFeature101IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/FooFeature202IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import org.junit.runner.RunWith; 18 | 19 | import cucumber.api.CucumberOptions; 20 | import cucumber.api.junit.Cucumber; 21 | 22 | @RunWith(Cucumber.class) 23 | @CucumberOptions( 24 | strict = true, 25 | features = {"${feature1.absolutePath}"}, 26 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 27 | monochrome = false, 28 | tags = {}, 29 | glue = {"foo", "bar"}) 30 | public class FooFeature101IT { 31 | }""" 32 | 33 | String expected02 = 34 | """import org.junit.runner.RunWith; 35 | 36 | import cucumber.api.CucumberOptions; 37 | import cucumber.api.junit.Cucumber; 38 | 39 | @RunWith(Cucumber.class) 40 | @CucumberOptions( 41 | strict = true, 42 | features = {"${feature2.absolutePath}"}, 43 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 44 | monochrome = false, 45 | tags = {}, 46 | glue = {"foo", "bar"}) 47 | public class FooFeature202IT { 48 | }""" 49 | 50 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 51 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 52 | -------------------------------------------------------------------------------- /src/it/junit/issue_19-multiple-execution/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/issue_19-multiple-execution/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/issue_19-multiple-execution/verify.groovy: -------------------------------------------------------------------------------- 1 | // Multiple runs should not overwrite files. 2 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 3 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 4 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel03IT.java"); 5 | File suite04 = new File(basedir, "target/generated-test-sources/cucumber/Parallel04IT.java"); 6 | 7 | assert suite01.isFile() 8 | assert suite02.isFile() 9 | assert suite03.isFile() 10 | assert suite04.isFile() 11 | 12 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/java/com/github/timm/Steps.java: -------------------------------------------------------------------------------- 1 | package com.github.timm; 2 | 3 | import cucumber.api.java.en.*; 4 | 5 | public class Steps { 6 | @Given("^I have a feature with (\\d+) scenarios$") 7 | public void i_have_a_feature_with_scenarios(final int arg1) throws Throwable { 8 | } 9 | 10 | @When("^I generate runners per scenario$") 11 | public void i_generate_runners_per_scenario() throws Throwable { 12 | } 13 | 14 | @Then("^a runner should be created for each scenario$") 15 | public void a_runner_should_be_created_for_each_scenario() throws Throwable { 16 | } 17 | 18 | @Given("^I have a scenario with (\\d+) examples$") 19 | public void i_have_a_scenario_with_examples(final int arg1) throws Throwable { 20 | } 21 | 22 | @Then("^a runner should be created for foo example$") 23 | public void a_runner_should_be_created_for_foo_example() throws Throwable { 24 | } 25 | 26 | @Then("^a runner should be created for bar example$") 27 | public void a_runner_should_be_created_for_bar_example() throws Throwable { 28 | } 29 | 30 | @Then("^a runner should be created for baz example$") 31 | public void a_runner_should_be_created_for_baz_example() throws Throwable { 32 | } 33 | @Given("^I have feature files$") 34 | public void i_have_feature_files() throws Throwable { 35 | } 36 | 37 | @When("^I generate Maven sources$") 38 | public void i_generate_Maven_sources() throws Throwable { 39 | } 40 | 41 | @Then("^the file \"(.*?)\" should exist$") 42 | public void the_file_should_exist(final String arg1) throws Throwable { 43 | } 44 | 45 | @Then("^it should contain:$") 46 | public void it_should_contain(final String arg1) throws Throwable { 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate runners per scenario 4 | Given I have a feature with 2 scenarios 5 | When I generate runners per scenario 6 | Then a runner should be created for each scenario 7 | 8 | @outlineTag 9 | Scenario Outline: Generate runners per example in a scenario outline 10 | Given I have a scenario with 3 examples 11 | When I generate runners per scenario 12 | Then a runner should be created for example 13 | 14 | Examples: 15 | | example | 16 | | foo | 17 | | bar | 18 | | baz | 19 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/cucumber-parallel/1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "line": 1, 4 | "elements": [ 5 | { 6 | "line": 16, 7 | "name": "Generate runners per example in a scenario outline", 8 | "description": "", 9 | "id": "feature1;generate-runners-per-example-in-a-scenario-outline;;2", 10 | "type": "scenario", 11 | "keyword": "Scenario Outline", 12 | "steps": [ 13 | { 14 | "result": { 15 | "duration": 88876763, 16 | "status": "passed" 17 | }, 18 | "line": 10, 19 | "name": "I have a scenario with 3 examples", 20 | "match": { 21 | "arguments": [ 22 | { 23 | "val": "3", 24 | "offset": 23 25 | } 26 | ], 27 | "location": "Steps.i_have_a_scenario_with_examples(int)" 28 | }, 29 | "keyword": "Given " 30 | }, 31 | { 32 | "result": { 33 | "duration": 29792, 34 | "status": "passed" 35 | }, 36 | "line": 11, 37 | "name": "I generate runners per scenario", 38 | "match": { 39 | "location": "Steps.i_generate_runners_per_scenario()" 40 | }, 41 | "keyword": "When " 42 | }, 43 | { 44 | "result": { 45 | "duration": 24486, 46 | "status": "passed" 47 | }, 48 | "line": 12, 49 | "name": "a runner should be created for foo example", 50 | "match": { 51 | "location": "Steps.a_runner_should_be_created_for_foo_example()" 52 | }, 53 | "matchedColumns": [ 54 | 0 55 | ], 56 | "keyword": "Then " 57 | } 58 | ], 59 | "tags": [ 60 | { 61 | "line": 8, 62 | "name": "@outlineTag" 63 | } 64 | ] 65 | } 66 | ], 67 | "name": "Feature1", 68 | "description": "", 69 | "id": "feature1", 70 | "keyword": "Feature", 71 | "uri": "/Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/resources/features/feature2.feature" 72 | } 73 | ] -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/cucumber-parallel/2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "line": 1, 4 | "elements": [ 5 | { 6 | "line": 17, 7 | "name": "Generate runners per example in a scenario outline", 8 | "description": "", 9 | "id": "feature1;generate-runners-per-example-in-a-scenario-outline;;3", 10 | "type": "scenario", 11 | "keyword": "Scenario Outline", 12 | "steps": [ 13 | { 14 | "result": { 15 | "duration": 6347164, 16 | "status": "passed" 17 | }, 18 | "line": 10, 19 | "name": "I have a scenario with 3 examples", 20 | "match": { 21 | "arguments": [ 22 | { 23 | "val": "3", 24 | "offset": 23 25 | } 26 | ], 27 | "location": "Steps.i_have_a_scenario_with_examples(int)" 28 | }, 29 | "keyword": "Given " 30 | }, 31 | { 32 | "result": { 33 | "duration": 23418, 34 | "status": "passed" 35 | }, 36 | "line": 11, 37 | "name": "I generate runners per scenario", 38 | "match": { 39 | "location": "Steps.i_generate_runners_per_scenario()" 40 | }, 41 | "keyword": "When " 42 | }, 43 | { 44 | "result": { 45 | "duration": 23055, 46 | "status": "passed" 47 | }, 48 | "line": 12, 49 | "name": "a runner should be created for bar example", 50 | "match": { 51 | "location": "Steps.a_runner_should_be_created_for_bar_example()" 52 | }, 53 | "matchedColumns": [ 54 | 0 55 | ], 56 | "keyword": "Then " 57 | } 58 | ], 59 | "tags": [ 60 | { 61 | "line": 8, 62 | "name": "@outlineTag" 63 | } 64 | ] 65 | } 66 | ], 67 | "name": "Feature1", 68 | "description": "", 69 | "id": "feature1", 70 | "keyword": "Feature", 71 | "uri": "/Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/resources/features/feature2.feature" 72 | } 73 | ] -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/cucumber-parallel/3.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "line": 1, 4 | "elements": [ 5 | { 6 | "line": 18, 7 | "name": "Generate runners per example in a scenario outline", 8 | "description": "", 9 | "id": "feature1;generate-runners-per-example-in-a-scenario-outline;;4", 10 | "type": "scenario", 11 | "keyword": "Scenario Outline", 12 | "steps": [ 13 | { 14 | "result": { 15 | "duration": 2372881, 16 | "status": "passed" 17 | }, 18 | "line": 10, 19 | "name": "I have a scenario with 3 examples", 20 | "match": { 21 | "arguments": [ 22 | { 23 | "val": "3", 24 | "offset": 23 25 | } 26 | ], 27 | "location": "Steps.i_have_a_scenario_with_examples(int)" 28 | }, 29 | "keyword": "Given " 30 | }, 31 | { 32 | "result": { 33 | "duration": 49439, 34 | "status": "passed" 35 | }, 36 | "line": 11, 37 | "name": "I generate runners per scenario", 38 | "match": { 39 | "location": "Steps.i_generate_runners_per_scenario()" 40 | }, 41 | "keyword": "When " 42 | }, 43 | { 44 | "result": { 45 | "duration": 19630, 46 | "status": "passed" 47 | }, 48 | "line": 12, 49 | "name": "a runner should be created for baz example", 50 | "match": { 51 | "location": "Steps.a_runner_should_be_created_for_baz_example()" 52 | }, 53 | "matchedColumns": [ 54 | 0 55 | ], 56 | "keyword": "Then " 57 | } 58 | ], 59 | "tags": [ 60 | { 61 | "line": 8, 62 | "name": "@outlineTag" 63 | } 64 | ] 65 | } 66 | ], 67 | "name": "Feature1", 68 | "description": "", 69 | "id": "feature1", 70 | "keyword": "Feature", 71 | "uri": "/Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/resources/features/feature2.feature" 72 | } 73 | ] -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/failsafe-reports/Parallel01IT.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | Test set: Parallel01IT 3 | ------------------------------------------------------------------------------- 4 | Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.474 sec - in Parallel01IT 5 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/failsafe-reports/Parallel02IT.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | Test set: Parallel02IT 3 | ------------------------------------------------------------------------------- 4 | Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.038 sec - in Parallel02IT 5 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/failsafe-reports/Parallel03IT.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | Test set: Parallel03IT 3 | ------------------------------------------------------------------------------- 4 | Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.038 sec - in Parallel03IT 5 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/failsafe-reports/failsafe-summary.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 4 | 0 5 | 0 6 | 0 7 | 8 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/generated-test-sources/cucumber/Parallel01IT.java: -------------------------------------------------------------------------------- 1 | import org.junit.runner.RunWith; 2 | 3 | import cucumber.api.CucumberOptions; 4 | import cucumber.api.junit.Cucumber; 5 | 6 | @RunWith(Cucumber.class) 7 | @CucumberOptions( 8 | strict = true, 9 | features = {"/Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/resources/features/feature2.feature:16"}, 10 | plugin = {"json:target/cucumber-parallel/1.json",}, 11 | monochrome = false, 12 | tags = {}, 13 | glue = { "com.github.timm" }) 14 | public class Parallel01IT { 15 | } 16 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/generated-test-sources/cucumber/Parallel02IT.java: -------------------------------------------------------------------------------- 1 | import org.junit.runner.RunWith; 2 | 3 | import cucumber.api.CucumberOptions; 4 | import cucumber.api.junit.Cucumber; 5 | 6 | @RunWith(Cucumber.class) 7 | @CucumberOptions( 8 | strict = true, 9 | features = {"/Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/resources/features/feature2.feature:17"}, 10 | plugin = {"json:target/cucumber-parallel/2.json",}, 11 | monochrome = false, 12 | tags = {}, 13 | glue = { "com.github.timm" }) 14 | public class Parallel02IT { 15 | } 16 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/generated-test-sources/cucumber/Parallel03IT.java: -------------------------------------------------------------------------------- 1 | import org.junit.runner.RunWith; 2 | 3 | import cucumber.api.CucumberOptions; 4 | import cucumber.api.junit.Cucumber; 5 | 6 | @RunWith(Cucumber.class) 7 | @CucumberOptions( 8 | strict = true, 9 | features = {"/Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/resources/features/feature2.feature:18"}, 10 | plugin = {"json:target/cucumber-parallel/3.json",}, 11 | monochrome = false, 12 | tags = {}, 13 | glue = { "com.github.timm" }) 14 | public class Parallel03IT { 15 | } 16 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Thu Nov 03 08:10:18 AWST 2016 3 | version=1.0-SNAPSHOT 4 | groupId=com.github.temyers.it 5 | artifactId=simple-it 6 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | Parallel02IT.class 2 | com/github/timm/Steps.class 3 | Parallel01IT.class 4 | Parallel03IT.class 5 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/target/generated-test-sources/cucumber/Parallel01IT.java 2 | /Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/target/generated-test-sources/cucumber/Parallel03IT.java 3 | /Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/target/generated-test-sources/cucumber/Parallel02IT.java 4 | /Users/tim/data/projects/personal/cucumber-jvm-parallel-plugin/src/it/junit/issue_43-outline_runner-filter-by-tag/src/test/java/com/github/timm/Steps.java 5 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/simple-it-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/src/it/junit/issue_43-outline_runner-filter-by-tag/target/simple-it-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/Parallel01IT.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/Parallel01IT.class -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/Parallel02IT.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/Parallel02IT.class -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/Parallel03IT.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/Parallel03IT.class -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/com/github/timm/Steps.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/temyers/cucumber-jvm-parallel-plugin/931628fc1e2822be667ec216e10e706993974aa4/src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/com/github/timm/Steps.class -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/target/test-classes/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate runners per scenario 4 | Given I have a feature with 2 scenarios 5 | When I generate runners per scenario 6 | Then a runner should be created for each scenario 7 | 8 | @outlineTag 9 | Scenario Outline: Generate runners per example in a scenario outline 10 | Given I have a scenario with 3 examples 11 | When I generate runners per scenario 12 | Then a runner should be created for example 13 | 14 | Examples: 15 | | example | 16 | | foo | 17 | | bar | 18 | | baz | 19 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner-filter-by-tag/verify.groovy: -------------------------------------------------------------------------------- 1 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 2 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 3 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel03IT.java"); 4 | File suite04 = new File(basedir, "target/generated-test-sources/cucumber/Parallel04IT.java"); 5 | 6 | assert suite01.isFile() 7 | assert suite02.isFile() 8 | assert suite03.isFile() 9 | assert !suite04.isFile() 10 | 11 | // TODO - add more asserts 12 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | SCENARIO 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate runners per scenario 4 | Given I have a feature with 2 scenarios 5 | When I generate runners per scenario 6 | Then a runner should be created for each scenario 7 | 8 | @outlineTag 9 | Scenario Outline: Generate runners per example in a scenario outline 10 | Given I have a scenario with 3 examples 11 | When I generate runners per scenario 12 | Then a runner should be created for example 13 | 14 | Examples: 15 | | example | 16 | | foo | 17 | | bar | 18 | | baz | 19 | -------------------------------------------------------------------------------- /src/it/junit/issue_43-outline_runner/verify.groovy: -------------------------------------------------------------------------------- 1 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 2 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 3 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel03IT.java"); 4 | File suite04 = new File(basedir, "target/generated-test-sources/cucumber/Parallel04IT.java"); 5 | File suite05 = new File(basedir, "target/generated-test-sources/cucumber/Parallel05IT.java"); 6 | 7 | assert suite01.isFile() 8 | assert suite02.isFile() 9 | assert suite03.isFile() 10 | assert suite04.isFile() 11 | assert suite05.isFile() 12 | 13 | // TODO - add more asserts 14 | -------------------------------------------------------------------------------- /src/it/junit/issue_50-no-tags/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/junit/issue_50-no-tags/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: A scenario without any tags 4 | Then this file will be included 5 | -------------------------------------------------------------------------------- /src/it/junit/issue_50-no-tags/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature2 2 | 3 | Scenario: Another scenario without any tags 4 | Then this file will be included 5 | -------------------------------------------------------------------------------- /src/it/junit/issue_50-no-tags/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert; 2 | 3 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 4 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 5 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel03IT.java"); 6 | 7 | assert suite01.isFile() 8 | assert suite02.isFile() 9 | assert !suite03.isFile() 10 | 11 | String noTags = "tags = {}" 12 | String expected01 = "feature1.feature" 13 | String expected02 = "feature2.feature" 14 | 15 | Assert.assertTrue(suite01.text.contains(noTags)) 16 | Assert.assertTrue(suite02.text.contains(noTags)) 17 | 18 | Assert.assertTrue(suite01.text.contains(expected01)) 19 | Assert.assertTrue(suite02.text.contains(expected02)) 20 | -------------------------------------------------------------------------------- /src/it/junit/issue_76-InconsistentFilters/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | @complete 4 | Scenario: Generate Junit Runner for each feature file 5 | Given I have feature files 6 | When I generate Maven sources 7 | Then the file "target/generated-test-sources/1IT.java" should exist 8 | And it should contain: 9 | """ 10 | @RunWith(Cucumber.class) 11 | @CucumberOptions( 12 | strict = true, 13 | features = {"classpath:features/feature1.feature:4"}, 14 | format = {"json:target/cucumber-parallel/1.json", 15 | "pretty"}, 16 | monochrome = false, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ 21 | -------------------------------------------------------------------------------- /src/it/junit/issue_76-InconsistentFilters/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | @accepted 4 | Scenario: Generate Junit Runner for each feature file 5 | Given I have feature files 6 | When I generate Maven sources 7 | Then the file "target/generated-test-sources/1IT.java" should exist 8 | And it should contain: 9 | """ 10 | @RunWith(Cucumber.class) 11 | @CucumberOptions( 12 | strict = true, 13 | features = {"classpath:features/feature2.feature:4"}, 14 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 15 | monochrome = false, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ 20 | -------------------------------------------------------------------------------- /src/it/junit/issue_76-InconsistentFilters/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import org.junit.runner.RunWith; 18 | 19 | import cucumber.api.CucumberOptions; 20 | import cucumber.api.junit.Cucumber; 21 | 22 | @RunWith(Cucumber.class) 23 | @CucumberOptions( 24 | strict = true, 25 | features = {"${feature1.absolutePath}:4"}, 26 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 27 | monochrome = false, 28 | glue = {"foo", "bar"}) 29 | public class Parallel01IT { 30 | }""" 31 | 32 | String expected02 = 33 | """import org.junit.runner.RunWith; 34 | 35 | import cucumber.api.CucumberOptions; 36 | import cucumber.api.junit.Cucumber; 37 | 38 | @RunWith(Cucumber.class) 39 | @CucumberOptions( 40 | strict = true, 41 | features = {"${feature2.absolutePath}:4"}, 42 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 43 | monochrome = false, 44 | glue = {"foo", "bar"}) 45 | public class Parallel02IT { 46 | }""" 47 | 48 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 49 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 50 | -------------------------------------------------------------------------------- /src/it/junit/modular-naming-pattern/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | pattern 50 | Group{c:3}Parallel{c}IT 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/junit/modular-naming-pattern/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/modular-naming-pattern/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature2 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/modular-naming-pattern/src/test/resources/features/feature3.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature3 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/modular-naming-pattern/src/test/resources/features/feature4.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature4 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/modular-naming-pattern/src/test/resources/features/feature5.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature5 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/modular-naming-pattern/src/test/resources/features/feature6.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature6 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/modular-naming-pattern/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Group0Parallel01IT.java") 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Group1Parallel02IT.java") 9 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Group2Parallel03IT.java") 10 | File suite04 = new File(basedir, "target/generated-test-sources/cucumber/Group0Parallel04IT.java") 11 | File suite05 = new File(basedir, "target/generated-test-sources/cucumber/Group1Parallel05IT.java") 12 | File suite06 = new File(basedir, "target/generated-test-sources/cucumber/Group2Parallel06IT.java") 13 | 14 | 15 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature") 16 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature") 17 | 18 | assert suite01.isFile() 19 | assert suite02.isFile() 20 | assert suite03.isFile() 21 | assert suite04.isFile() 22 | assert suite05.isFile() 23 | assert suite06.isFile() 24 | 25 | String expected01 = 26 | """import org.junit.runner.RunWith; 27 | 28 | import cucumber.api.CucumberOptions; 29 | import cucumber.api.junit.Cucumber; 30 | 31 | @RunWith(Cucumber.class) 32 | @CucumberOptions( 33 | strict = true, 34 | features = {"${feature1.absolutePath}"}, 35 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 36 | monochrome = false, 37 | tags = {}, 38 | glue = {"foo", "bar"}) 39 | public class Group0Parallel01IT { 40 | }""" 41 | 42 | String expected02 = 43 | """import org.junit.runner.RunWith; 44 | 45 | import cucumber.api.CucumberOptions; 46 | import cucumber.api.junit.Cucumber; 47 | 48 | @RunWith(Cucumber.class) 49 | @CucumberOptions( 50 | strict = true, 51 | features = {"${feature2.absolutePath}"}, 52 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 53 | monochrome = false, 54 | tags = {}, 55 | glue = {"foo", "bar"}) 56 | public class Group1Parallel02IT { 57 | }""" 58 | 59 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 60 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 61 | -------------------------------------------------------------------------------- /src/it/junit/multiple-format/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | Output test report in multiple formats 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | 47 | 48 | foo 49 | 50 | html,json,pretty 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/it/junit/multiple-format/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/multiple-format/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/multiple-format/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import org.junit.runner.RunWith; 18 | 19 | import cucumber.api.CucumberOptions; 20 | import cucumber.api.junit.Cucumber; 21 | 22 | @RunWith(Cucumber.class) 23 | @CucumberOptions( 24 | strict = true, 25 | features = {"${feature1.absolutePath}"}, 26 | plugin = {"html:${buildDirectory.absolutePath}/cucumber-parallel/1", "json:${buildDirectory.absolutePath}/cucumber-parallel/1.json", "pretty"}, 27 | monochrome = false, 28 | tags = {}, 29 | glue = {"foo"}) 30 | public class Parallel01IT { 31 | }""" 32 | 33 | String expected02 = 34 | """import org.junit.runner.RunWith; 35 | 36 | import cucumber.api.CucumberOptions; 37 | import cucumber.api.junit.Cucumber; 38 | 39 | @RunWith(Cucumber.class) 40 | @CucumberOptions( 41 | strict = true, 42 | features = {"${feature2.absolutePath}"}, 43 | plugin = {"html:${buildDirectory.absolutePath}/cucumber-parallel/2", "json:${buildDirectory.absolutePath}/cucumber-parallel/2.json", "pretty"}, 44 | monochrome = false, 45 | tags = {}, 46 | glue = {"foo"}) 47 | public class Parallel02IT { 48 | }""" 49 | 50 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 51 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 52 | -------------------------------------------------------------------------------- /src/it/junit/no-features-dir/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult=failure -------------------------------------------------------------------------------- /src/it/junit/no-features-dir/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | The features directory does not exist. The Mojo should fail 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | 47 | 48 | foo 49 | bar 50 | 51 | 52 | @complete 53 | @accepted 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /src/it/junit/no-features-dir/verify.groovy: -------------------------------------------------------------------------------- 1 | def logFile = new File(basedir, 'build.log') 2 | content = logFile.text 3 | 4 | assert content.contains('Features directory does not exist') 5 | -------------------------------------------------------------------------------- /src/it/junit/no-glue-specified/invoker.properties: -------------------------------------------------------------------------------- 1 | invoker.buildResult=failure -------------------------------------------------------------------------------- /src/it/junit/no-glue-specified/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | The glue parameters are not specified - the build should fail. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/it/junit/no-glue-specified/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/no-glue-specified/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/no-glue-specified/verify.groovy: -------------------------------------------------------------------------------- 1 | def logFile = new File(basedir, 'build.log') 2 | content = logFile.text 3 | 4 | assert content.contains("The parameters 'glue'") 5 | assert content.contains("are missing or invalid") 6 | -------------------------------------------------------------------------------- /src/it/junit/simple-it/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-junit 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/it/junit/simple-it/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/junit/simple-it/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/junit/simple-it/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import org.junit.runner.RunWith; 18 | 19 | import cucumber.api.CucumberOptions; 20 | import cucumber.api.junit.Cucumber; 21 | 22 | @RunWith(Cucumber.class) 23 | @CucumberOptions( 24 | strict = true, 25 | features = {"${feature1.absolutePath}"}, 26 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 27 | monochrome = false, 28 | tags = {}, 29 | glue = {"foo", "bar"}) 30 | public class Parallel01IT { 31 | }""" 32 | 33 | String expected02 = 34 | """import org.junit.runner.RunWith; 35 | 36 | import cucumber.api.CucumberOptions; 37 | import cucumber.api.junit.Cucumber; 38 | 39 | @RunWith(Cucumber.class) 40 | @CucumberOptions( 41 | strict = true, 42 | features = {"${feature2.absolutePath}"}, 43 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 44 | monochrome = false, 45 | tags = {}, 46 | glue = {"foo", "bar"}) 47 | public class Parallel02IT { 48 | }""" 49 | 50 | 51 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 52 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 53 | -------------------------------------------------------------------------------- /src/it/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 23 | 24 | 25 | it-repo 26 | 27 | true 28 | 29 | 30 | 31 | local.central 32 | @localRepositoryUrl@ 33 | 34 | true 35 | 36 | 37 | true 38 | 39 | 40 | 41 | 42 | 43 | local.central 44 | @localRepositoryUrl@ 45 | 46 | true 47 | 48 | 49 | true 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @feature1 2 | Feature: Feature1 3 | 4 | Scenario: Matching tags are included 5 | Then this feature should should be included 6 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @feature2 2 | Feature: Feature2 3 | 4 | Scenario: Non Matching tags are excluded 5 | Then this feature should should be excluded 6 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | 12 | assert suite01.isFile() 13 | // Only one file should be created 14 | assert !suite02.isFile() 15 | 16 | String expected01 = 17 | """import cucumber.api.CucumberOptions; 18 | import cucumber.api.testng.AbstractTestNGCucumberTests; 19 | 20 | @CucumberOptions( 21 | strict = true, 22 | features = {"${feature.absolutePath}"}, 23 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 24 | monochrome = false, 25 | tags = {"@feature1"}, 26 | glue = {"foo", "bar"}) 27 | public class Parallel01IT extends AbstractTestNGCucumberTests { 28 | }""" 29 | 30 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 31 | 32 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @feature1 2 | Feature: Feature1 3 | 4 | Scenario: Matching tags are included 5 | Then this feature should should be included 6 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @feature2 2 | Feature: Feature2 3 | 4 | Scenario: Non-matching tags are excluded 5 | Then this feature should should be excluded 6 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | 12 | assert suite01.isFile() 13 | // Only one file should be created 14 | assert !suite02.isFile() 15 | 16 | String expected01 = 17 | """import cucumber.api.CucumberOptions; 18 | import cucumber.api.testng.AbstractTestNGCucumberTests; 19 | 20 | @CucumberOptions( 21 | strict = true, 22 | features = {"${feature.absolutePath}"}, 23 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 24 | monochrome = false, 25 | tags = {"@feature1"}, 26 | glue = {"foo", "bar"}) 27 | public class Parallel01IT extends AbstractTestNGCucumberTests { 28 | }""" 29 | 30 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 31 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | @feature1 @override 2 | Feature: Feature1 3 | 4 | Scenario: Matching override tags are included 5 | Then this feature should be included 6 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | @feature2 @override 2 | Feature: Feature2 3 | 4 | Scenario: Matching override tags are included 5 | Then this feature should be included 6 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/src/test/resources/features/feature3.feature: -------------------------------------------------------------------------------- 1 | @feature3 2 | Feature: Feature3 3 | 4 | Scenario: Non-matching override tags are excluded 5 | Then this feature should be excluded 6 | -------------------------------------------------------------------------------- /src/it/testng/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel03IT.java"); 10 | 11 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 12 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 13 | 14 | assert suite01.isFile() 15 | assert suite02.isFile() 16 | // Only two files should be created 17 | assert !suite03.isFile() 18 | 19 | String expected01 = 20 | """import cucumber.api.CucumberOptions; 21 | import cucumber.api.testng.AbstractTestNGCucumberTests; 22 | 23 | @CucumberOptions( 24 | strict = true, 25 | features = {"${feature1.absolutePath}"}, 26 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 27 | monochrome = false, 28 | tags = {"@override"}, 29 | glue = {"foo", "bar"}) 30 | public class Parallel01IT extends AbstractTestNGCucumberTests { 31 | }""" 32 | 33 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 34 | 35 | String expected02 = 36 | """import cucumber.api.CucumberOptions; 37 | import cucumber.api.testng.AbstractTestNGCucumberTests; 38 | 39 | @CucumberOptions( 40 | strict = true, 41 | features = {"${feature2.absolutePath}"}, 42 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 43 | monochrome = false, 44 | tags = {"@override"}, 45 | glue = {"foo", "bar"}) 46 | public class Parallel02IT extends AbstractTestNGCucumberTests { 47 | }""" 48 | 49 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 50 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 51 | -------------------------------------------------------------------------------- /src/it/testng/illegal-escape-char/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-testng 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | target\cucumber-reports 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/testng/illegal-escape-char/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-reports/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/testng/illegal-escape-char/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | 9 | File feature = new File(basedir, "/src/test/resources/features/feature1.feature"); 10 | 11 | assert suite01.isFile() 12 | 13 | String expected01 = 14 | """import cucumber.api.CucumberOptions; 15 | import cucumber.api.testng.AbstractTestNGCucumberTests; 16 | 17 | @CucumberOptions( 18 | strict = true, 19 | features = {"${feature.absolutePath}"}, 20 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-reports/1.json"}, 21 | monochrome = false, 22 | tags = {}, 23 | glue = {"foo", "bar"}) 24 | public class Parallel01IT extends AbstractTestNGCucumberTests { 25 | }""" 26 | 27 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 28 | -------------------------------------------------------------------------------- /src/it/testng/issue_15-feature-naming-scheme/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-testng 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | feature-title 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/testng/issue_15-feature-naming-scheme/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/testng/issue_15-feature-naming-scheme/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/testng/issue_15-feature-naming-scheme/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Feature101IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Feature202IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = """import cucumber.api.CucumberOptions; 17 | import cucumber.api.testng.AbstractTestNGCucumberTests; 18 | 19 | @CucumberOptions( 20 | strict = true, 21 | features = {"${feature1.absolutePath}"}, 22 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 23 | monochrome = false, 24 | tags = {}, 25 | glue = {"foo", "bar"}) 26 | public class Feature101IT extends AbstractTestNGCucumberTests { 27 | }""" 28 | 29 | String expected02 = """import cucumber.api.CucumberOptions; 30 | import cucumber.api.testng.AbstractTestNGCucumberTests; 31 | 32 | @CucumberOptions( 33 | strict = true, 34 | features = {"${feature2.absolutePath}"}, 35 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 36 | monochrome = false, 37 | tags = {}, 38 | glue = {"foo", "bar"}) 39 | public class Feature202IT extends AbstractTestNGCucumberTests { 40 | }""" 41 | 42 | 43 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 44 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 45 | 46 | -------------------------------------------------------------------------------- /src/it/testng/issue_50-no-tags/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-testng 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | 50 | 51 | true 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/it/testng/issue_50-no-tags/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: A scenario without any tags 4 | Then this file will be included 5 | -------------------------------------------------------------------------------- /src/it/testng/issue_50-no-tags/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature2 2 | 3 | Scenario: Another scenario without any tags 4 | Then this file will be included 5 | -------------------------------------------------------------------------------- /src/it/testng/issue_50-no-tags/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert; 2 | 3 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 4 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 5 | File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel03IT.java"); 6 | 7 | assert suite01.isFile() 8 | assert suite02.isFile() 9 | assert !suite03.isFile() 10 | 11 | String noTags = "tags = {}" 12 | String expected01 = "feature1.feature" 13 | String expected02 = "feature2.feature" 14 | 15 | Assert.assertTrue(suite01.text.contains(noTags)) 16 | Assert.assertTrue(suite02.text.contains(noTags)) 17 | 18 | Assert.assertTrue(suite01.text.contains(expected01)) 19 | Assert.assertTrue(suite02.text.contains(expected02)) 20 | -------------------------------------------------------------------------------- /src/it/testng/issue_76-InconsistentFilters/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | @complete 4 | Scenario: Generate TestNG Runner for each feature file 5 | Given I have feature files 6 | When I generate Maven sources 7 | Then the file "target/generated-test-sources/1IT.java" should exist 8 | And it should contain: 9 | """ 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature:4"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | glue = {"foo", "bar"}) 17 | public class Parallel01IT extends AbstractTestNGCucumberTests { 18 | } 19 | """ 20 | -------------------------------------------------------------------------------- /src/it/testng/issue_76-InconsistentFilters/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | @accepted 4 | Scenario: Generate TestNG Runner for each feature file 5 | Given I have feature files 6 | When I generate Maven sources 7 | Then the file "target/generated-test-sources/1IT.java" should exist 8 | And it should contain: 9 | """ 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false,, 16 | glue = {"foo", "bar"}) 17 | public class Parallel01IT extends AbstractTestNGCucumberTests { 18 | } 19 | """ 20 | -------------------------------------------------------------------------------- /src/it/testng/issue_76-InconsistentFilters/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import cucumber.api.CucumberOptions; 18 | import cucumber.api.testng.AbstractTestNGCucumberTests; 19 | 20 | @CucumberOptions( 21 | strict = true, 22 | features = {"${feature1.absolutePath}:4"}, 23 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 24 | monochrome = false, 25 | glue = {"foo", "bar"}) 26 | public class Parallel01IT extends AbstractTestNGCucumberTests { 27 | }""" 28 | 29 | String expected02 = 30 | """import cucumber.api.CucumberOptions; 31 | import cucumber.api.testng.AbstractTestNGCucumberTests; 32 | 33 | @CucumberOptions( 34 | strict = true, 35 | features = {"${feature2.absolutePath}:4"}, 36 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 37 | monochrome = false, 38 | glue = {"foo", "bar"}) 39 | public class Parallel02IT extends AbstractTestNGCucumberTests { 40 | }""" 41 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 42 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 43 | -------------------------------------------------------------------------------- /src/it/testng/multiple-format/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | Output test report in multiple formats 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-testng 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | 47 | 48 | foo 49 | 50 | html,json,pretty 51 | true 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/it/testng/multiple-format/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/testng/multiple-format/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/testng/multiple-format/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import cucumber.api.CucumberOptions; 18 | import cucumber.api.testng.AbstractTestNGCucumberTests; 19 | 20 | @CucumberOptions( 21 | strict = true, 22 | features = {"${feature1.absolutePath}"}, 23 | plugin = {"html:${buildDirectory.absolutePath}/cucumber-parallel/1", "json:${buildDirectory.absolutePath}/cucumber-parallel/1.json", "pretty"}, 24 | monochrome = false, 25 | tags = {}, 26 | glue = {"foo"}) 27 | public class Parallel01IT extends AbstractTestNGCucumberTests { 28 | }""" 29 | 30 | String expected02 = 31 | """import cucumber.api.CucumberOptions; 32 | import cucumber.api.testng.AbstractTestNGCucumberTests; 33 | 34 | @CucumberOptions( 35 | strict = true, 36 | features = {"${feature2.absolutePath}"}, 37 | plugin = {"html:${buildDirectory.absolutePath}/cucumber-parallel/2", "json:${buildDirectory.absolutePath}/cucumber-parallel/2.json", "pretty"}, 38 | monochrome = false, 39 | tags = {}, 40 | glue = {"foo"}) 41 | public class Parallel02IT extends AbstractTestNGCucumberTests { 42 | }""" 43 | 44 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 45 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 46 | -------------------------------------------------------------------------------- /src/it/testng/output-directory/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | Output results to a custom directory 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-testng 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | 47 | 48 | foo 49 | bar 50 | 51 | target/my-custom-dir 52 | true 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/it/testng/output-directory/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature1.feature"}, 13 | format = {"json:target/cucumber-parallel/1.json", 14 | "pretty"}, 15 | monochrome = false, 16 | tags = {"@complete", "@accepted"}, 17 | glue = {"foo", "bar"}) 18 | public class Parallel01IT { 19 | } 20 | """ -------------------------------------------------------------------------------- /src/it/testng/output-directory/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate Junit Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @RunWith(Cucumber.class) 10 | @CucumberOptions( 11 | strict = true, 12 | features = {"classpath:features/feature2.feature"}, 13 | format = {"json:target/cucumber-parallel/2.json", "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel02IT { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/testng/output-directory/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import cucumber.api.CucumberOptions; 18 | import cucumber.api.testng.AbstractTestNGCucumberTests; 19 | 20 | @CucumberOptions( 21 | strict = true, 22 | features = {"${feature1.absolutePath}"}, 23 | plugin = {"json:${buildDirectory.absolutePath}/my-custom-dir/1.json"}, 24 | monochrome = false, 25 | tags = {}, 26 | glue = {"foo", "bar"}) 27 | public class Parallel01IT extends AbstractTestNGCucumberTests { 28 | }""" 29 | 30 | String expected02 = 31 | """import cucumber.api.CucumberOptions; 32 | import cucumber.api.testng.AbstractTestNGCucumberTests; 33 | 34 | @CucumberOptions( 35 | strict = true, 36 | features = {"${feature2.absolutePath}"}, 37 | plugin = {"json:${buildDirectory.absolutePath}/my-custom-dir/2.json"}, 38 | monochrome = false, 39 | tags = {}, 40 | glue = {"foo", "bar"}) 41 | public class Parallel02IT extends AbstractTestNGCucumberTests { 42 | }""" 43 | 44 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 45 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 46 | -------------------------------------------------------------------------------- /src/it/testng/simple-it/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.temyers.it 8 | simple-it 9 | 1.0-SNAPSHOT 10 | 11 | A simple IT verifying the basic use case. 12 | 13 | 14 | UTF-8 15 | 1.2.2 16 | 17 | 18 | 19 | 20 | info.cukes 21 | cucumber-testng 22 | ${cucumber.version} 23 | 24 | 25 | info.cukes 26 | cucumber-java 27 | ${cucumber.version} 28 | 29 | 30 | 31 | 32 | 33 | 34 | @project.groupId@ 35 | @project.artifactId@ 36 | @project.version@ 37 | 38 | 39 | generateRunners 40 | generate-test-sources 41 | 42 | generateRunners 43 | 44 | 45 | 46 | foo 47 | bar 48 | 49 | true 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/it/testng/simple-it/src/test/resources/features/feature1.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate TestNG Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @CucumberOptions( 10 | strict = true, 11 | features = {"classpath:features/feature1.feature"}, 12 | format = {"json:target/cucumber-parallel/1.json", 13 | "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel01IT extends AbstractTestNGCucumberTests { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/testng/simple-it/src/test/resources/features/feature2.feature: -------------------------------------------------------------------------------- 1 | Feature: Feature1 2 | 3 | Scenario: Generate TestNG Runner for each feature file 4 | Given I have feature files 5 | When I generate Maven sources 6 | Then the file "target/generated-test-sources/1IT.java" should exist 7 | And it should contain: 8 | """ 9 | @CucumberOptions( 10 | strict = true, 11 | features = {"classpath:features/feature1.feature"}, 12 | format = {"json:target/cucumber-parallel/1.json", 13 | "pretty"}, 14 | monochrome = false, 15 | tags = {"@complete", "@accepted"}, 16 | glue = {"foo", "bar"}) 17 | public class Parallel01IT extends AbstractTestNGCucumberTests { 18 | } 19 | """ -------------------------------------------------------------------------------- /src/it/testng/simple-it/verify.groovy: -------------------------------------------------------------------------------- 1 | import org.junit.Assert 2 | 3 | import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace 4 | 5 | File buildDirectory = new File(basedir, "target"); 6 | 7 | File suite01 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01IT.java"); 8 | File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel02IT.java"); 9 | 10 | File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); 11 | File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); 12 | 13 | assert suite01.isFile() 14 | assert suite02.isFile() 15 | 16 | String expected01 = 17 | """import cucumber.api.CucumberOptions; 18 | import cucumber.api.testng.AbstractTestNGCucumberTests; 19 | 20 | @CucumberOptions( 21 | strict = true, 22 | features = {"${feature1.absolutePath}"}, 23 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, 24 | monochrome = false, 25 | tags = {}, 26 | glue = {"foo", "bar"}) 27 | public class Parallel01IT extends AbstractTestNGCucumberTests { 28 | }""" 29 | 30 | String expected02 = 31 | """import cucumber.api.CucumberOptions; 32 | import cucumber.api.testng.AbstractTestNGCucumberTests; 33 | 34 | @CucumberOptions( 35 | strict = true, 36 | features = {"${feature2.absolutePath}"}, 37 | plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, 38 | monochrome = false, 39 | tags = {}, 40 | glue = {"foo", "bar"}) 41 | public class Parallel02IT extends AbstractTestNGCucumberTests { 42 | }""" 43 | 44 | Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) 45 | Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) 46 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/ModuloCounter.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber; 2 | 3 | import com.github.timm.cucumber.generate.name.Counter; 4 | 5 | import java.util.regex.Matcher; 6 | import java.util.regex.Pattern; 7 | 8 | /** 9 | * This class counts modulo n, where n is an integer extracted from the configured naming pattern 10 | * using regex "{c:(\d*)}". 11 | */ 12 | public class ModuloCounter implements Counter { 13 | 14 | private final int module; 15 | private int counter = 0; 16 | 17 | /** 18 | * Generates a counter from the pattern string. 19 | * The pattern string is used to infer the module to count over. 20 | * @param patternString the configure naming pattern string 21 | */ 22 | public ModuloCounter(String patternString) { 23 | this.module = getModulo(patternString); 24 | } 25 | 26 | public int next() { 27 | return this.counter++ % this.module; 28 | } 29 | 30 | private int getModulo(String extractFrom) { 31 | Matcher matcher = Pattern.compile(".*\\{c:(\\d*)}.*").matcher(extractFrom); 32 | return matcher.matches() 33 | ? Integer.decode(matcher.group(1)) 34 | : 1; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/CucumberITGenerator.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate; 2 | 3 | import org.apache.maven.plugin.MojoExecutionException; 4 | 5 | import java.io.File; 6 | import java.util.Collection; 7 | 8 | public interface CucumberITGenerator { 9 | 10 | /** 11 | * Generates Cucumber runners. 12 | * @param outputDirectory the output directory to place generated files 13 | * @param featureFiles The feature files to create runners for 14 | * @throws MojoExecutionException if something goes wrong 15 | */ 16 | void generateCucumberITFiles(final File outputDirectory, final Collection featureFiles) 17 | throws MojoExecutionException; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/CucumberITGeneratorFactory.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate; 2 | 3 | import com.github.timm.cucumber.generate.name.ClassNamingScheme; 4 | import org.apache.maven.plugin.MojoExecutionException; 5 | 6 | public class CucumberITGeneratorFactory { 7 | 8 | private final OverriddenCucumberOptionsParameters overriddenParameters; 9 | private final ClassNamingScheme classNamingScheme; 10 | private final FileGeneratorConfig config; 11 | 12 | /** 13 | * Constructor. 14 | * @param config generator config. 15 | * @param overriddenParameters cucumber options params 16 | * @param classNamingScheme the class naming scheme to use 17 | */ 18 | public CucumberITGeneratorFactory(final FileGeneratorConfig config, 19 | final OverriddenCucumberOptionsParameters overriddenParameters, 20 | final ClassNamingScheme classNamingScheme) { 21 | this.overriddenParameters = overriddenParameters; 22 | this.classNamingScheme = classNamingScheme; 23 | this.config = config; 24 | } 25 | 26 | /** 27 | * Create a CucumberITGenerator based on the given parallel scheme. 28 | * @param parallelScheme The scheme to use 29 | * @return CucumberITGenerator 30 | * @throws MojoExecutionException 31 | */ 32 | public CucumberITGenerator create(final ParallelScheme parallelScheme) throws MojoExecutionException { 33 | if (ParallelScheme.FEATURE.equals(parallelScheme)) { 34 | 35 | return createFileGeneratorByFeature(); 36 | } else { 37 | return createFileGeneratorByScenario(); 38 | } 39 | } 40 | 41 | @SuppressWarnings("deprecation") 42 | private CucumberITGenerator createFileGeneratorByFeature() throws MojoExecutionException { 43 | return new CucumberITGeneratorByFeature(config, overriddenParameters, classNamingScheme); 44 | } 45 | 46 | private CucumberITGenerator createFileGeneratorByScenario() throws MojoExecutionException { 47 | return new CucumberITGeneratorByScenario(config, overriddenParameters, classNamingScheme); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/FileGeneratorConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate; 2 | 3 | import org.apache.maven.plugin.logging.Log; 4 | 5 | import java.io.File; 6 | 7 | interface FileGeneratorConfig { 8 | 9 | Log getLog(); 10 | 11 | String getEncoding(); 12 | 13 | File getCucumberOutputDir(); 14 | 15 | boolean useTestNG(); 16 | 17 | String getCustomVmTemplate(); 18 | 19 | String getPackageName(); 20 | 21 | File getProjectBasedir(); 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/ParallelScheme.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate; 2 | 3 | public enum ParallelScheme { 4 | FEATURE, SCENARIO 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/ScenarioAndLocation.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate; 2 | 3 | import gherkin.ast.Location; 4 | import gherkin.ast.ScenarioDefinition; 5 | 6 | /** 7 | * A single test to create within a test run. 8 | */ 9 | public class ScenarioAndLocation { 10 | 11 | /** 12 | * The scenario this test case belongs to. 13 | */ 14 | private final ScenarioDefinition scenarioDefinition; 15 | 16 | /** 17 | * Where this test case came from - Either the scenario, or the table 18 | * row in a scenario outline's examples block. 19 | */ 20 | private final Location location; 21 | 22 | public ScenarioAndLocation(ScenarioDefinition scenarioDefinition, Location location) { 23 | this.scenarioDefinition = scenarioDefinition; 24 | this.location = location; 25 | } 26 | 27 | public ScenarioDefinition getScenario() { 28 | return scenarioDefinition; 29 | } 30 | 31 | public Location getLocation() { 32 | return location; 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/name/ClassNamingScheme.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate.name; 2 | 3 | public interface ClassNamingScheme { 4 | 5 | String generate(final String featureFileName); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/name/ClassNamingSchemeFactory.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate.name; 2 | 3 | import org.apache.maven.plugin.MojoExecutionException; 4 | 5 | /** 6 | * Factory for {@link ClassNamingScheme}based on a name. 7 | * 8 | *

9 | * The following naming schemes are supported: 10 | *

11 | *
    12 | *
  • simple
  • 13 | *
  • feature-title
  • 14 | *
  • pattern
  • 15 | *
16 | */ 17 | public class ClassNamingSchemeFactory { 18 | 19 | private final Counter counter; 20 | private final ClassNamingScheme featureFileNamingScheme; 21 | 22 | /** 23 | * Constructor. 24 | * @param counter Counter for adding 1-up numbers to generated class names. 25 | */ 26 | public ClassNamingSchemeFactory(final Counter counter) { 27 | this.counter = counter; 28 | featureFileNamingScheme = new FeatureFileClassNamingScheme(); 29 | } 30 | 31 | /** 32 | * Create a {@link ClassNamingScheme} based on the given name. 33 | * 34 | * @param namingScheme The naming scheme to use 35 | * @param namingPattern Only required if pattern naming scheme is used. The pattern to use when 36 | * generating the classname. See {@link PatternNamingScheme} for more details. 37 | */ 38 | public ClassNamingScheme create(final String namingScheme, final String namingPattern) 39 | throws MojoExecutionException { 40 | 41 | if (namingScheme.equals("simple")) { 42 | return new PatternNamingScheme("Parallel{c}IT", counter, featureFileNamingScheme); 43 | } else if (namingScheme.equals("feature-title")) { 44 | return new PatternNamingScheme("{f}{c}IT", counter, featureFileNamingScheme); 45 | // return new FeatureFileClassNamingScheme(counter); 46 | } else if (namingScheme.equals("pattern")) { 47 | 48 | if (namingPattern == null) { 49 | throw new MojoExecutionException("namingPattern tag is required"); 50 | } 51 | 52 | return new PatternNamingScheme(namingPattern, counter, featureFileNamingScheme); 53 | } else { 54 | throw new MojoExecutionException("Error in configuration ; accepted value for tag " 55 | + "'namingScheme' are 'simple' or 'feature-title' or 'pattern'"); 56 | } 57 | 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/name/Counter.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate.name; 2 | 3 | public interface Counter { 4 | 5 | int next(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/name/FeatureFileClassNamingScheme.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate.name; 2 | 3 | import com.google.common.base.CaseFormat; 4 | import org.apache.commons.io.FilenameUtils; 5 | 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | /** 10 | * Generates a class name based on the feature file filename. 11 | * 12 | *

13 | * The following rules are used to ensure class names are valid: 14 | *

15 | *
    16 | *
  • The file extension is removed.
  • 17 | *
  • Spaces and '-' are removed, converting to CamelCase.
  • 18 | *
  • If the filename starts with a digit, the classname is pre-pended with '_'
  • 19 | *
20 | */ 21 | public class FeatureFileClassNamingScheme implements ClassNamingScheme { 22 | 23 | private final Pattern startsWithDigit = Pattern.compile("^\\d.*"); 24 | 25 | public FeatureFileClassNamingScheme() {} 26 | 27 | /** 28 | * Generate a class name based on the supplied feature file. 29 | */ 30 | public String generate(final String featureFileName) { 31 | String fileNameWithNoExtension = FilenameUtils.removeExtension(featureFileName); 32 | 33 | fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("_", "-"); 34 | fileNameWithNoExtension = fileNameWithNoExtension.replaceAll(" ", ""); 35 | fileNameWithNoExtension = fileNameWithNoExtension.replaceAll("\\.", "-"); 36 | 37 | String className = 38 | CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, fileNameWithNoExtension); 39 | 40 | final Matcher startsWithDigitCheck = startsWithDigit.matcher(className); 41 | 42 | if (startsWithDigitCheck.matches()) { 43 | className = "_" + className; 44 | } 45 | 46 | return className; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/generate/name/OneUpCounter.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate.name; 2 | 3 | public class OneUpCounter implements Counter { 4 | 5 | private static int counter = 1; 6 | 7 | public int next() { 8 | return counter++; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/options/Shellwords.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.options; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | import java.util.regex.Matcher; 6 | import java.util.regex.Pattern; 7 | 8 | /** 9 | * Copyright (c) 2008-2014 The Cucumber Organisation 10 | * 11 | * Copy of Cucumber Shellwords 12 | */ 13 | public class Shellwords { 14 | private static final Pattern SHELLWORDS_PATTERN = Pattern.compile("[^\\s']+|'([^']*)'"); 15 | 16 | public static List parse(final String cmdline) { 17 | final List matchList = new ArrayList(); 18 | final Matcher shellwordsMatcher = SHELLWORDS_PATTERN.matcher(cmdline); 19 | while (shellwordsMatcher.find()) { 20 | if (shellwordsMatcher.group(1) != null) { 21 | matchList.add(shellwordsMatcher.group(1)); 22 | } else { 23 | matchList.add(shellwordsMatcher.group()); 24 | } 25 | } 26 | return matchList; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/github/timm/cucumber/runtime/TagPredicate.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.runtime; 2 | 3 | import static java.util.Arrays.asList; 4 | 5 | import gherkin.events.PickleEvent; 6 | import gherkin.pickles.PickleTag; 7 | 8 | import java.util.ArrayList; 9 | import java.util.Collection; 10 | import java.util.List; 11 | 12 | import io.cucumber.tagexpressions.Expression; 13 | import io.cucumber.tagexpressions.TagExpressionParser; 14 | 15 | /** 16 | * This file is copied from Cucumber-runtime library 17 | * 18 | */ 19 | public class TagPredicate { 20 | private final List expressions = new ArrayList(); 21 | private final List oldStyleExpressions = new ArrayList(); 22 | 23 | public TagPredicate(List tagExpressions) { 24 | if (tagExpressions == null) { 25 | return; 26 | } 27 | TagExpressionParser parser = new TagExpressionParser(); 28 | for (String tagExpression : tagExpressions) { 29 | if (TagExpressionOld.isOldTagExpression(tagExpression)) { 30 | oldStyleExpressions.add(new TagExpressionOld(asList(tagExpression))); 31 | } else { 32 | expressions.add(parser.parse(tagExpression)); 33 | } 34 | } 35 | } 36 | 37 | public boolean apply(PickleEvent pickleEvent) { 38 | return apply(pickleEvent.pickle.getTags()); 39 | } 40 | 41 | /** 42 | * 43 | * @param pickleTags 44 | * @return 45 | */ 46 | public boolean apply(Collection pickleTags) { 47 | for (TagExpressionOld oldStyleExpression : oldStyleExpressions) { 48 | if (!oldStyleExpression.evaluate(pickleTags)) { 49 | return false; 50 | } 51 | } 52 | List tags = new ArrayList(); 53 | for (PickleTag pickleTag : pickleTags) { 54 | tags.add(pickleTag.getName()); 55 | } 56 | for (Expression expression : expressions) { 57 | if (!expression.evaluate(tags)) { 58 | return false; 59 | } 60 | } 61 | return true; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/resources/array.java.vm: -------------------------------------------------------------------------------- 1 | #macro( stringArray $array ){#foreach( $element in $array )"$element"#if( $foreach.hasNext ), #end#end}#end -------------------------------------------------------------------------------- /src/main/resources/cucumber-junit-runner.java.vm: -------------------------------------------------------------------------------- 1 | #parse("/array.java.vm") 2 | #if ($packageName) 3 | package $packageName; 4 | 5 | #end## 6 | import org.junit.runner.RunWith; 7 | 8 | import cucumber.api.CucumberOptions; 9 | import cucumber.api.junit.Cucumber; 10 | 11 | @RunWith(Cucumber.class) 12 | @CucumberOptions( 13 | strict = $strict, 14 | features = {"$featureFile"}, 15 | plugin = #stringArray($plugins), 16 | monochrome = $monochrome, 17 | #if(!$featureFile.contains(".feature:") && $tags) 18 | tags = #stringArray($tags), 19 | #end 20 | glue = #stringArray($glue)) 21 | public class $className { 22 | } 23 | -------------------------------------------------------------------------------- /src/main/resources/cucumber-testng-runner.java.vm: -------------------------------------------------------------------------------- 1 | #parse("/array.java.vm") 2 | #if ($packageName) 3 | package $packageName; 4 | 5 | #end## 6 | import cucumber.api.CucumberOptions; 7 | import cucumber.api.testng.AbstractTestNGCucumberTests; 8 | 9 | @CucumberOptions( 10 | strict = $strict, 11 | features = {"$featureFile"}, 12 | plugin = #stringArray($plugins), 13 | monochrome = ${monochrome}, 14 | #if(!$featureFile.contains(".feature:") && $tags) 15 | tags = #stringArray($tags), 16 | #end 17 | glue = #stringArray($glue)) 18 | public class $className extends AbstractTestNGCucumberTests { 19 | } 20 | -------------------------------------------------------------------------------- /src/test/java/com/github/timm/cucumber/generate/InstanceCounter.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate; 2 | 3 | import com.github.timm.cucumber.generate.name.Counter; 4 | 5 | public class InstanceCounter implements Counter { 6 | 7 | private int counter = 1; 8 | 9 | public int next() { 10 | return counter++; 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/test/java/com/github/timm/cucumber/generate/TestFileGeneratorConfig.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate; 2 | 3 | import org.apache.maven.plugin.logging.Log; 4 | 5 | import java.io.File; 6 | 7 | class TestFileGeneratorConfig implements FileGeneratorConfig { 8 | 9 | private Log log; 10 | private File featuresDirectory; 11 | private File outputDir; 12 | private final boolean useTestNg = false; 13 | private final String namingScheme = "simple"; 14 | private final String namingPattern = null; 15 | private final String customVmTemplate = ""; 16 | 17 | TestFileGeneratorConfig setFeaturesDirectory(final File directory) { 18 | this.featuresDirectory = directory; 19 | return this; 20 | } 21 | 22 | TestFileGeneratorConfig setCucumberOutputDir(final Class classUnderTest) { 23 | this.outputDir = new File("target", classUnderTest.getSimpleName()); 24 | return this; 25 | } 26 | 27 | public Log getLog() { 28 | return log; 29 | } 30 | 31 | public String getEncoding() { 32 | return "UTF-8"; 33 | } 34 | 35 | public File getCucumberOutputDir() { 36 | return outputDir; 37 | } 38 | 39 | public boolean useTestNG() { 40 | return useTestNg; 41 | } 42 | 43 | public String getCustomVmTemplate() { 44 | return customVmTemplate; 45 | } 46 | 47 | public String getPackageName() { 48 | return null; 49 | } 50 | 51 | public File getProjectBasedir() { 52 | return new File("."); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/test/java/com/github/timm/cucumber/generate/name/ClassNamingSchemeFactoryTest.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate.name; 2 | 3 | import static org.fest.assertions.Assertions.assertThat; 4 | import static org.mockito.BDDMockito.given; 5 | import static org.mockito.Mockito.mock; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | import org.junit.runners.Parameterized; 10 | import org.junit.runners.Parameterized.Parameter; 11 | import org.junit.runners.Parameterized.Parameters; 12 | 13 | import java.util.Arrays; 14 | import java.util.Collection; 15 | 16 | @RunWith(Parameterized.class) 17 | public class ClassNamingSchemeFactoryTest { 18 | 19 | @Parameter(0) 20 | public String namingScheme; 21 | @Parameter(1) 22 | public String pattern; 23 | @Parameter(2) 24 | public String expectedResult; 25 | @Parameter(3) 26 | public Integer nextCount; 27 | 28 | Counter mockCounter = mock(Counter.class); 29 | ClassNamingSchemeFactory factory = new ClassNamingSchemeFactory(mockCounter); 30 | 31 | /** 32 | * Create params. 33 | */ 34 | @Parameters 35 | public static Collection params() { 36 | final Object[][] params = { 37 | {"simple", "", "Parallel01IT", 1}, 38 | {"simple", "", "Parallel02IT", 2}, 39 | {"feature-title", "", "Feature101IT", 1}, 40 | {"feature-title", "", "Feature102IT", 2}, 41 | {"pattern", "{f}", "Feature1", 2}, 42 | {"pattern", "{c}", "02", 2}, 43 | {"pattern", "{f}_{c}IT", "Feature1_02IT", 2},}; 44 | 45 | return Arrays.asList(params); 46 | } 47 | 48 | @Test 49 | public void createWithValidParams() throws Exception { 50 | 51 | 52 | final ClassNamingScheme create = factory.create(namingScheme, pattern); 53 | 54 | given(mockCounter.next()).willReturn(nextCount); 55 | final String actual = create.generate("feature1.feature"); 56 | assertThat(actual).isEqualTo(expectedResult); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/test/java/com/github/timm/cucumber/generate/name/FeatureFileClassNamingSchemeTest.java: -------------------------------------------------------------------------------- 1 | package com.github.timm.cucumber.generate.name; 2 | 3 | import static org.hamcrest.Matchers.equalTo; 4 | import static org.junit.Assert.assertThat; 5 | 6 | import org.junit.Test; 7 | import org.junit.runner.RunWith; 8 | import org.junit.runners.Parameterized; 9 | 10 | import java.util.Arrays; 11 | import java.util.Collection; 12 | 13 | 14 | @RunWith(Parameterized.class) 15 | public class FeatureFileClassNamingSchemeTest { 16 | 17 | @Parameterized.Parameter(0) 18 | public String featureFileName; 19 | @Parameterized.Parameter(1) 20 | public String expectedClassName; 21 | 22 | ClassNamingScheme classNameGenerator = new FeatureFileClassNamingScheme(); 23 | 24 | /** 25 | * Create params. 26 | */ 27 | @Parameterized.Parameters 28 | public static Collection data() { 29 | Object[][] params = { 30 | {"my-domain_subSetScenarios.feature", "MyDomainSubsetscenarios"}, 31 | {"my-PERSONNALdomain subSetPersonnalScenarios.feature", "MyPersonnaldomainsubsetpersonnalscenarios"}, 32 | {"Avýplňový.feature", "Avýplňový"}, 33 | {"123.feature", "_123"}, 34 | {"some.test.feature", "SomeTest"}, 35 | }; 36 | 37 | return Arrays.asList(params); 38 | } 39 | 40 | @Test 41 | public void shouldGenerateExpectedTestClassNames() throws Exception { 42 | 43 | assertThat(classNameGenerator.generate(featureFileName), 44 | equalTo(expectedClassName)); 45 | 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/test/resources/features/filterByTag.feature: -------------------------------------------------------------------------------- 1 | @featureTag 2 | Feature: filter by tag 3 | 4 | @tag1 @tag2 5 | Scenario: with multiple tags 6 | When I generate runners 7 | Then this scenario may be included 8 | 9 | @tag1 10 | Scenario: with one tag 11 | Given a scenario with multiple tags 12 | When I generate runners 13 | Then this scenario may be included 14 | 15 | @tag2 16 | Scenario: with other tag 17 | Given a scenario with multiple tags 18 | When I generate runners 19 | Then this scenario may be included 20 | -------------------------------------------------------------------------------- /src/test/resources/features/multiple-example.feature: -------------------------------------------------------------------------------- 1 | Feature: Multiple Examples 2 | 3 | @outlineTag 4 | Scenario Outline: Multiple example blocks 5 | Given example 6 | When I generate runners 7 | Then this scenario may be included 8 | 9 | @english 10 | Examples: English 11 | | Number | 12 | | one | 13 | | two | 14 | | three | 15 | 16 | @german 17 | Examples: German 18 | | Number | 19 | | Ein | 20 | | Zwei | 21 | | Drei | --------------------------------------------------------------------------------