Knowledge Base Article

Home Page > Knowledge Base > Rapise

Article Re-Using Test Logic

by Adam S on Wednesday, February 25, 2015

It is common for test scenarios to share similar pieces of functionality. A good example of such sharing is login logic. This guide outlines ways in which you can share such logic to avoid having repeated code in your tests.

Consider the ATM sample at The user should Sign In to make one of the available operations: Withdraw, Deposit, Transfer or Balance. After operations are complete the user should Logout.


The very basic test set for this application will contain separate test scenarios:

Test withdraw

  • Sign On
  • Do Withdraw
    • Press Withdraw
    • Choose Account Number
    • Remember Current Balance
    • Specify Withdrawal Amount
    • Press OK
    • Verify PLEASE REMOVE YOUR CASH message appears
    • Verify that final Balance = initial balance - withdrawal amount
    • Press OK to finish Withdraw
  • Logout

Test deposit

  • Sign On
  • Do Deposit
    • Press Deposit
    • Choose Account Number
    • Specify Deposit Amount
    • Press OK
    • Verify YOUR DEPOSIT IS COMPLETE message appears
    • Press OK to finish Deposit
  • Logout

Test transfer

  • Sign On
  • Do Transfer
    • Press Transfer
    • Select Destination Account
    • Press Next
    • Select Source Account
    • Set Transfer Amount
    • Press Next
    • Check that CONFIRM TRANSACTION message is displayed
    • Press TRANSFER Button
    • Check YOUR TRANSFER IS COMPLETE message is displayed
    • Press OK
  • Logout

Test balance

  • Sign On
  • Do Balance
    • Press Balance
    • Verify data in the table
    • Press OK
  • Logout

All these scenarios have same common thing. Each of them starts with Sign On and finishes with Logout.

Implementing Test Set Structure

We are going to utilize the concept of sub-tests to share the common functionality between different test scenarios. We assume that all learned application objects and common functions will be stored in a single place. Each test scenario is to re-use common logic and to add its own scenario-specific logic and parameters.

We will reach the described goal in several steps.

Step 1: Create Base Test

We will call it a 'Base' because it contains all objects and common functions reused then in test scenarios.

In Rapise choose "New" to create a new test. Specify desired name. We will call the base test ATMBase in this tutorial: