Instructions for QuickLook tests

Last updated at: Oct 26, 2010
By: Ming.Zhang@sun.com

I. Running QuickLook tests:


The QuickLook (QL) implements three profiles (web profile, dev_debug profile and glassfish profile) to run QL in 3 different scenarios: testing v3 web distribution, testing v3 web distribution in debug mode, testing v3 glassfish distribution.

First, install/unzip the glassfish bundle to a directory. Let's call the full path to glassfish directory as {V3 Installation Dir}.  Please do not install glassfish under v3/tests/quicklook since the "clean" target of QL will clean up all war files under quicklook directory. Change directory to v3/tests/quicklook. All italic text below indicate a command.

QL will work with the default admin password "NULL" (empty). Please clean up the previous ~/.asadminpass if it contains other password.

1. To Run QL in Glassfish Profile:

The v3 glassfish distribution includes extra modules such as EJB, jts and corba other than the modules in web distribution. The glassfish profile is the default profile of QL.
New: Added cluster testing support for QL glassfish.

The test results will be in test-output directory.

2. To Run QL in Web Profile:
The web profile (-P test_wd) should be used for testing the v3 web distribution.


3. To Run QL in Embedded Profile:
The web profile (-P test_em) should be used for testing the v3 embedded mode.


4. To Run QL in Glassfish Profile with Security Manager Turned On:

The web profile (-P test_wd_security) should be used for testing the v3 web distribution.

5. To Run QL in Web Profile with Security Manager Turned On:

The web profile (-P test_wd_security) should be used for testing the v3 web distribution.

6. To Run QL in V3 Debug Profile:

Usually, user wants to run QL against a running v3 instance started in debug mode. The dev_debug profile can be used (-P dev_debug) in this scenario.

Note: The tests require restart domain (admincli) will be skipped in this scenario.

7. To Run Individual Test Suite from Directory Level:

After the first run with maven from top level, the dependency jars will be downloaded to local maven repository. Now it's possible to run individual test suite from directory level. Change directory to the test directory. For example, to run quicklook/ejb/slsbnicmt test suite against glassfish bundle:

8. Using Local Maven Repository in Non-Default Directory:
Section 1 and 2 assume the use of default local maven repository directory, ${user.home}/.m2/repository. If you local maven repository is in another directory, say directory {Local_Maven}, you can use one of the following ways to point to your specific maven repository:

II. Adding Tests to QuickLook

1. Requirements for the Adding Tests to QL:

The QL has a wide user community which includes developer, RE and SQE teams. So the candidate tests need conform to the following criteria:

To make sure the tests don't break the RE and SQE processes, please send the tests to Ming.Zhang@sun.com for reviewing.

2. Steps of Adding Tests to QL

The test framework of QuickLook is TestNG. TestNG allows us to add/remove tests from harness easily and simplifies the client side programming. Below is an example of how to add a test suite to QL:

An easy way to do is to copy an existing test suite, such as quicklook/web/helloworld, to your test directory. Then add your java or xml files (or your test logics to the existing files) to the test directory. The build.xml and properties files are inherited.

For examples on the client side java testing code, please look at the following files for reference:

Here is an example of adding a test suite hellouniverse. All italic text indicate a command. Unix OS is used for the commands

% cp -r helloworld hellouniverse
% cd hellouniverse

Please make the following changes to build.properties
 
war.file=hellouniverse
testsuite.name=basicweb
testng.test.name=web_jsp_hello_universe
contextroot=hellouniverse
deploy.platform=v3

Please make  following changes to build.xml.  Change Project name
<project name="hello-universe" default="default" basedir=".">
Under runtest target
<param name="contextroot" value="hellouniverse"/>

% cd metadata

Edit web.xml to reflect the new application as universe .

Edit src/java/SimpleServlet.java, change the name of servlet to SimpleServlet1, change the package directory from myapp to hellouniverse and rename to src/java/SimpleServlet1.java

Edit src/test/HelloJSPTestNG.java, change the classname, testurl  and rename to src/test/HelloUniverseTestNG.java

Now all editing is complete, lets try to build/deploy/run from leaf level (hellouniverse level)

Assume we are using web.zip for glassfish. Make sure javadb and server are started  (please use ant 1.6.5)
% cd v3/test/quicklook
% ant -Dglassfish.home={V3 Installation Dir} startDerby
% ant -Dglassfish.home={V3 Installation Dir} start-server

Once the server and derby are started, go to
% cd web/hellouniverse
% ant  -Dglassfish.home={V3 Installation Dir} build

Make sure no errorss on consol
% ant  -Dglassfish.home={V3 Installation Dir} deploy

make sure no errors in server.log (while loading application)
% ant  -Dglassfish.home={V3 Installation Dir}  runtest

Now you should see 4 tests run and passed
Please add "all" target to include "build deploy runtest"

Since QL runs in multiple profiles, the test cases need to be defined in the 3 test lists (under quicklook/testng dir) for the profiles: testng_wd.xml for the Web profile, testng_gd.xml for Glassfish profile, testng_debug.xml for the debug profile. The module level testng.xml is optional but it provides the conveniences of running the module test locally. User can also choose to define the class name in the local build.xml. In this case, there is no need to defined the test cases in local testng.xml .

To integrate your tests into quicklook, please contact Ming Zhang .

III. Reference:

Add tests to QuickLook.