Testing: Selenium: Running ZimbraSelenium: Difference between revisions

Line 115: Line 115:
## C:\STAF> STAF local SELENIUM HELP
## C:\STAF> STAF local SELENIUM HELP
# Run a suite
# Run a suite
## C:\STAF> STAF local SELENIUM EXECUTE SERVER server.com ROOT /p4/main/ZimbraSelenium  
## C:\STAF> STAF local SELENIUM EXECUTE SERVER server.com ROOT /p4/main/ZimbraSelenium JARFILE /p4/main/ZimbraSelenium/build/dist/zimbra-6.0.0/lib/zimbraselenium.jar PATTERN projects.mobile.tests.addressbook GROUP always GROUP sanity LOG /tmp
JARFILE /p4/main/ZimbraSelenium/build/dist/zimbra-6.0.0/lib/zimbraselenium.jar  
PATTERN projects.mobile.tests.addressbook GROPU always GROUP sanity LOG /tmp


Example help:
Example help:

Revision as of 21:12, 28 October 2010

General Information

ZimbraSelenium is the automation test harness for verifying the browser based Zimbra clients.

Downloading and Building ZimbraSelenium

Please follow the steps in Testing:_Selenium:_Building_ZimbraSelenium.

Once the project built and no dependency errors were found, you are almost ready to run your tests. Just configure the tests to work properly in your environment as explained in the next section and you'll be ready to test.

Tests Configuration

The file located in ZimbraSelenium/conf/conf.properties is the master configuration file. Every parameter change required to run the tests properly is configurable using this properties file. Configure the test harness with the basic parameters required to run properly against your desired version of Zimbra by changing the following variables in the file:

  • server: This is the URL in which the Zimbra install to be tested is running. Please notice that the same must be reachable from the location in which the Selenium RC server is running (localhost, Sauce OnDemand, a remote machine).
  • serverMachineName: The machine in which the Selenium RC server will be running (localhost, sauceondemand or a reachable ip/domain).
  • browser: The browser in which the tests should run. This is the standard Selenium browser string.
  • locale: The locale in which the installed version of Zimbra is running (en_US, ch, es_Es, etc).

Running ZimbraSelenium

Running from Eclipse

The ZimbraSelenium source tree includes a build.xml file that has targets to execute the test suite.

  1. Open ZimbraSelenium/build.xml
  2. Open the "outline view", if not already open
    1. Window -> Show View -> Outline
  3. Locate the "Run-ExecuteHarnessMain" target
  4. Set the jarfile, pattern, and groups desired to be executed
  5. Right-click on "Run-ExecuteHarnessMain" in the Outline, and select "Run"

Here is an example build.xml "Run-ExecuteHarnessMain" configuration, which runs the "sanity" and "smoke" address book test cases for the Zimbra Mobile Client suite.

<target name="Run-ExecuteHarnessMain" depends="jar" description="Run all tests per specified arguments">
	<property name="jarfile" value="${dist.lib.dir}/zimbraselenium.jar"/>
	<property name="pattern" value="projects.mobile.tests.addressbook"/>
	<property name="groups" value="always,sanity,smoke"/>
	<echo>Executing ...</echo>
	<java classname="framework.core.ExecuteHarnessMain" classpathref="class.path" fork="true" failonerror="true">
		<arg line="-j '${jarfile}' -p ${pattern} -g ${groups} -l conf/log4j.properties"/>				
	</java>
</target>

Notes:

  • "always" must be included in the "groups" property
  • "zimbraselenium.jar" must be specified in as the "jarfile" property

Running from STAF

The ZimbraSelenium test suite can be configured using STAF.

Build the ZimbraSelenium STAF jar

  1. Open ZimbraSelenium/build.xml
  2. Open the "outline view", if not already open
    1. Window -> Show View -> Outline
  3. Locate the "staf-jar" target
  4. Right-click on "staf-jar" in the Outline, and select "Run"
  5. The jar file should be built (ZimbraSelenium/build/dist/zimbra-6.0.0/lib/zimbraselngstaf.jar)
...
jar:
jar-staf-selenium:
     [copy] Copying 697 files to C:\P4\main\ZimbraSelenium\build\staf\selenium\STAF-INF\classes
     [copy] Copied 171 empty directories to 1 empty directory under C:\P4\main\ZimbraSelenium\build\staf\selenium\STAF-INF\classes
     [copy] Copying 23 files to C:\P4\main\ZimbraSelenium\build\staf\selenium\STAF-INF\jars
      [jar] Building jar: C:\P4\main\ZimbraSelenium\build\dist\zimbra-6.0.0\lib\zimbraselngstaf.jar
jar-staf:
BUILD SUCCESSFUL
Total time: 33 seconds


Configure the STAF jar

Configure zimbraselngstaf.jar with STAF

  1. Open C:\STAF\bin\STAF.cfg using a text editor
  2. Configure the service by adding "service seleniumm library JSTAF execute /P4/main/ZimbraSelenium/build/dist/zimbra-6.0.0/lib/zimbraselngstaf.jar"
  3. Stop STAF
    1. C:\STAF> staf local shutdown shutdown
  4. Start STAF
    1. C:\STAF> stafproc

Staf.cfg example:

# Turn on tracing of internal errors and deprecated options
trace enable tracepoints "error deprecated"

# Enable TCP/IP connections
interface ssl library STAFTCP option Secure=Yes option Port=6550


# Set default local trust
trust level 2 default
trust machine local://local level 5

# Add default service loader
serviceloader library STAFDSLS


service selenium library JSTAF execute /P4/main/ZimbraSelenium/build/dist/zimbra-6.0.0/lib/zimbraselngstaf.jar

Execute the tests

Use STAF commands to run tests.

  1. Get the service help
    1. C:\STAF> STAF local SELENIUM HELP
  2. Run a suite
    1. C:\STAF> STAF local SELENIUM EXECUTE SERVER server.com ROOT /p4/main/ZimbraSelenium JARFILE /p4/main/ZimbraSelenium/build/dist/zimbra-6.0.0/lib/zimbraselenium.jar PATTERN projects.mobile.tests.addressbook GROUP always GROUP sanity LOG /tmp

Example help:


C:\STAF>
C:\STAF>
C:\STAF>STAF local SELENIUM HELP

Response
--------
StafTest Service Help

EXECUTE SERVER <servername|IP address> ROOT <ZimbraSelenium path> JARFILE <path> 
PATTERN <projects.zcs.tests> [ GROUP <always|sanity|smoke|full> ]* 
[ LOG <folder> ] [ LOG4J <properties file> ]

QUERY -- TBD: should return statistics on active jobs

HALT <TBD> -- TBD: should stop any executing tests

HELP



C:\STAF>


Example execute:

 

C:\STAF>
C:\STAF>
C:\STAF> STAF local SELENIUM EXECUTE SERVER server.com ROOT /p4/main/ZimbraSelenium JARFILE 
/p4/main/ZimbraSelenium/build/dist/zimbra-6.0.0/lib/zimbraselenium.jar PATTERN 
projects.mobile.tests.addressbook GROPU always GROUP sanity LOG /tmp
Response
---------------
Total Tests: 2
Total Passed: 2
Total Failed: 0
Total Skipped: 0



C:\Documents and Settings\zimbra>

C:\STAF>

Running from the command line

Running with ant commands

Installing Ant

You need Ant 1.7+ to be installed on your system.

Notice: If you are running Mac OS X 10.5 or newer you can safely skip this step — the system comes with Ant 1.7.0 pre-installed.

If you are running an older version on Mac OS X you still need to install Ant 1.7: the pre-installed Ant version is too much behind. Follow the instructions described in the "Other Systems" section.

Ubuntu

If you are running Ubuntu 8.04 "Hardy Heron", the easier way to install Ant 1.7 is to run:

 sudo apt-get install ant ant-optional

Other Systems

Install Ant 1.7.x and make sure it is in your PATH:

Download the binary distribution.
Unpack the binary distribution in the directory of your choice.
Add <where you unpacked the zip file>/apache-ant-1.7.0/bin to your PATH environment variable.
Check that your Ant installation is OK:

 ant -version
 Apache Ant version 1.7.0 compiled on December 13 2006
Running the tests
  1. cd to ZimbraSelenium dir
  2. run ant targets:
 ant "Run tests" 

Runs both ajax and html suite

 ant "Run ajax tests" 

Copies i18n and test data, compiles the code, creates the jar file and runs ajax suite

 ant "Run html tests"

Copies i18n and test data, compiles the code, creates the jar file and runs html suite

Verified Against: unknown Date Created: 11/7/2007
Article ID: https://wiki.zimbra.com/index.php?title=Testing:_Selenium:_Running_ZimbraSelenium Date Modified: 2010-10-28



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »

Jump to: navigation, search