Skip to end of metadata
Go to start of metadata

We have been working with the Kuali Financial System (KFS) project team to implement automated functional tests with Selenium RC, programmed using the Java scripting language Groovy and the JUnit testing framework.

The instructions below are for writing functional scripts for KFS. If you are interested only in running the current scripts, visit: Minimalists Guide to Running The KFS Functional Test Scripts

Environment Setup

  1. Install Java if you don't have it from http://www.java.com/en/download.
  2. Install Selenium RC from http://seleniumhq.org/download/. Note the location.
  3. Install Eclipse for Java Developers from http://www.eclipse.org/downloads/. Note the location.
  4. Install Groovy from http://groovy.codehaus.org/Download
  5. Use the Eclipse Update manager to install the Groovy Eclipse plugin. The URL for the update manager is:http://dist.springsource.org/release/GRECLIPSE/e3.5 for Eclipse 3.5. Select the feature "Groovy-Eclipse".
  6. Use the Eclipse update manager to install Subclipse from http://subclipse.tigris.org/update_1.6.x
  7. Add the following location using the svn perspective: https://svn.kuali.org/repos/kfs/qa/selenium/trunk/rc-groovy/
  8. Right click on the svn location and select Checkout.
    On the next screen, select 'Checkout as a project configured using the New Project Wizard' and click Finish.
    On the next screen, select 'Groovy Project' in the Groovy directory and click Next.
    Enter 'rc-groovy' as the Project Name and in the JRE section, select 'Use a project-specific JRE'. Then click Next.
    Select the Libraries tab and click the 'Add External Jars' button.
    Add junit.jar (can be found in the eclipse/plugins/org.junit.<version>/junit.jar where <version> is the latest version number).
    Click the 'Add External Jars' button again and add the selenium-java-client-driver.jar (can be found in the selenium-remote-control<version>/selenium-java-client<version>/ folder where <version> refers to the version numbers)

Directory Structure

All tests live in the rc_groovy directory and within that directory is a set of modules by name along with the smoke directory.

  • smoke directory contains basic smoke tests designed to verify that the build is running OK
  • module_name directories contains functional tests for that module; not all modules included here are core
  • each group of tests will have a file called a_suite.groovy which runs all tests in that directory

Running Tests

  1. Before starting any tests you must start the server. Go to the directory where Selenium-RC's server is located and run the following from a command-line console: java -jar selenium-server.jar
  2. Edit the config.groovy file in the common directory.
    -> set the environment to the test environment you want to run in. (i.e. KFS_REG, KFS_CNV, etc.)
    -> set the browser you want to run (i.e. BROWSER_FIREFOX, BROWSER_CHROME)
  3. Open a test case or test suite.
  4. Run it. One way to run it is to clicking the green arrow in the toolbar at the top. This will open the JUnit test runner in Eclipse and run the test or suite.

Creating Tests

The easiest way to create tests is to record them using Selenium IDE and export as a a Groovy (JUnit) - Selenium RC test case.
In order to do this, you will need to install Firefox and the Selenium IDE plugin. Once your test is recorded, use the following instructions to convert the Selenium RC using the Kuali conventions.

  1. Using Selenium IDE, export the test case using the File-> Export Test Case As.. -> Groovy (JUnit) - Selenium RC menu item. Be sure to use camelcase in naming your test case and be as informative as you can. For example, a test case that adds a new account would be called addNewAccount.groovy. All test cases should have the .groovy extension. Save the file in the directory named for the functional area that you are testing. If this is a new module, create a new directory and add your test case there.
  2. Open your newly created file in Eclipse.
  3. Replace the first line "package com.example.tests" with the package name of the module, i.e. smoke testing would be "package org.kuali.kfs.qa.tests.smoke" to correct the package name.
  4. Replace the second line "import com.thoughtworks.selenium./*"
    with "import org.kuali.kfs.qa.common./*" because the selenium libraries are included in the config.groovy file in org.kuali.kfs.qa.common.
  5. In the third line, replace the class name "GroovySeleneseTestCase" with "KualiTestCase", because the config.groovy class creates the KualiTestCase class that inherits from GroovySeleneseTestCase, but adds some specific configuration options for our environment.
  6. Delete the following lines, because the setUp function has been declared as part of the KualiTestCase class:
    @Override
    void setUp() throws Exception   {
          super.setUp('http://change-this-to-the-site-you-are-testing/', '*chrome')
          setDefaultTimeout(30000)
          setCaptureScreenshotOnFailure(false)
    }
  7. Replace all text "selenium.open(" with "selenium.open(environment+".  
  8. Replace any hardcoded urls with the environment variable.
  9. Try running your tests and tweaking as needed until you get a clean test.
  10. Add your test to the a_suite.groovy file so that it can be run as part of the suite for that test. If this is a test in a new directory, please add the a_suite.groovy file.
  11. Once your test is running well alone and within the suite script, check it and the suite file into the subversion repository.

KFS Project Specific Process

QA Manager creates test scripts and unit tests in local environment.
QA Manager checks in tested scripts to KFS SVN.
Development team monitors scripts as they do junit tests.


  • No labels