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

In this section, you will learn how to record and execute a Rapise script against a web application.  We will be using a demo application called Library Information System.  Our test will be simple.  It will log on to the library catalog, navigate to the main menu, and click on all of the menu options to make sure the links are working.

 

1.

Open Rapise and Create New Test

Go to Start > All Programs > Inflectra > Rapise.  The following window should appear.

Rapise.zoom80

 

Click on the   File   tab in main menu and then click on the option to �Create New Test�:

clip0025

If this is your first time using Rapise on this computer, you may see the following dialog box:

clip0026

If you see this, it means that Rapise is trying to connect to a SpiraTest server. SpiraTest is our web based test management system. It is a powerful tool that can store your Rapise tests and deploy them onto remote machines for automated regression testing. However, for now just click on the [Cancel] button and you will see the �new test dialog�:

clip0027

Now enter the name of your new test �Web Testing 1�, make sure the Methodology is set to �Web: Cross-Browser Testing Support� and click [Create]. Since you chose a web test, you will now need to choose the initial web browser profile (don�t worry you can easily change it later):

clip0028

Choose �Internet Explorer HTML� from the list of options.

Next you will be asked if you want to create your tests using the scriptless Rapise Visual Language (RVL) technology or using JavaScript. For this example we will use the RVL scriptless approach. If you�re interested in creating the test using JavaScript instead, please refer to the section - Using JavaScript Scripting.

clip0085

Rapise will create the new test and you will see the empty recording grid:

clip0086

You are now ready to record your first test.

 

2.

Open the AUT (Application Under Test)

Open up Internet Explorer.  You will find it in Start > All Programs > Internet Explorer. In Internet Explorer, navigate to: http://www.libraryinformationsystem.org:

tutorial, demo, app

 

3.

The Select an Application to Record Dialog

In the Rapise window, press the Record/Learn button on the Ribbon.

ribbon, test, record-learn

 

The Recording Activity Dialog (RA dialog) will appear:

recording activity dialog

The RA dialog has a grid.  As you interact with the sample Library Information System program, the grid will automatically populate with your actions.

 

4.

Recording

Let's begin creating the test.  On the library information system login page, click on the Log In link in the top-right of the screen.

tutorial_demo_login

In the Username text box, type librarian

Click on the Password text box next.  You'll notice that the RA dialog has changed.  Your actions, clicking Log-In and entering a username, are listed in the grid:

tutorial, username in ra dialog

 

The password for user librarian is also librarian.  Type the password in and then press the Log-In button.

Two more rows should appear in the RA dialog: one to represent the password entry, and one to represent the button click:

tutorial, three steps recorded in ra dialog

 

You should now be on the main menu of the Library Information System with the user's name listed in the top-right:

tutorial, demo, mainmenu

 

Hover the mouse over the �Welcome librarian� username label on the top-right and click CTRL+1 to bring up the Verify dialog box:

clip0087

This box lets you add a checkpoint to verify the properties of an object on the screen.

Select the �Inner Text� option and click the checkbox. That will add the verification check to your list of recorded actions:

clip0088

 

Click the Book Management button.  It is highlighted in the next screenshot:

tutorial, demo, menu items, deposit highlighted

 

You should now be on the Book Management page (see the below image). Click the Home button to go back to the main menu.

tutorial, deposit page

 

Click the Create new book link:

tutorial, demo, menu items, balance highlighted

 

You should now be on the Create New Book page (see image below).  Click the HOME button to go back to the main menu.

tutorial, balance page

 

Now, click the Author Management button:

tutorial, demo, menu items, withdraw highlighted

 

You should now be on the Author Management page (see image below):

tutorial, withdrawal page

 

Click the Create New Author link:

tutorial, demo, menu items, transfer highlighted

 

You should now be on the Create New Author page (see below). Click the Home button to go back to the main menu.

tutorial, transfer page

 

At this point, there should be 11 rows in the RA dialog grid.

 

You are now back on the Main Menu.  Click Log Out (top-right).

tutorial, demo, mainmenu, logout-highlighted

 

To end the recording session, you can either press CTRL+3 or press the Stop button on the Record dialog.  End the recording session now.

Rapise will ask you whether you want to use this recording or discard it:

clip0089

Click on the Insert Here button and Rapise will insert the recorded steps into the test grid:

clip0090

Let's save our test.  Press the Save button at the top left of the Rapise window.

ribbon, test, file

 

5.

Playback

Let's execute the test we just created.  First, close Internet explorer.  Rapise will open a new instance of Internet Explorer to the correct url (www.libraryinformationsystem.org) when the test begins.

 

To execute the script, press the Play button at the top middle of the Rapise window.

play icon

 

After execution, a screen like the one below will appear.  Each row represents a step in the test. The rows with green text are steps which passed, whereas the rows with red text are the steps which failed.

 

clip0091

For more information on the report, see Automated Reporting.

 

Playback in Other Browsers

Now that we have recorded our test in Internet Explorer, we want to play the same script back in other browsers. That is very easy to do. Simply click on the shortcut for the Rapise Start Page, and then change the web browser dropdown to a different browser (e.g. Firefox, Chrome, Selenium, etc.) and click the Play button.

start_page_choose_browser

Before the playback in other browsers will work correctly, you will need to make sure you have configured the web browsers appropriately. In the case of the Selenium options, you will need to make sure you have installed the Selenium WebDriver libraries correctly.

The next section will demonstrate how you can use Rapise to inspect the objects in a web page and Learn them for testing. This is useful in cases where you have more complex applications to test and you need to pick specific objects. For example you may want to select one of the books in the grid based on its name rather than its row number (which may change if you add books).

Using the Spy Tools in Rapise
 

Learning an Object Using the Web Spy

In the main Test ribbon of Rapise, expand the dropdown list for the �Spy� tool and make sure that �Web Object� is selected:

clip0029

Now, click on the main �Spy� tool icon and Rapise will start the Web Spy:

clip0030

 
Go back to the web page and login to the library information system with the same login/password (librarian/librarian) and click on the �Book Management� menu item so that the list of books is displayed:
 

clip0031

 
Now back in the Web Spy, click on the �Get Snapshot� option to refresh the Web Spy and display the HTML elements (called the DOM tree) that make up this page:
 

clip0032

 

Once it has loaded the DOM tree, you can expand/collapse the elements to see how the web page is constructed. This is useful when testing an application since many of the HTML elements on a page may be used for layout purposes and will not be visible in the browser. In the example page, we have expanded some of the nodes to display the main section of the page and the table that contains the list of  books.

 

In addition, you can use the Track (Ctrl+T) tool to select and item in the web page and then have it be highlighted in the DOM tree. For example if we want to find the cell that contains the book title �Amsterdam�, simply click CTRL+T on the keyboard, move the mouse over the cell in the webpage, wait until the red highlighting rectangle appears and then click CTRL+T again. Rapise will now highlight that item in the DOM Tree automatically:

 

clip0033

 

You can see all of the properties of this HTML element displayed on the right, specifically:

·The tagName is displayed as �TD� (always upper case)

·The innerHTML of the element is displayed (Amsterdam)

·The CSS and XPath for locating this element is displayed

 

If you want to use this object in a Rapise test script, you can simply click the Learn button and the HTML element will be added to the Recording Activity Dialog:

 

clip0034

 

Click Finish and the object will have been added to your test�s Object Tree:

clip0035

 

 

To use this new object in our test script, we can simply use the test editor to add the appropriate command. For example, if you wanted to get the textual value of the cell in your test, you should click on the row in the grid after the Book Management � DoClick:

 

clip0092

 

Now click on the Ins Row button in the main Test ribbon to add a new row:

clip0093

 

This will insert a new row into the test. In this new row, right-click on each of the cells (as illustrated below) and pick the following values from the dropdown lists:

clip0094

 

Then choose the following:

·Type = Action

·Object = Amsterdam

·Action = GetInnerText

 

You should now have the following:

 

clip0095

 

2.2. Learning an Object from XPATH

In addition to letting Rapise automatically learn the object from the Web Spy, you can manually enter in XPATH or CSS queries to find matching elements on the page and then learn those for use in your test.

 
For example, suppose we want to dynamically find the row that has the cell containing Amsterdam and then click on its Edit hyperlink.

 

Open up the Web Spy as before:

clip0037

 

In the Locators section of the Web Spy, enter in the following to locate the table:

 

//table[@id='MainContent_grdBooks']

 

Now click on the Test XPath button to display the matching results:

 

clip0038

 

clip0039

 

Now that we have matched the table, we need to add dynamic XPath to find any row that has the cell containing �Amsterdam� and find the edit link. You can expand the table and see the rows and cells visually and that will help us create the XPATH:

 

//table[@id='MainContent_grdBooks']//tr/td[text()='Amsterdam']/../td[5]/a

 

This XPath consists of the following elements:

1.Finds the table with the specified ID

2.Find any row inside that table that contains a cell with the text �Amsterdam�

3.For any matching cell, get its parent row and inside the fifth cell, get any hyperlink

In this case that will correctly locate the Edit link for the book �Amsterdam�. Now that we have the correct item identified, click on the �Learn� button to the right of the �Test XPath� button. That will now learn a new object that corresponds to the �Edit Amsterdam� object:

clip0040

Click Finish and the object will have been added to the Object Tree of the current test:

clip0041

 

To click on this object, simply click on the row in the grid where you want this action to occur and choose �Ins Row� from the test ribbon:

clip0096

In this new row, right-click on each of the cells, and pick the following values from the dropdown lists:

·Type = Action

·Object = Edit

·Action = DoClick

 

So your test will now look like:

clip0097

Since clicking on the Edit link will take you to a different page than where the �Create New Book� link is available, we need to add another row and add:

·Type = Action

·Object = Book_Management

·Action = DoClick

 

so that Rapise goes back to the main book list page before executing the Create New Book step. If we did not do this, the test would have failed.

This means the test will now look like:

clip0098

Now the line:

clip0099

by itself does not do anything, it just gets the text.

So, to make the test more useful, we can use the Assert command to turn this into a test for the correct value. To make the change, simply delete this entire row using the Del Row option on the ribbon and add a new blank row in its place.

Now choose the Type as Assert and press ENTER on the keyboard. You will now have the following:

clip0100

This is a generic placeholder for any type of conditional test. We need to first change the value of the message �TBD� to something meaningful (e.g. �Check that the name matches�):

clip0101

This is the message that will be displayed if the test passes correctly.

Now we need to replace the first parameter with the output from the result of the Amsterdam test. To do this, change the Condition on the second row from: param1 == param2 to output1 == param2:

clip0102

Notice how Rapise automatically changed the second row from Param to Action.

Now in the TBD cell next to the Action type, choose the Amsterdam object name and the GetInnerText action from the dropdown lists. Finally change the param2 string from TBD to the expected value �Amsterdam�.

You will now have:

clip0103

Now click Play to playback the new test:

clip0104

The test should now pass successfully.