Permalink
Browse files

Moved web tests into a separate module.

  • Loading branch information...
1 parent 7b3deb6 commit 71ab21383884b4930f8d60ea7100b114e04431bc @wakaleo committed Nov 7, 2011
Showing with 212 additions and 127 deletions.
  1. +2 −1 .gitignore
  2. +1 −91 gameoflife-web/pom.xml
  3. +6 −5 gameoflife-web/src/main/java/com/wakaleo/gameoflife/{web → webtests}/controllers/GameController.java
  4. +1 −1 ...ife-web/src/main/java/com/wakaleo/gameoflife/{web → webtests}/controllers/HomePageController.java
  5. +1 −1 gameoflife-web/src/main/webapp/WEB-INF/gameoflife-servlet.xml
  6. +1 −1 ...e-web/src/test/java/com/wakaleo/gameoflife/{web → webtests}/controllers/WhenCreatingANewGame.java
  7. +1 −1 .../src/test/java/com/wakaleo/gameoflife/{web → webtests}/controllers/WhenDisplayingTheHomePage.java
  8. +1 −1 ...src/test/java/com/wakaleo/gameoflife/{web → webtests}/controllers/WhenSpawningANewGeneration.java
  9. +177 −0 gameoflife-webtests/pom.xml
  10. +3 −3 ...flife-webtests/src/test/java/com/wakaleo/gameoflife}/webtests/WhenTheUserEntersAnInitialGrid.java
  11. +3 −4 ...eoflife-webtests/src/test/java/com/wakaleo/gameoflife}/webtests/WhenTheUserGoesToTheHomePage.java
  12. +3 −4 ...e-webtests/src/test/java/com/wakaleo/gameoflife}/webtests/WhenTheUserSpawnsTheNextGeneration.java
  13. +1 −2 ...web → gameoflife-webtests/src/test/java/com/wakaleo/gameoflife}/webtests/pages/EnterGridPage.java
  14. +1 −1 ...eb → gameoflife-webtests/src/test/java/com/wakaleo/gameoflife}/webtests/pages/GameOfLifePage.java
  15. +1 −2 ...life/web → gameoflife-webtests/src/test/java/com/wakaleo/gameoflife}/webtests/pages/HomePage.java
  16. +1 −3 .../web → gameoflife-webtests/src/test/java/com/wakaleo/gameoflife}/webtests/pages/ShowGridPage.java
  17. +1 −1 ...e-webtests/src/test/java/com/wakaleo/gameoflife/webtests}/requirements/GameOfLifeApplication.java
  18. +5 −5 ...e/web → gameoflife-webtests/src/test/java/com/wakaleo/gameoflife}/webtests/steps/PlayerSteps.java
  19. +2 −0 pom.xml
View
@@ -13,4 +13,5 @@ target
*.iws
*.versionsBackup
-*.iml
+*.iml
+.DS_Store
View
@@ -13,10 +13,8 @@
<name>gameoflife-web</name>
<properties>
- <thucydides.version>0.4.19</thucydides.version>
<jetty.port>9090</jetty.port>
<jetty.stop.port>9999</jetty.stop.port>
- <webdriver.base.url>http://localhost:${jetty.port}</webdriver.base.url>
</properties>
<build>
@@ -31,45 +29,6 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>unit-tests</id>
- <phase>test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- <parallel>classes</parallel>
- <excludes>
- <exclude>**/webtests/*.java</exclude>
- </excludes>
- </configuration>
- </execution>
- <execution>
- <id>integration-tests</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>false</skip>
- <parallel>classes</parallel>
- <includes>
- <include>**/webtests/*.java</include>
- </includes>
- <excludes>
- <exclude>**/pages/*.java</exclude>
- </excludes>
- <systemPropertyVariables>
- <webdriver.base.url>${webdriver.base.url}</webdriver.base.url>
- </systemPropertyVariables>
- </configuration>
- </execution>
- </executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
@@ -86,26 +45,6 @@
<stopKey>foo</stopKey>
<stopPort>${jetty.stop.port}</stopPort>
</configuration>
- <executions>
- <execution>
- <id>start-jetty</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <scanIntervalSeconds>0</scanIntervalSeconds>
- <daemon>true</daemon>
- </configuration>
- </execution>
- <execution>
- <id>stop-jetty</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
@@ -147,6 +86,7 @@
</plugins>
</build>
<profiles>
+ <!-- Deprecated: needs to be migrated to the webtests module. -->
<profile>
<id>performance</id>
<build>
@@ -241,36 +181,6 @@
<artifactId>fest-assert</artifactId>
<version>1.4</version>
</dependency>
-
-
- <dependency>
- <groupId>net.thucydides</groupId>
- <artifactId>thucydides-core</artifactId>
- <version>${thucydides.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.thucydides</groupId>
- <artifactId>thucydides-junit</artifactId>
- <version>${thucydides.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>net.thucydides.easyb</groupId>
- <artifactId>thucydides-easyb-plugin</artifactId>
- <version>${thucydides.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.googlecode.lambdaj</groupId>
- <artifactId>lambdaj</artifactId>
- <version>2.3.1</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all</artifactId>
- <version>1.8.2</version>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
@@ -1,4 +1,4 @@
-package com.wakaleo.gameoflife.web.controllers;
+package com.wakaleo.gameoflife.webtests.controllers;
import java.util.Random;
@@ -31,7 +31,7 @@ public ModelAndView firstGeneration(@RequestParam("rows") int rows,
@RequestParam("columns") int columns, HttpServletRequest request) {
Universe universe = universeInstanciatedFromClickedCells(rows, columns, request);
- // TODO: Hate this code
+ // TODO: Hate this code
thinkABit(200);
return showGridScreen(universe);
@@ -40,8 +40,9 @@ public ModelAndView firstGeneration(@RequestParam("rows") int rows,
@RequestMapping("/next")
public ModelAndView nextGeneration(@RequestParam("rows") int rows,
@RequestParam("columns") int columns, HttpServletRequest request) {
-
- Universe universe = universeInstanciatedFromClickedCells(rows, columns, request);
+
+ Universe universe = universeInstanciatedFromClickedCells(rows, columns,
+ request);
universe.createNextGeneration();
thinkABit(250);
@@ -52,7 +53,7 @@ public ModelAndView nextGeneration(@RequestParam("rows") int rows,
private void thinkABit(int max) {
int thinkingTime = randomGenerator.nextInt(max/4);
try {
- Thread.sleep(thinkingTime);
+ Thread.currentThread().sleep(thinkingTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
@@ -1,4 +1,4 @@
-package com.wakaleo.gameoflife.web.controllers;
+package com.wakaleo.gameoflife.webtests.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -6,7 +6,7 @@
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
- <context:component-scan base-package="com.wakaleo.gameoflife.web" />
+ <context:component-scan base-package="com.wakaleo.gameoflife.webtests" />
<bean id="view-Resolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
@@ -1,4 +1,4 @@
-package com.wakaleo.gameoflife.web.controllers;
+package com.wakaleo.gameoflife.webtests.controllers;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@@ -1,4 +1,4 @@
-package com.wakaleo.gameoflife.web.controllers;
+package com.wakaleo.gameoflife.webtests.controllers;
import org.junit.Test;
import org.springframework.web.servlet.ModelAndView;
@@ -1,4 +1,4 @@
-package com.wakaleo.gameoflife.web.controllers;
+package com.wakaleo.gameoflife.webtests.controllers;
import javax.servlet.http.HttpServletRequest;
View
@@ -0,0 +1,177 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>gameoflife</artifactId>
+ <groupId>com.wakaleo.gameoflife</groupId>
+ <version>0.7.49-SNAPSHOT</version>
+ </parent>
+ <artifactId>gameoflife-webtests</artifactId>
+ <name>gameoflife-webtests</name>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <jetty.port>9090</jetty.port>
+ <jetty.stop.port>9999</jetty.stop.port>
+ <webdriver.base.url>http://localhost:${jetty.port}</webdriver.base.url>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.easytesting</groupId>
+ <artifactId>fest-assert</artifactId>
+ <version>1.4</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.thucydides</groupId>
+ <artifactId>thucydides-core</artifactId>
+ <version>${thucydides.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.thucydides</groupId>
+ <artifactId>thucydides-junit</artifactId>
+ <version>${thucydides.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>net.thucydides.easyb</groupId>
+ <artifactId>thucydides-easyb-plugin</artifactId>
+ <version>${thucydides.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.lambdaj</groupId>
+ <artifactId>lambdaj</artifactId>
+ <version>2.3.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.wakaleo.gameoflife</groupId>
+ <artifactId>gameoflife-web</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <executions>
+ <execution>
+ <id>unit-tests</id>
+ <phase>test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <parallel>classes</parallel>
+ <excludes>
+ <exclude>**/webtests/*.java</exclude>
+ </excludes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>integration-tests</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ <parallel>classes</parallel>
+ <includes>
+ <include>**/webtests/*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/pages/*.java</exclude>
+ </excludes>
+ <systemPropertyVariables>
+ <webdriver.base.url>${webdriver.base.url}</webdriver.base.url>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.1.3</version>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <container>
+ <containerId>jetty7x</containerId>
+ <type>embedded</type>
+ </container>
+ <configuration>
+ <type>standalone</type>
+ <deployables>
+ <deployable>
+ <groupId>com.wakaleo.gameoflife</groupId>
+ <artifactId>gameoflife-web</artifactId>
+ <type>war</type>
+ <properties>
+ <context>/</context>
+ </properties>
+ </deployable>
+ </deployables>
+ <properties>
+ <cargo.servlet.port>${jetty.port}</cargo.servlet.port>
+ </properties>
+ </configuration>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
@@ -1,7 +1,7 @@
-package com.wakaleo.gameoflife.web.webtests;
+package com.wakaleo.gameoflife.webtests;
-import com.wakaleo.gameoflife.web.requirements.GameOfLifeApplication;
-import com.wakaleo.gameoflife.web.webtests.steps.PlayerSteps;
+import com.wakaleo.gameoflife.webtests.requirements.GameOfLifeApplication;
+import com.wakaleo.gameoflife.webtests.steps.PlayerSteps;
import net.thucydides.core.annotations.Managed;
import net.thucydides.core.annotations.ManagedPages;
import net.thucydides.core.annotations.Steps;
Oops, something went wrong.

0 comments on commit 71ab213

Please sign in to comment.