From richfaces-svn-commits at lists.jboss.org Tue Jan 5 10:57:33 2010 Content-Type: multipart/mixed; boundary="===============2847944900949439098==" MIME-Version: 1.0 From: richfaces-svn-commits at lists.jboss.org To: richfaces-svn-commits at lists.jboss.org Subject: [richfaces-svn-commits] JBoss Rich Faces SVN: r16241 - branches/community/3.3.X/samples/richfaces-demo/functional-test. Date: Tue, 05 Jan 2010 10:57:33 -0500 Message-ID: <201001051557.o05FvXg4011178@svn01.web.mwc.hst.phx2.redhat.com> --===============2847944900949439098== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: lfryc(a)redhat.com Date: 2010-01-05 10:57:32 -0500 (Tue, 05 Jan 2010) New Revision: 16241 Added: branches/community/3.3.X/samples/richfaces-demo/functional-test/README.h= tml Removed: branches/community/3.3.X/samples/richfaces-demo/functional-test/README.t= xt Log: - RFPL-314 Complete README for richfaces-demo/functional-test Added: branches/community/3.3.X/samples/richfaces-demo/functional-test/READ= ME.html =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/community/3.3.X/samples/richfaces-demo/functional-test/README.= html (rev 0) +++ branches/community/3.3.X/samples/richfaces-demo/functional-test/README.= html 2010-01-05 15:57:32 UTC (rev 16241) @@ -0,0 +1,133 @@ + + + + +

RichFaces-Demo - functional-test

+ = +

About

+ = +

Introduction

+

Functional test uses Maven and TestNG to run integration tests, which = consist of automated browser testing using Selenium web application testing system.

+ = +

Structure

+

Each component from RichFaces-Demo application corresponds with one package o= f test cases (except of components which share one presentation like dat= a table, column and column group).

+

Each package is divided to one or more test cases presenting features = of one component, traditionally distinguished by own tab.

+ = +

Location

+

All test cases are under src/test/richfaces/integrationTest p= ackage, separated to packages by component name such as

+

org.jboss.richfaces.integrationTest.dataTable

+

and each test case is named by feature it corresponds like

+

org.jboss.richfaces.integrationTest.dataTable.Ext= endedDataModelTestCase

+ = +

TestNG descriptor

+

All of the tests forms suite and they are enumerated in TestNG descrip= tor src/test/resources/testng.xml.

+ = +

Logging

+

By default selenium local instance of SeleniumServer logs to file = target/selenium/selenium-server.log.

+ = +

Resources

+

The majority of locators and assert values used in test are externaliz= ed in *.properties files.

+

You can find all string belonging to the given package of test cases i= n path such as src/test/resources/${package}/locators.properties (= */messages.properties respectively).

+ = +

Build environment

+

Recommended: Maven 2.1.0, SunJDK 1.6.0_16

+

Requires locally built selenium-testing-lib library (obtain i= t from SVN repository)

+ = +

Command-line usage

+ = +

Basics

+

Tests run in integration-test phase, but also post-integr= ation-test contains finalization processes.

+

So basic operation which you may want to trigger is run all of the tes= ts - this operation requires specification of browser to use (propagated to= Selenium configuration; consult do= cumentation):

+

$ mvn post-integration-test -Dbrowser=3D"*fire= fox"

+

(we can use also verify phase adequately since it is more sim= ple to type)

+

$ mvn verify -Dbrowser=3D"*firefox" +

This command run the tests using externally run container. This is def= ault behaviour, but you probably want to prepare all of the necessary stuff= in container instead:

+ = +

Container specification

+

Build are using Cargo to run richfaces-demo inside container. To use t= hat, you must specify containerId definition:

+

$ mvn verify -Dbrowser=3D"*firefox" -Dcontaine= rId=3Dtomcat6x

+

Configuration now supports:

+ +

By default, build is configured to obtain container installation archi= ve from URL in specified version. In that way is container downloaded autom= atically (note: Cargo is caching the downloaded binary).

+

You can specify the version manually by redefining container.versi= on:

+

$ mvn verify -Dbrowser=3D"*firefox" -DcontainerId= =3Dtomcat6x -Dcontainer.version=3D6.0.18

+

You also may want avoid downloading container (note: it is highly reco= mmended to specify the version of container to overwrite default version, b= ecause build isn't able to obtain it automatically from archive):

+

$ mvn verify -Dbrowser=3D"*firefox" -DcontainerId= =3Dtomcat6x -Dcontainer.version=3D6.0.18 -Dcontainer.installer.url=3Dfil= e:/home/foo/binaries/apacha-tomcat-6.0.18.zip

+

(notice the file:/ prefix in container.installer.url= definition)

+ = +

Running one-off tests

+

By default, complete suite specified in TestNG descriptor are run duri= ng integration-test phase.

+

If you want to run only selected tests, use comma-separated list of pa= ths specifing the test cases (you can use wildcards). For example:

+

+

$ mvn ... -Dtest=3DTooltipTestCase=
+
$ mvn ... -Dtest=3D"extendedDataTable/*" (run all of the tests for EDT)
+
$ mvn ... -Dtest=3D"ActionParameter*,toolti= p/*" (run ActionParameterTestCase and all of the tests for Tool= tip)
+
$ mvn ... -Dtest=3D"*Validator*" <= i>(run all validator tests)
+

+ = +

Selenium configuration

+

Additional settings which influence selenium configuration defaults: + = +

Maximizing selenium window with tested application

+

$ mvn ... -Dselenium.maximize=3Dtrue<= /p> + = +

Run selenium in debugging mode

+

This mode allows force to use selenium debug mode and also browser sid= e logging (note: this combination is very verbose):

+

$ mvn ... -Dselenium.debug=3Dtrue

+ = +

Changing host and port of SeleniumServer

+

By default build uses local selenium (localhost:8444) started= in pre-integration-test phase, but you can define other host and/= or port too:

+

$ mvn ... -Dselenium.host=3Dremote.host -Dsele= nium.port=3D4444

+

(note: despite of specifying other host for connecting remote Selenium= Server, the local instance of SeleniumServer is triggered automatically on = the specified port ${selenium.port} listening on 0.0.0.0 = - so give a attention what port are you using)

+

(note: build automatically prepares JavaScript extensions for Selenium= Server, so it is necessary to copy that extensions from target/test-cla= sses/custom-extensions.js and start designated SeleniumServer with swi= tch -userExtension pointed to that file - the custom-extension= s.js are built in process-test-resources phase)

+ = +

Which richfaces-demo artifact use?

+

(You may omit following examples if you aren't using Cargo (containerI= d definition) to deploy richfaces-demo.)

+

By default, selenium obtains newest snapshot of richfaces-demo from snapshots.jboss.org, but you may want to override version - in t= hat case use one of following methods to specify artifact what you want to = be tested:

+ = +

Specifying release version

+

$ mvn ... -Ddemo.version=3D3.3.3.BETA1

+

But especially when testing release, you may want to specify suitable = profile for given container, so let specify classifier of richfaces-demo ar= tifact:

+

$ mvn ... -DcontainerId=3Dtomcat6x ... -Ddemo.ver= sion=3D3.3.3.BETA1 -Ddemo.classifier=3Dtomcat6

+

$ mvn ... -DcontainerId=3Djboss5x ... -Ddemo.vers= ion=3D3.3.3.BETA1 -Ddemo.classifier=3Djee5

+

(If you don't define demo.classifier, standard behaviour (no = classifier) taken precedence and you should use only JavaEE 5 compatible co= ntainers (don't use tomcat6x))

+

$ mvn ... -DcontainerId=3Djboss5x ... -Ddemo.vers= ion=3D3.3.3.BETA1 (defaults to -Ddemo.classifier=3D"")=

+ = +

Use local richfaces-demo artifact

+

If you want use artifact on your local filesystem (specified by locati= on), just use:

+

$ mvn ... -Ddemo.location=3D../richfaces-demo.= war

+

or

+

$ mvn ... -Ddemo.location=3D$HOME/richfaces-de= mo-3.3.3-20100104.212113-50.war

+

This is very usable for:

+
    +
  • locally built or modified artifacts
  • +
  • testing snapshots other than the latest
  • +
+ = +

Application context

+

You can redefine application context, where application actually resid= es (defaults to http://localhost:8080/richfaces-demo/) in followin= g way:

+

$ mvn ... -Dcontext.root=3Dhttp://some.host/ -= Dcontext.path=3D/deployed/richfaces-demo/

+

(note: this definition points Selenium where application resides, so t= he host must be available from host where selenium instance is running)

+ = +

Use prepared template of Firefox profile

+

If you already have Firefox's profile prepared for testing (e.g. when = you have there installed own extenssions), you may use it as template for S= elenium:

+

$ mvn ... -Dbrowser=3D"*firefox" -DfirefoxProf= ileTemplate=3D"$HOME/.mozilla/8vykwrsm.default"

+

(note: don't be scared about using such profile since Selenium makes a= working copy of given profile first)

+ = +

Testing JSF2

+

It is necessary to use jsf2 definition to run test properly con= figured for JSF2:

+

$ mvn ... -Djsf2

+

(note: that definition implies turning profile jsf2_0 = on: -Pjsf2_0)

+ = +

Configuration by default

+

All of the definitions above are configured with respect of configurat= ion by default paragidm, so it is possible to achieve different behaviours = with varying combinations.

+

All default values are specified in pom.xml in properties.

+ + \ No newline at end of file Deleted: branches/community/3.3.X/samples/richfaces-demo/functional-test/RE= ADME.txt =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- branches/community/3.3.X/samples/richfaces-demo/functional-test/README.= txt 2010-01-05 13:31:41 UTC (rev 16240) +++ branches/community/3.3.X/samples/richfaces-demo/functional-test/README.= txt 2010-01-05 15:57:32 UTC (rev 16241) @@ -1,46 +0,0 @@ -1) Build environment - -Needs third-party library selenium-testing-lib library. - -You can obtain it from https://svn.devel.redhat.com/repos/jboss-qa/wfk/tru= nk/selenium-testing-lib -(until it is available from maven repositories). - -Install it into your local maven repository. - - -2) Running tests - -It's necessary to have running web/app server with richfaces-demo deployed= on it. - -To run tests, you have to set up Maven's property called "browser" which c= ontains browser -type and path to its binary if needed. You can specify application's conte= xt by setting Maven properties = -named "context.root" and "context.path". = - -To set them, either edit profiles.xml or pass runtime arguments to maven, = e.g. - mvn install -Dbrowser=3D*firefox - mvn install -Dbrowser=3D"*firefox /usr/lib/firefox-3.5.2/firefox" - mvn install -Dbrowser=3D*iexplore -Dcontext.root=3Dhttp://localhost:80= 80/ -Dcontext.path=3D/richfaces-demo - -Default values are set in pom.xml. - - -3) Profiles - -Since some tests might not be runnable on some platforms, there are separa= te testng.xml files in -src/test/profiles for each platform (unix/windows/mac). - - -4) Properties files - -The majority of locators and assert values used in test are externalized i= n *.properties files. You can find = -all string belonging to the class in src/test/resources/packagename/locato= rs.properties or = -src/test/resources/packagename/messages.properties. - - -5) Generating testng.xml - -$ find -name "*.java" | grep -v Abstract | sort | tr '/' '.' | sed -r 's#= ^..(.*).java$#\n\t\n\t\t\n\= t\n\n#' = - - - - --===============2847944900949439098==--