Skip to content

Commit

Permalink
Added quickstart tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiri Holusa authored and mgencur committed Oct 15, 2013
1 parent 64e6783 commit 99e5a9e
Show file tree
Hide file tree
Showing 30 changed files with 1,452 additions and 64 deletions.
22 changes: 20 additions & 2 deletions carmart-tx/README-tomcat.md
Expand Up @@ -33,7 +33,7 @@ Configure JBoss Enterprise Web Server 2 or Tomcat 7
Before starting EWS/Tomcat, add the following lines to `conf/tomcat-users.xml` to allow the Maven Tomcat plugin to access the manager application:

<role rolename="manager-script"/>
<user username="admin" password="SOMEPASSWD" roles="manager-script"/>
<user username="admin" password="admin" roles="manager-script"/>
Configure Maven
---------------
Expand All @@ -46,7 +46,7 @@ Add a `<server>` element into your Maven settings.xml with `<id>` equal to tomca
<server>
<id>tomcat</id>
<username>admin</username>
<password>SOMEPASSWD</password>
<password>admin</password>
</server>

Expand Down Expand Up @@ -87,3 +87,21 @@ Undeploy the Archive

`mvn -Plibrary-tomcat tomcat:undeploy `


Test the Application
------------------------------------

If you want to test the application, there are simple Arquillian Selenium tests prepared.
To run these tests on Tomcat:

1. Undeploy the archive as described above
2. Stop Tomcat Server
3. Open a command line and navigate to the root directory of this quickstart.
4. Build the quickstart using:

mvn clean package -Plibrary-tomcat

5. Type this command to run the tests:

mvn test -Puitests-tomcat -Dtomcat7home=/path/to/server

17 changes: 17 additions & 0 deletions carmart-tx/README.md
Expand Up @@ -89,3 +89,20 @@ If you want to debug the source code or look at the Javadocs of any library in t
mvn dependency:sources
mvn dependency:resolve -Dclassifier=javadoc


Test the Application
------------------------------------

If you want to test the application, there are simple Arquillian Selenium tests prepared.
To run these tests on JBoss AS:

1. Stop JBoss Server (if you have one running)
2. Open a command line and navigate to the root directory of this quickstart.
3. Build the quickstart using:

mvn clean package

4. Type this command to run the tests:

mvn test -Puitests-jbossas -Das7home=/path/to/server

174 changes: 158 additions & 16 deletions carmart-tx/pom.xml
@@ -1,20 +1,4 @@
<?xml version="1.0"?>
<!--
JBoss, Home of Professional Open Source
Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual
contributors by the @authors tag. See the copyright.txt in the
distribution for a full listing of individual contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
Expand Down Expand Up @@ -62,10 +46,22 @@

<!-- other plugin versions -->
<version.war.plugin>2.2</version.war.plugin>
<version.maven.surefire>2.14</version.maven.surefire>

<!-- maven-compiler-plugin -->
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>

<!-- test dependencies versions -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>4.8.2</junit.version>
<arquillian.bom.version>1.1.1.Final</arquillian.bom.version>
<arquillian.drone.bom.version>1.2.0.Beta1</arquillian.drone.bom.version>
<jboss.as7.version>7.1.3.Final</jboss.as7.version>
<arquillian.selenium.version>2.35.0</arquillian.selenium.version>
<arquillian.graphene.version>2.0.0.Beta1</arquillian.graphene.version>
<browser>phantomjs</browser>

</properties>

<dependencyManagement>
Expand Down Expand Up @@ -172,6 +168,31 @@
<version>${com.ocpsoft.prettyfaces.version}</version>
<scope>compile</scope>
</dependency>

<!-- added to run arquillian -->
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>${arquillian.bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-drone-bom</artifactId>
<version>${arquillian.drone.bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.selenium</groupId>
<artifactId>selenium-bom</artifactId>
<version>${arquillian.selenium.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -210,9 +231,40 @@
<artifactId>prettyfaces-jsf2</artifactId>
<scope>compile</scope>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
<version>${arquillian.bom.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.arquillian.graphene</groupId>
<artifactId>graphene-webdriver</artifactId>
<version>${arquillian.graphene.version}</version>
<type>pom</type>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<!-- export browser property to arquillian.xml -->
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
</testResources>

<!-- Maven will append the version to the finalName (which is the
name given to the generated war, and hence the context root) -->
<finalName>${project.artifactId}</finalName>
Expand Down Expand Up @@ -268,6 +320,15 @@
<artifactId>jboss-as-maven-plugin</artifactId>
<version>${version.jboss.maven.plugin}</version>
</plugin>
<!-- Maven Surefire Plugin to skip tests on build -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.maven.surefire}</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down Expand Up @@ -372,6 +433,87 @@
<url>${tomcat.management.url}</url>
</configuration>
</plugin>
<!-- Maven Surefire Plugin to skip tests on build -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.maven.surefire}</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<!-- This profile is for running tests on JBoss AS -->
<profile>
<id>uitests-jbossas</id>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<version>${jboss.as7.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.maven.surefire}</version>
<configuration>
<reportNameSuffix>uitests-jbossas</reportNameSuffix>
<systemPropertyVariables>
<carmart-tx.war.directory>${basedir}/target</carmart-tx.war.directory>
<carmart-tx.war.file>${project.artifactId}.war</carmart-tx.war.file>
</systemPropertyVariables>
<systemProperties>
<arquillian.launch>jbossas-managed</arquillian.launch>
</systemProperties>
<!-- Added so selenium doesn't print it's INFO logs to console (there's a LOT of them -
like 5000 lines for each run) - they are instead appended (important when
there are multiple profiles) to <module>/target/jul-info.log (warnings are printed in console) -->
<argLine>-Djava.util.logging.config.file=${basedir}/src/test/resources/logging.properties</argLine>
</configuration>

</plugin>

</plugins>
</build>
</profile>

<!-- This profile is for running tests on Tomcat -->
<profile>
<id>uitests-tomcat</id>
<dependencies>
<!-- container adapter for Tomcat7 managed -->
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-tomcat-managed-7</artifactId>
<version>1.0.0.CR4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.maven.surefire}</version>
<configuration>
<reportNameSuffix>uitests-tomcat</reportNameSuffix>
<systemPropertyVariables>
<carmart-tx.war.directory>${basedir}/target</carmart-tx.war.directory>
<carmart-tx.war.file>${project.artifactId}.war</carmart-tx.war.file>
</systemPropertyVariables>
<systemProperties>
<arquillian.launch>tomcat-managed-7</arquillian.launch>
</systemProperties>
<!-- Added so selenium doesn't print it's INFO logs to console (there's a LOT of them -
like 5000 lines for each run) - they are instead appended (important when
there are multiple profiles) to <module>/target/jul-info.log (warnings are printed in console) -->
<argLine>-Djava.util.logging.config.file=${basedir}/src/test/resources/logging.properties</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand Down

0 comments on commit 99e5a9e

Please sign in to comment.