forked from temyers/cucumber-jvm-parallel-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request temyers#13 from tommywo/master
Added support for TestNG
- Loading branch information
Showing
34 changed files
with
765 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.github.timm-permeance.it</groupId> | ||
<artifactId>simple-it</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<description>A simple IT verifying the basic use case.</description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<cucumber.version>1.1.8</cucumber.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>info.cukes</groupId> | ||
<artifactId>cucumber-testng</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>info.cukes</groupId> | ||
<artifactId>cucumber-java</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>generateRunners</id> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>generateRunners</goal> | ||
</goals> | ||
<configuration> | ||
<glue>foo, bar</glue> | ||
<!-- Only 1 feature contains this tag --> | ||
<tags>"@feature1"</tags> | ||
<filterFeaturesByTags>true</filterFeaturesByTags> | ||
<useTestNG>true</useTestNG> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
5 changes: 5 additions & 0 deletions
5
src/it/testng/filter-by-tag/src/test/resources/features/feature1.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@feature1 | ||
Feature: Feature1 | ||
|
||
Scenario: Matching tags are included | ||
Then this feature should should be included |
5 changes: 5 additions & 0 deletions
5
src/it/testng/filter-by-tag/src/test/resources/features/feature2.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@feature2 | ||
Feature: Feature2 | ||
|
||
Scenario: Non Matching tags are excluded | ||
Then this feature should should be excluded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import org.junit.Assert; | ||
import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace; | ||
|
||
File suite01 = new File( basedir, "target/generated-test-sources/cucumber/Parallel01IT.java" ); | ||
File suite02 = new File( basedir, "target/generated-test-sources/cucumber/Parallel02IT.java" ); | ||
|
||
assert suite01.isFile() | ||
// Only one file should be created | ||
assert !suite02.isFile() | ||
|
||
String expected01= | ||
"""import cucumber.api.CucumberOptions; | ||
import cucumber.api.testng.AbstractTestNGCucumberTests; | ||
@CucumberOptions(strict = true, features = {"classpath:features/feature1.feature"}, format = {"json:target/cucumber-parallel/1.json", | ||
"pretty"}, monochrome = false, tags = {"@feature1"}, glue = { "foo", "bar" }) | ||
public class Parallel01IT extends AbstractTestNGCucumberTests { | ||
}""" | ||
|
||
Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) | ||
|
56 changes: 56 additions & 0 deletions
56
src/it/testng/filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.github.timm-permeance.it</groupId> | ||
<artifactId>simple-it</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<description>A simple IT verifying the basic use case.</description> | ||
|
||
<properties> | ||
<cucumber.options>--format json</cucumber.options> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<cucumber.version>1.1.8</cucumber.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>info.cukes</groupId> | ||
<artifactId>cucumber-testng</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>info.cukes</groupId> | ||
<artifactId>cucumber-java</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>generateRunners</id> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>generateRunners</goal> | ||
</goals> | ||
<configuration> | ||
<glue>foo, bar</glue> | ||
<!-- Only 1 feature contains this tag --> | ||
<tags>"@feature1"</tags> | ||
<filterFeaturesByTags>true</filterFeaturesByTags> | ||
<useTestNG>true</useTestNG> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
5 changes: 5 additions & 0 deletions
5
...y-tag5-keep-tags-if-no-tags-in-cucumber-opts/src/test/resources/features/feature1.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@feature1 | ||
Feature: Feature1 | ||
|
||
Scenario: Matching tags are included | ||
Then this feature should should be included |
5 changes: 5 additions & 0 deletions
5
...y-tag5-keep-tags-if-no-tags-in-cucumber-opts/src/test/resources/features/feature2.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@feature2 | ||
Feature: Feature2 | ||
|
||
Scenario: Non-matching tags are excluded | ||
Then this feature should should be excluded |
20 changes: 20 additions & 0 deletions
20
src/it/testng/filter-by-tag5-keep-tags-if-no-tags-in-cucumber-opts/verify.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import org.junit.Assert; | ||
import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace; | ||
|
||
File suite01 = new File( basedir, "target/generated-test-sources/cucumber/Parallel01IT.java" ); | ||
File suite02 = new File( basedir, "target/generated-test-sources/cucumber/Parallel02IT.java" ); | ||
|
||
assert suite01.isFile() | ||
// Only one file should be created | ||
assert !suite02.isFile() | ||
|
||
String expected01= | ||
"""import cucumber.api.CucumberOptions; | ||
import cucumber.api.testng.AbstractTestNGCucumberTests; | ||
@CucumberOptions(strict = true, features = {"classpath:features/feature1.feature"}, format = {"json:target/cucumber-parallel/1.json", | ||
"pretty"}, monochrome = false, tags = {"@feature1"}, glue = { "foo", "bar" }) | ||
public class Parallel01IT extends AbstractTestNGCucumberTests { | ||
}""" | ||
|
||
Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) |
56 changes: 56 additions & 0 deletions
56
src/it/testng/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.github.timm-permeance.it</groupId> | ||
<artifactId>simple-it</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<description>A simple IT verifying the basic use case.</description> | ||
|
||
<properties> | ||
<cucumber.options>--tags @override</cucumber.options> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<cucumber.version>1.1.8</cucumber.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>info.cukes</groupId> | ||
<artifactId>cucumber-testng</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>info.cukes</groupId> | ||
<artifactId>cucumber-java</artifactId> | ||
<version>${cucumber.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<id>generateRunners</id> | ||
<phase>validate</phase> | ||
<goals> | ||
<goal>generateRunners</goal> | ||
</goals> | ||
<configuration> | ||
<glue>foo, bar</glue> | ||
<!-- Only 1 feature contains this tag --> | ||
<tags>"@feature1"</tags> | ||
<filterFeaturesByTags>true</filterFeaturesByTags> | ||
<useTestNG>true</useTestNG> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
5 changes: 5 additions & 0 deletions
5
...-tag6-override-tags-if-tags-in-cucumber-opts/src/test/resources/features/feature1.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@feature1 @override | ||
Feature: Feature1 | ||
|
||
Scenario: Matching override tags are included | ||
Then this feature should be included |
5 changes: 5 additions & 0 deletions
5
...-tag6-override-tags-if-tags-in-cucumber-opts/src/test/resources/features/feature2.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@feature2 @override | ||
Feature: Feature2 | ||
|
||
Scenario: Matching override tags are included | ||
Then this feature should be included |
5 changes: 5 additions & 0 deletions
5
...-tag6-override-tags-if-tags-in-cucumber-opts/src/test/resources/features/feature3.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@feature3 | ||
Feature: Feature3 | ||
|
||
Scenario: Non-matching override tags are excluded | ||
Then this feature should be excluded |
41 changes: 41 additions & 0 deletions
41
src/it/testng/filter-by-tag6-override-tags-if-tags-in-cucumber-opts/verify.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import org.junit.Assert; | ||
import static org.hamcrest.Matchers.equalToIgnoringWhiteSpace; | ||
|
||
File suite01 = new File( basedir, "target/generated-test-sources/cucumber/Parallel01IT.java" ); | ||
File suite02 = new File( basedir, "target/generated-test-sources/cucumber/Parallel02IT.java" ); | ||
File suite03 = new File( basedir, "target/generated-test-sources/cucumber/Parallel03IT.java" ); | ||
|
||
assert suite01.isFile() | ||
assert suite02.isFile() | ||
// Only two files should be created | ||
assert !suite03.isFile() | ||
|
||
String expected01= | ||
"""import cucumber.api.CucumberOptions; | ||
import cucumber.api.testng.AbstractTestNGCucumberTests; | ||
@CucumberOptions(strict = true, features = {"classpath:features/feature1.feature"}, format = {"json:target/cucumber-parallel/1.json", | ||
"pretty"}, monochrome = false, tags = {"@override"}, glue = { "foo", "bar" }) | ||
public class Parallel01IT extends AbstractTestNGCucumberTests { | ||
}""" | ||
|
||
Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) | ||
|
||
String expected02= | ||
"""import cucumber.api.CucumberOptions; | ||
import cucumber.api.testng.AbstractTestNGCucumberTests; | ||
@CucumberOptions(strict = true, features = {"classpath:features/feature2.feature"}, format = {"json:target/cucumber-parallel/2.json", | ||
"pretty"}, monochrome = false, tags = {"@override"}, glue = { "foo", "bar" }) | ||
public class Parallel02IT extends AbstractTestNGCucumberTests { | ||
}""" | ||
|
||
// Depending on the OS, listFiles can list files in different order. The actual order of files isn't necessary | ||
|
||
if(suite01.text.contains("feature1") ){ | ||
Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) | ||
Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) | ||
}else{ | ||
Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected01)) | ||
Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected02)) | ||
} |
Oops, something went wrong.