Skip to content
Browse files

Integrated batch testing support into the easyb maven plugin.

  • Loading branch information...
1 parent 8e2c908 commit 2edc650aa36918feeb08d1340b33619a186390ca @wakaleo wakaleo committed Dec 20, 2011
View
4 pom.xml
@@ -10,7 +10,7 @@
<packaging>maven-plugin</packaging>
<name>easyb Maven Plugin</name>
<description>A Maven plugin for creating story reports</description>
- <version>1.3-SNAPSHOT</version>
+ <version>1.4-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -41,7 +41,7 @@
<dependency>
<groupId>org.easyb</groupId>
<artifactId>easyb-core</artifactId>
- <version>1.2</version>
+ <version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
View
1 src/it/run-test-batch-with-command-line-options/goals.txt
@@ -0,0 +1 @@
+clean install -Deasyb.batch.count=3 -Deasyb.batch.number=1
View
31 src/it/run-test-batch-with-command-line-options/pom.xml
@@ -0,0 +1,31 @@
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.easyb</groupId>
+ <artifactId>run-test-batch-with-command-line-options-test</artifactId>
+ <version>testing</version>
+ <description>Tests running batches of behaviors</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.easyb</groupId>
+ <artifactId>maven-easyb-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <xmlReport>${project.build.directory}/easyb-report.xml</xmlReport>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
View
10 src/it/run-test-batch-with-command-line-options/src/test/easyb/Five.story
@@ -0,0 +1,10 @@
+Two.storyscenario "some cool feature (5)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch-with-command-line-options/src/test/easyb/Four.story
@@ -0,0 +1,10 @@
+scenario "some cool feature (4)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch-with-command-line-options/src/test/easyb/One.story
@@ -0,0 +1,10 @@
+scenario "some cool feature", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch-with-command-line-options/src/test/easyb/Six.story
@@ -0,0 +1,10 @@
+scenario "some cool feature (6)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch-with-command-line-options/src/test/easyb/Two.story
@@ -0,0 +1,10 @@
+scenario "some cool feature (2)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch-with-command-line-options/src/test/easyb/alsoOne/Three.story
@@ -0,0 +1,10 @@
+scenario "some cool feature (3)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
8 src/it/run-test-batch-with-command-line-options/validate.groovy
@@ -0,0 +1,8 @@
+// Verify behavior report
+report = new File("${basedir}/target/easyb-report.xml")
+assert report.exists()
+
+def results = new XmlParser().parse(report)
+assert '2' == results.'@totalbehaviors'
+assert '0' == results.'@totalfailedbehaviors'
+
View
1 src/it/run-test-batch/goals.txt
@@ -0,0 +1 @@
+clean install
View
33 src/it/run-test-batch/pom.xml
@@ -0,0 +1,33 @@
+<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/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.easyb</groupId>
+ <artifactId>run-test-batch-test</artifactId>
+ <version>testing</version>
+ <description>Tests running batches of behaviors</description>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.easyb</groupId>
+ <artifactId>maven-easyb-plugin</artifactId>
+ <version>@project.version@</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <xmlReport>${project.build.directory}/easyb-report.xml</xmlReport>
+ <batchCount>3</batchCount>
+ <batchNumber>1</batchNumber>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
View
10 src/it/run-test-batch/src/test/easyb/Five.story
@@ -0,0 +1,10 @@
+Two.storyscenario "some cool feature (5)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch/src/test/easyb/Four.story
@@ -0,0 +1,10 @@
+scenario "some cool feature (4)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch/src/test/easyb/One.story
@@ -0,0 +1,10 @@
+scenario "some cool feature", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch/src/test/easyb/Six.story
@@ -0,0 +1,10 @@
+scenario "some cool feature (6)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch/src/test/easyb/Two.story
@@ -0,0 +1,10 @@
+scenario "some cool feature (2)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
10 src/it/run-test-batch/src/test/easyb/alsoOne/Three.story
@@ -0,0 +1,10 @@
+scenario "some cool feature (3)", {
+ given "some context", {
+ }
+
+ when "some event occurs", {
+ }
+
+ then "some outcome is triggered", {
+ }
+}
View
8 src/it/run-test-batch/validate.groovy
@@ -0,0 +1,8 @@
+// Verify behavior report
+report = new File("${basedir}/target/easyb-report.xml")
+assert report.exists()
+
+def results = new XmlParser().parse(report)
+assert '2' == results.'@totalbehaviors'
+assert '0' == results.'@totalfailedbehaviors'
+
View
9 src/main/groovy/org/easyb/maven/EasybExecutor.groovy
@@ -46,6 +46,15 @@ public class EasybExecutor {
arg(value: '-tags')
arg(value: mojo.tags)
}
+
+ if ((mojo.batchCount) && (mojo.batchNumber)) {
+ arg(value: '-batchCount')
+ arg(value: mojo.batchCount)
+
+ arg(value: '-batchNumber')
+ arg(value: mojo.batchNumber)
+ }
+
arg(value: '-xml')
arg(value: mojo.xmlReport)
arg(value: "-$mojo.storyType")
View
12 src/main/java/org/easyb/maven/EasybMojo.java
@@ -157,6 +157,18 @@
*/
boolean parallel;
+ /**
+ * The total number of batches being run if the behaviors are being split into batches.
+ * @parameter expression="${easyb.batch.count}" default-value=0
+ */
+ private Integer batchCount;
+
+ /**
+ * The number of the batch to be run here if the behaviors are being split into batches.
+ * @parameter expression="${easyb.batch.number}" default-value=0
+ */
+ private Integer batchNumber;
+
public void execute() throws MojoExecutionException, MojoFailureException {
buildExecutor().execute();
}

0 comments on commit 2edc650

Please sign in to comment.
Something went wrong with that request. Please try again.