Skip to content

Commit

Permalink
Moved web tests into a separate module.
Browse files Browse the repository at this point in the history
  • Loading branch information
wakaleo committed Nov 7, 2011
1 parent 7b3deb6 commit 71ab213
Show file tree
Hide file tree
Showing 19 changed files with 212 additions and 127 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ target
*.iws
*.versionsBackup

*.iml
*.iml
.DS_Store
92 changes: 1 addition & 91 deletions gameoflife-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -147,6 +86,7 @@
</plugins>
</build>
<profiles>
<!-- Deprecated: needs to be migrated to the webtests module. -->
<profile>
<id>performance</id>
<build>
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.wakaleo.gameoflife.web.controllers;
package com.wakaleo.gameoflife.webtests.controllers;

import java.util.Random;

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.wakaleo.gameoflife.web.controllers;
package com.wakaleo.gameoflife.webtests.controllers;

import javax.servlet.http.HttpServletRequest;

Expand Down
177 changes: 177 additions & 0 deletions gameoflife-webtests/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading

0 comments on commit 71ab213

Please sign in to comment.