This page is maintained for older versions of Rapise only. The latest documentation can be found at: https://rapisedoc.inflectra.com
Cross Browser Testing

 

Choosing the Browser When Creating a Test

 

When you first create a Rapise test with the Methodology set to Web you will be asked to choose the initial web browser profile:

 

new_test_browser_profile_select

 

You can run your recording in a different browser than the one in which it was recorded.

 

Selecting a new Playback Browser

First, open the script for your test using the Test Files Dialog.  Locate the line where g_load_libraries is initialized.

 

Under the Hood

It is possible to have more control about cross browser execution using available APIs and configuration variables  You can also run the recording in multiple browsers in succession.  Both options require modification of the script.  The necessary modifications are described below. First, open the script for your test using the Test Files Dialog.  Locate the line where g_load_libraries is initialized.

 

If you recorded your script in IE you will see:

g_load_libraries=["%g_browserLibrary:Internet Explorer HTML%"];

 

If you recorded it in Firefox, you will see:

g_load_libraries=["%g_browserLibrary:Firefox HTML"];

 

This line tells Rapise to use the browser library specified in the special g_browserLibrary variable setting, and if no value is set, default to the named browser (Internet Explorer or Firefox in this example).

 

Changing the Playback Browser

Go to the Main Start Page of Rapise. Under the 'Current Test' section you will see the list of available web browsers:

 

start_page_choose_browser

 

Change the browser to either one of the native browsers such as Firefox, Internet Explorer or Chrome, or one of the Selenium WebDriver based browser profiles.

Once you have changed this setting, Playback the script normally and it will playback in the selected browser.

Changing this setting will effectively set the value of the g_browserLibrary global variable.

 

Playback in Multiple Browsers - SpiraTest

Executing a test in multiple browsers is slightly more complicated. We recommend that you use SpiraTest 'Test Sets' where you may define multiple test cases pointing to the same Test with a different g_browserLibrary parameter value.

The separate help document "Using SpiraTest with Rapise" provides specific instructions on using Rapise with SpiraTest to handle the specific case of cross-browser testing as well as more general support for parameterized testing.

See the SpiraTest Integration topic for more general information on using Rapise with SpiraTest.

 

Playback in Multiple Browsers - SubTests

As another option, it is also possible to use sub-tests to organize multi-browser testing where a single test executes itself in different browsers one after another.

 

1.

Record base test. Put all the recorded actions into a User-defined function and place it into <testname>user.js file. For example, function Login() inside file MyTest.user.js.

2.

Create Sub-Test for IE re-using objects and functions from the base test

3.

Modify script file in sub-test as follows:

 

function Test()

{

// Re-use 'Login()' scenario from parent test

 Login();

}

 

g_load_libraries=["Internet Explorer HTML"];

 

4.

Create Sub-Test for Firefox re-using objects and functions from parent test

5.

Modify script file in subtest as follows:

 

function Test()

{

// Re-use 'Login()' scenario from parent test

 Login();

}

 

g_load_libraries=["Firefox HTML"];

 

 

As a result you have a test for 2 browsers: IE an Firefox. Each browser is defined by a library in a corresponding sub-test. Rapise contains the Cross Browser sample using this approach.