|
| 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/Parallel01FooFeature1Counter001IT.java"); |
| 8 | +File suite02 = new File(basedir, "target/generated-test-sources/cucumber/Parallel00FooFeature2Counter002IT.java"); |
| 9 | +File suite03 = new File(basedir, "target/generated-test-sources/cucumber/Parallel01FooFeature3Counter003IT.java"); |
| 10 | +File suite04 = new File(basedir, "target/generated-test-sources/cucumber/Parallel00FooFeature4Counter004IT.java"); |
| 11 | + |
| 12 | +File feature1 = new File(basedir, "/src/test/resources/features/feature1.feature"); |
| 13 | +File feature2 = new File(basedir, "/src/test/resources/features/feature2.feature"); |
| 14 | +File feature3 = new File(basedir, "/src/test/resources/features/feature3.feature"); |
| 15 | +File feature4 = new File(basedir, "/src/test/resources/features/feature4.feature"); |
| 16 | + |
| 17 | +assert suite01.isFile() |
| 18 | +assert suite02.isFile() |
| 19 | +assert suite03.isFile() |
| 20 | +assert suite04.isFile() |
| 21 | + |
| 22 | +String expected01 = |
| 23 | + """import org.junit.runner.RunWith; |
| 24 | +
|
| 25 | +import cucumber.api.CucumberOptions; |
| 26 | +import cucumber.api.junit.Cucumber; |
| 27 | +
|
| 28 | +@RunWith(Cucumber.class) |
| 29 | +@CucumberOptions( |
| 30 | + strict = true, |
| 31 | + features = {"${feature1.absolutePath}"}, |
| 32 | + plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, |
| 33 | + monochrome = false, |
| 34 | + tags = {}, |
| 35 | + glue = {"foo", "bar"}) |
| 36 | +public class Parallel01FooFeature1Counter001IT { |
| 37 | +}""" |
| 38 | + |
| 39 | +String expected02 = |
| 40 | + """import org.junit.runner.RunWith; |
| 41 | +
|
| 42 | +import cucumber.api.CucumberOptions; |
| 43 | +import cucumber.api.junit.Cucumber; |
| 44 | +
|
| 45 | +@RunWith(Cucumber.class) |
| 46 | +@CucumberOptions( |
| 47 | + strict = true, |
| 48 | + features = {"${feature2.absolutePath}"}, |
| 49 | + plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, |
| 50 | + monochrome = false, |
| 51 | + tags = {}, |
| 52 | + glue = {"foo", "bar"}) |
| 53 | +public class Parallel00FooFeature2Counter002IT { |
| 54 | +}""" |
| 55 | + |
| 56 | +String expected03 = |
| 57 | + """import org.junit.runner.RunWith; |
| 58 | +
|
| 59 | +import cucumber.api.CucumberOptions; |
| 60 | +import cucumber.api.junit.Cucumber; |
| 61 | +
|
| 62 | +@RunWith(Cucumber.class) |
| 63 | +@CucumberOptions( |
| 64 | + strict = true, |
| 65 | + features = {"${feature1.absolutePath}"}, |
| 66 | + plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/1.json"}, |
| 67 | + monochrome = false, |
| 68 | + tags = {}, |
| 69 | + glue = {"foo", "bar"}) |
| 70 | +public class Parallel01FooFeature3Counter003IT { |
| 71 | +}""" |
| 72 | + |
| 73 | +String expected04 = |
| 74 | + """import org.junit.runner.RunWith; |
| 75 | +
|
| 76 | +import cucumber.api.CucumberOptions; |
| 77 | +import cucumber.api.junit.Cucumber; |
| 78 | +
|
| 79 | +@RunWith(Cucumber.class) |
| 80 | +@CucumberOptions( |
| 81 | + strict = true, |
| 82 | + features = {"${feature2.absolutePath}"}, |
| 83 | + plugin = {"json:${buildDirectory.absolutePath}/cucumber-parallel/2.json"}, |
| 84 | + monochrome = false, |
| 85 | + tags = {}, |
| 86 | + glue = {"foo", "bar"}) |
| 87 | +public class Parallel00FooFeature4Counter004IT { |
| 88 | +}""" |
| 89 | + |
| 90 | +Assert.assertThat(suite01.text, equalToIgnoringWhiteSpace(expected01)) |
| 91 | +Assert.assertThat(suite02.text, equalToIgnoringWhiteSpace(expected02)) |
| 92 | +Assert.assertThat(suite03.text, equalToIgnoringWhiteSpace(expected03)) |
| 93 | +Assert.assertThat(suite04.text, equalToIgnoringWhiteSpace(expected04)) |
0 commit comments