Knowledge Base Article

> Knowledge Base > Rapise

It is often useful to have a common set of code libraries and objects that can be reused amongst multiple tests. With Rapise this can be done by creating a common test and then including it into the other actual tests. This article describes the process

The steps for creating a common library are as follows:

  1. Create a new Rapise test using the "New Test" option.
  2. Call this test "Common.sstest". This will hold the common functions and objects
  3. Click on Record/Learn and learn the various objects that will be part of the library.
  4. These objects will be saved in Common.objects.js
  5. Put any common library functions in the Common.user.js file

Now close this "Common.sstest" common Rapise test library and start a new test script (e.g. called Test1.sstest). This test will have its own objects file (Test1.objects.js) and user functions file (Test1.user.js).

Now in the "Test Files" tab, right-click on the "Scripts" folder and choose the option to "Add File(s)...". Change the filetype from "*.js" to "*.sstest" and include the Common.sstest file. You should now have the following test hierarchy:

If you right-click on the "Common.sstest" icon and choose "Show Objects", the objects from the included common library will be displayed in the "Object Tree" tab along with the objects from the individual test script (Test1).

Now to include these common functions and libraries in your test (e.g. Test1.sstest) you just need to include some commands at the beginning of the main Test() entry point:

function Test()
    //Load the shared objects

    //Click on a shared object

The final line with the DoClick() is just an example of using one of the shared objects.



Selected files will be attached to any email sent on saving ticket.

file selected files selected  () Delete Selected

  • Created:
  • by:

Select files to upload

Or drag and drop files here

Uploading …
Upload More?
There was an error.
Try again?

Save to upload the selected file(s)

Article Info
  • Last Updated: 6/27/2018
  • Article ID: KB19
  • Views: 8585