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.

How are functional test written?

Functional tests are written in Java using Selenium testing framework. They take the advantage of Maven build. Despite the fact they are not using Arquillian, we tried to provide you similar ease of execution.

How do I execute functional test on an example?

Simply execute maven with additional execution profile. These profile are responsible for:

  1. Downloading functional tests from Maven repository
  2. Deploying and undeploying resulting code to a container
  3. Running and stopping Selenium server
  4. Evaluating results and generating report

Currently supported profiles and containers are stated below. Container must be running before test execution.

  • ftest-jboss-remote-51 - testing in JBoss AS 5.1 (expected added support for Weld)
  • ftest-jboss-remote-60 - testing in JBoss AS 6 M1

Please note that activating profile in Maven from a command line disables profile which is activated by default. If you still would like to use default profile, you must enable it together with the functional test profile. This is the case of Numberguess example, where profile jboss5 must be added.

Functional tests are bound into Maven's integration-test phase. Preferred way to execute them is to launch post-integration-test or verify target, such as:

$ mvn -Pftest-jboss-remote-60 verify

This will run functional tests and create results in target/test-report directory. You can find HTML source code and screenshots of failed tests in target/test-output directory.

How do I execute functional test on an example in cluster?

Running functional test on examples in cluster is a little more complicated. Currently clustering tests are available only for numberguess example. Anyway there are other examples planned. Clustering test should be executed separately from other tests, not as part of test bundle.

Steps for running functional tests in cluster:

  1. Download JBoss AS 6.0.0.M1 and unzip it twice to two different folders
  2. Update both jboss instances with current trunk of Weld.
  3. Run first and second instance of JBoss AS sequentially with time gap around 20 seconds
  4. Run the tests

ad 1) You can download JBoss application server from

ad 2) Weld core can be downloaded from annonsvn. After downloading of Weld core set JBOSS_HOME environment property to point to the first JBoss instance's directory and run the following command at core/jboss-as dir.

$ mvn -Pupdate-jboss-as install

Do the same with the second JBoss instance.

ad 3) Run first and second instance of JBoss AS

$ JBOSS1_HOME/bin/ -c all -g DocsPartition -u -b localhost -Djboss.messaging.ServerPeerID=1 -Djboss.service.binding.set=ports-default
$ JBOSS2_HOME/bin/ -c all -g DocsPartition -u -b localhost -Djboss.messaging.ServerPeerID=2 -Djboss.service.binding.set=ports-01

NOTE: Do it exactly as stated above. The test assume certain URL adresses which are ensured by these commands.

ad 4) Run the following command at jsf/numberguess directory in weld distribution

$ mvn -P ftest-jboss-cluster-60,jboss6cluster -Djboss.master.configuration=$PATH_TO_MASTER_ALL_CONFIGURATION verify

NOTE: jboss.master.configuration parameter points for example to /home/applications/JBoss-6.0.0.M1.master/server/all. Profile jboss6cluster causes the application to be packaged according to cluster environment's restrictions. Profile ftest-jboss-cluster-60 executes the functional testsuite.

What can I modify and how?

All the properties passed to Selenium are defined as Maven properties, you can override them by -Dproperty=value flags in Maven command line.

Supported properties are:

  • selenium.browser - use to select browser (*firefoxproxy, *firefox, *iexplore, *custom, ...)
  • selenium.browser.url - base address where Selenium will be pointed, this is basically address where your container is listening (e.g. http://localhost:8080)
  • - host where Selenium server is run (localhost)
  • selenium.server.port - port where Selenium server is run (14444)
  • selenium.speed - speed of selenium execution (0 means no delay, otherwise delay in ms between command execution)
  • selenium.timeout - time limit, when reached current request in Selenium fails in ms

Additionally, if you would like to test against SNAPSHOT version of functional test, set ftest.version.discriminator to -SNAPSHOT value. You can even force different version by setting ftest.version to desired version. This becomes handy when doing CI testing.

Last, but not least, you can change which methods are run, verbosity and the other parameters by modifying TestNG suite file located in src/test/selenium directory. Just select the file with respect to container you would like to use for testing.

What examples are covered?

Currently covered examples in Weld are:

Simple tests:

  • jsf/numberguess
  • jsf/login
  • jsf/translator
  • jsf/permalink

Clustering tests:

  • jsf/numberguess

If you are not able to download functional test from any repository, you can find them at Ftest SVN or Anonymous Ftest SVN, where you can either download trunk and all modules, or just common and required module. There's a script, which will fetch all the functional test modules at once.

You can build and install them into your local Maven repository with:

$ mvn install

How do I add functional tests for my own Weld Example?

Since all the execution is defined in weld-example-parent in pluginManagement section of profiles, in your example you will just add the same profile with definition of functional test dependency and plugins to be executed. This suppose that weld-example-parent is parent of your example and ftest artifact is written ;). Profile used for JBoss AS 6 M1 and Weld login example is stated below:





Pleas note that existence of property ${ftest.artifact} is necessary, because it allows parent to store functional test source at appropriate place while Maven processes example source.