Cross Browser Testing

Top  Previous  Next

You can run your recording in a different browser than the one in which it was recorded.  You can also run the recording in multiple browsers in succession.  Both options require modification of the script.  The necessary modifications are described below.

 

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.

 

If you recorded your script in IE you will see:

g_load_libraries=["Internet Explorer HTML"];

 

If you recorded it in Firefox, you will see:

g_load_libraries=["Firefox HTML"];

 

Erase the current library name (Firefox HTML or Internet Explorer HTML) and replace it with the other option. Playback the script normally.

 

Playback in Multiple Browsers

Executing a test in multiple browsers is slightly more complicated. We recommend to use sub-tests to properly organize the multi-browser testing.

 

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. SmarteStudio contains Cross Browser sample using this approach.