RTW - WebUI

 

RTW WebUI is the automated functional testing tool for new web and mobile web applications.

Introduction to WebUI:

For testing fat clients use RFT.

Introduction Movie

AFT - Accelerated Functional Testing

Definitions

Some of the most important elements/components of a WebUI test

Configure

Apply this setting before even thinking of start using RTW WebUI:

Must apply: Deselect "Enable test log display of System.out and System.err messages at level ALL"

In more detail:
WebUI is leveraging the Selenium engine to interact with the GUI. This engine issues a lot of messages. This and on top of the wrong handling of messages by WebUI results in tons of messages at the bottom of each run. That causes very slow responses when you are working with the log. Normally you don't need the Selenium messages.
Thanks Dawn Peters!

Steps in more detail:

  1. Start RTW WebUI
  2. Select Window > Preferences
  3. Select Test > Test Execution
  4. DE-select the op tion "Enable test log display of System.out and System.err messages at level ALL"
  5. Select OK

Experiences in V9.1 but applicable for all releases.

Figure: Super setting to reduce the log-file and increase speed.

WebUI and RQM

When Configuration Management is enabled the RQM Adapter will connect to all streams available.

When a test is executed, the result is fed back to RQM in the stream it was initiated from.

More on Global Configuration

Create

File New

You can create a test from scratch with File/New. This file can than be enhanced with Mobile and WebUI feature.

  1. Open the test
  2. Select top node
  3. Select Advanced tab
  4. Select Mobile and Web UI Feature

This gives the ability to add application and start "insert recording".

Default Wait Time

Root node of test, tab Mobile and WebUI.

Recording

Tip: When you are recording and you want to make a VP on an element you can select the screen. That will create a screenshot. On the screenshot you can apply a VP.

Software Compatibility Report

For Firefox be aware to use only the supported, like Firefox 45

Tip! When recording from a already running browser you must install an extention manually. Recording a Web UI test by using a running browser instance

Recording in an already running Browser

When recording fails remove your Firefox profile information in the following directories. This will remove any settings, bookmarks, toolbars etc from Firefox.

Issues

The following issues might be caused by other software failures.

Generation/Recording

If you have problems in generating tests (using recording) through away your user profile of the browser. On Windows:

<current user>\AppData\local\mozilla\
<current user>\AppData\roaming\mozilla\
Once it was enough to remove the profiles.ini in the roaming directory.
Above deleting might result that Firefox will update itself. Check the warning below:
Alert! Validate that you are not running a newer version! Firefox might update itself! Check this at Firefox.

Recording on IE

I had some issues with recording on IE. From IBM/HCL support I got the following tips:

  1. Click on Menu item Tools -> Internet Options -> Security tab.
  2. Select Enable/Disable Protected mode for all the zones (Internet, Local Intranet, Trusted sites, Restricted sites), should be same for all zones
  3. Open the windows registry editor. Click the "Start" button, select "Run". In the Run dialog, type "regedit" (without quotes) and press "Enter". Navigate to the following path by expanding each tree node in the registry editor.
  4. HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl
  5. Please create FEATURE_BFCACHE key. It is not available on your machine. Right-click on the "FeatureControl" key and select "New" > "Key". Type "FEATURE_BFCACHE". It should be like this: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BFCACHE
  6. Right-click FEATURE_BFCACHE key and select DWORD. Name it "iexplore.exe", and value as 0. Close the registry editor.

Now you should be able to run this as expected.

Recording on Chrome

See Documentation

Chrome Plugin

RPT Certificate

Make note that RTW Web UI makes use of the same recording technique.

How to configure HTTPS recording performance test

Enhance

You've got a script and now to want to tweak the script. Here some hints and tips.

Comment

Add comment to the script

Documentation

Figure: The added infinite loop

A known limitation is that you can not add comments in the "In Application" section.

Variable

You can define "global variables" which are shared across the tests. A separate initialization file can be used for setting the values.

Datapool

You have to apply a loop with a error condition to iterate across a datapool.

Figure: The added infinite loop

At the end of the datapool the loop results in an error. This error must be trapped. This error can also be trapped by the root element (here RecordsAll) and as a datapool property.

Figure: The definition to handle the error.

Figure: In more detail.

Be sure that the datapool is not wrapping around:

  1. Select the main test node
  2. Select the Common Option-tab
  3. Select the Datapool Properties
  4. De-select the Wrap option, see figure.

This wrap-option is interesting for performance tests to have enough data for large runs.

Figure: Deselect the datapool wrapping

Example of Compound Test with Datapool

Java

VP

	package customCode;

import org.eclipse.hyades.test.common.event.VerdictEvent;

import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;
import com.ibm.rational.test.lt.execution.moeb.custom.IMobileWebService;

import com.ibm.rational.test.lt.execution.moeb.custom.MobileWebCustomAccessor;

/**
 * @author unknown
 */
public class MyVP2 implements com.ibm.rational.test.lt.kernel.custom.ICustomCode2 {

	/**
	 * Instances of this will be created using the no-arg constructor.
	 */
	public MyVP2() {
	}

	/**
	 * For javadoc of ICustomCode2 and ITestExecutionServices interfaces, select 'Help Contents' in the
	 * Help menu and select 'Extending Rational Performance Tester functionality' -> 'Extending test execution with custom code'
	 */
	public String exec(ITestExecutionServices tes, String[] args) {
		IMobileWebService mobileWebService = MobileWebCustomAccessor.getMobileWebService();

		String msg="MyVP2 Actual:"+args[0]+" Found:"+args[1];
		if(args[0].equals(args[1])) {
			// Report a VP PASS
			msg=msg+" PASS";
			tes.getTestLogManager().reportVerificationPoint(msg, VerdictEvent.VERDICT_PASS);
			mobileWebService.reportVerdict(tes, msg, VerdictEvent.VERDICT_PASS);
		} else {
			// Report a VP failure
			msg=msg+" FAIL";
			tes.getTestLogManager().reportVerificationPoint(msg, VerdictEvent.VERDICT_FAIL);
			mobileWebService.reportVerdict(tes, msg, VerdictEvent.VERDICT_FAIL);
		}
		return null;
	}

}

It's possible to leverage the Java language to access more deeper variables, information and functions.

Example - Interation counter:

	int currLoopIter = tes.getLoopControl().getIterationCount();
	

	package customCode;

	import org.eclipse.hyades.test.common.event.VerdictEvent;

	import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;
	import com.ibm.rational.test.lt.execution.moeb.custom.IMobileWebService;

	import com.ibm.rational.test.lt.execution.moeb.custom.MobileWebCustomAccessor;

	/**
	 * @author unknown
	 */
	public class GetLoopCounter implements com.ibm.rational.test.lt.kernel.custom.ICustomCode2 {

		/**
		 * Instances of this will be created using the no-arg constructor.
		 */
		public GetLoopCounter() {
		}

		/**
		 * For javadoc of ICustomCode2 and ITestExecutionServices interfaces, select 'Help Contents' in the
		 * Help menu and select 'Extending Rational Performance Tester functionality' -> 'Extending test execution with custom code'
		 */
		public String exec(ITestExecutionServices tes, String[] args) {
			int nr =  tes.getLoopControl().getIterationCount();
			String nrs = Integer.toString(nr);
			// Forcing a message to the log.
			tes.getTestLogManager().reportVerificationPoint("Counter"+nrs, VerdictEvent.VERDICT_PASS);
			return nrs;
		}

	}
	

Swap URL

To swap the URL of the application under test it is a 2 step process which are to be executed in that order.

  1. Open the application in "Mobile and Web Applications" and update the url.
  2. Rename the application in the left project-tree.
    This will update (and copy new references) all involved tests.

Deleting files

Before deleting files (e.g. test results) close any open window. Otherwise it will result in orphans

Tip! Close all (reporting) windows before using "Delete" & "Delete files that are referenced only...".

Test Types

Test

The test is a linear action list.

Compound Test

The compound test is a test which can contain logic and can reference other tests. The compound test is the "grouping mechanism at test-tool level".
Others grouping options are:

Playback

Speed up playback

Switch off all the settings on the "Web UI Playback" page to improve playback speed.

Window > Preferences
Web UI Playback

Parallel playback

Figure: Parallel Run of Web UI test across browsers.

Command Line Execution

An example of Command Line Execution is

cd "\Program Files\IBM\SDP\cmdline"
cmdline.bat -workspace "C:\Users\Administrator\IBM\rationalsdp\workspaceWebUI101" -project Test.vanlint5.nl -plugins "C:\Program Files\IBM\IBMIMShared\plugins" -eclipsehome "C:\Program Files\IBM\SDP" -suite "Compound Tests\MasterTest.testsuite" -varfile "C:\Temp\browserSelectionVariable.xml" -results "CD Test Results\TestAll999" -exportlog "C:\Temp\webLog.txt"

You have to identify the browser with RTW_WebUI_Browser_Selection definition.

RTW_WebUI_Browser_Selection

There are various ways of defining the RTW_WebUI_Browser_Selection variable.

Valid data of the variable are can be found here.

Interactive

When starting the WebUI test in the GUI a wizzard pops up. Here you can select the browser on which the test needs to be exected. It gives the option to select multiple browsers. (this option is not yet tested with other ways of defining the RTW_WebUI_Browser_Selection variable).

Figure: Browser selection Wizzard

WebUI Variable

Define the variable in the WebUI test.

Figure: RTW_WebUI_Browser_Selection set using a WebUI variable

RQM Variable

You can define the variable in the RQM Test Case which references the imported Test Script which references the WebUI test.

Figure: RTW_WebUI_Browser_Selection set using a RQM Execution Variable

File

Where the browserSelectionVariable.xml is:

<?xml version="1.0" encoding="UTF-8"?>
    <inits>
    <variable_init value="Firefox" name="RTW_WebUI_Browser_Selection"/>
    </inits>
Tip! At the end of this article it says that you can define the variable RTW_WebUI_Browser_Selection at test level!

The webLog.txt has a log of text which is easy to parse. The webLog.moeb.zip contains a nice clickable html report. This eliminates the opening of the project taking a license.

A proposed approach can be that each project gets a Compount Test with a fixed name (e.g. "MasterTest"). This test can than be called in the CI/CD engines. By altering the Compound Test, the test which are executed are 'managed'.

Based on published work at: Command line execution

WebUI / RTC

A separate page is located here.

Strickt vs Tolerant

In early stages of development you want to be tolerant. When developement continues and the product is more stable you can add more 'stricktness' to your tests.

Tolerant testing

Strickt testing

Robustness

With robustness I mean tolerance where it's allowed. E.g. when things are failing the test continues.

Exporting and Importing

For exporting WebUI project use the options "Export Test Assets With Dependencies".
For importing WebUI project use the option "Import Test Assets With Dependencies".
Other export/import options might result in classpath issues.

Screen Width

Example screen sizes:

Mobile (portrait): 360x616
Mobile (landscape): 640x240
iPad (portrait): 768x928
iPad (landscape): 1024x672
Laptop: 1440x730

Best Practices

Some best practices which I apply

Clean Up Agent Logs

When agents are executing tests logs are created in the repository. These should be cleaned once in a while. One could clean up with a (Windows) cmd-file. This file is to be executed on the RTW Agent. Example here gives an option to remove files older than 5 days.

forfiles /p "E:\Workspaces\RTW\RQM_Results\Project1" /s /m *.* /D -5 /C "cmd /c del @path"

Duplicating Compound Test

Do not use the contextual menu (right click) to copy/paste a compound test for duplication. Use the following steps:

  1. Open the Compound Test
  2. Save As ...
  3. Type in the new name
  4. Open the new Compound Test

Other Resources