Help

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Testing of Weld archetypes is almost fully automated. This consists of unit and functional tests. Functional tests are written in Java using Selenium framework. All the process of testing is made easy by leveraging Maven builds. Currently, there are three types of projects which can be generated with Weld archetypes:

  • servlet-minimal - possible to test with jetty-embedded or tomcat-embedded
  • jee-minimal - possible to test with jboss standalone and glassfish standalone
  • jee - possible to test with jboss standalone and glassfish standalone

All the types of projects are sequentially generated and tested.

How do I execute unit and functional test on a weld archetype?

Before you can run the testsuite you have to download it.

  • Checkout and install archetypes version you want to test (in this case: trunk, probably 1.0.0-SNAPSHOT)
svn co http://anonsvn.jboss.org/repos/weld/archetypes/trunk archetypes
cd archetypes
mvn install

Lets refer to the archetypes directory as $ARCHETYPES.

  • Checkout functional tests. There is a script file which will help you download all the modules of functional tests.
svn co http://anonsvn.jboss.org/repos/weld/ftest/trunk ftest
cd ftest
./checkout.sh
  • Install the tests' artifacts to your local repository
mvn install

servlet-minimal project

Running testsuite for this kind of archetype does not need any container to be downloaded manually. All you have to do is run the following commands:

cd $ARCHETYPES/jsf/servlet-minimal

For tomcat:

mvn -Pftest-embedded -Darchetype.test.version=1.0.0-SNAPSHOT verify

For jetty:

mvn -Pftest-embedded -Dcontainer=jetty -Darchetype.test.version=1.0.0-SNAPSHOT verify 

jee-minimal project

This kind of testsuite can be executed with GlassfishV3 standalone or JBoss AS 6.0.0.M2 container. Before you can run the testsuite you have to download one of these containers, unpack it and set environment variable to point to the installation (JBOSS_HOME for JBossAS and GLASSFISH_HOME for GlassfishV3). You can download JBossAS here and GlassfishV3 here. JBossAS has to be started manually, Glassfish will start automatically from within maven build. The following commands will run the testsuite.

cd $ARCHETYPES/jsf/jee-minimal

For JBossAS:

mvn -Pftest-jboss -Darchetype.test.version=1.0.0-SNAPSHOT verify

For Glassfish:

mvn -Pftest-glassfish -Darchetype.test.version=1.0.0-SNAPSHOT verify

jee project

Running this kind of testsuite is basically the same as the previous one. Only difference is the directory where you run the mvn command.

cd $ARCHETYPES/jsf/jee

Now you can run the testsuite for JBossAS or Glassfish as previously.

Alternative ways of running the testsuite

All the properties passed to Selenium are defined as Maven properties, you can override them by flags in Maven command line. Main properties can be found at pom.xml file under $ARCHETYPES directory.

For example you can change the following:

  • selenium.browser - use to select browser (*firefoxproxy, *firefox, *iexplore, *custom, ...)

You can also change the version of archetypes you want to test. By omitting archetype.test.version parameter you will test 1.0.0-BETA1 version which is default. Of course, you first have to install the version to your local maven repo.