software testing & project management tools - inflectra - rapise | quick start … quick...
TRANSCRIPT
Date: May 8th, 2017
Rapise® | Quick Start Guide
An Introduction to Testing Web Applications with Rapise
Page 1 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Contents
Introduction ......................................... 1
1. Recording Your First Script ........... 2
1.1. Open Rapise .............................. 2
1.2. Opening the Application Under
Test (AUT) ......................................... 4
1.3. Starting the Recording Session . 5
1.4. Recording the User Interactions 5
1.5. Playback of the Record Actions11
2. Using the Spy Tools in Rapise .... 13
2.1. Learning an Object Using the
Web Spy .......................................... 13
2.2. Learning an Object from XPATH
........................................................ 17
3. Next Steps ..................................... 21
Appendix A – Configuring Web
Browsers ........................................... 22
A.1. Preparing Internet Explorer (IE)
........................................................ 22
A.2. Preparing Firefox ..................... 22
A.3. Preparing Google Chrome ....... 23
Appendix B – Setting up Selenium
WebDriver .......................................... 27
B.1. Configuring Selenium on a PC 27
B.2. Installing Selenium on a Mac .. 32
Appendix C- Using JavaScript Tests
............................................................ 35
C.1. Learning an Object Using the
Web Spy .......................................... 35
C.2. Learning an Object from XPATH
........................................................ 38
Introduction
Rapise® is a next generation software test
automation tool that leverages the power of
open architecture to improve application quality
and reduce time to market.
This guide provides a quick step-by-step tutorial
for creating a sample Rapise automated test
against a web application and playing the results
back.
For further information on using Rapise, please
refer to the more comprehensive Rapise User
Guide. For information on using Rapise in
conjunction with our SpiraTest test management
system, please refer to the Using Rapise with
SpiraTest Guide.
Page 2 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
1. Recording Your First Script
In this section, you will learn how to record and execute a Rapise script. We will be using a demo web
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.1. Open Rapise
Go to Start > All Programs > Inflectra > Rapise. The following window should appear:
Click on the File tab in main menu and then click on the option to ‘Create New Test’:
If this is your first time using Rapise on this computer, you may see the following dialog box:
Page 3 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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’:
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):
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 Appendix C – Using JavaScript
Tests.
Page 4 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Rapise will create the new test and you will see the empty recording grid:
You are now ready to record your first test.
1.2. Opening the Application Under Test (AUT)
Open Internet Explorer. You will find it in Start > All Programs > Internet Explorer. In Internet Explorer,
navigate to: http://www.libraryinformationsystem.org:
Page 5 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Make sure your browser zoom is set to exactly 100% for recording and playback.
1.3. Starting the Recording Session
In the Rapise window, press the Record button on the Ribbon.
The Recording Activity (RA) dialog box will appear:
The RA dialog has a grid. As you interact with the Library Information System program, the grid will
automatically populate with your actions.
TIP: Please, don't hurry while doing recording. It is recommended to perform actions slowly, record in
small portions and look at the recording activity window to see that the actions are captured as you
expect them. You can record more actions later. Remember, that you will record it once and then play it
back many times over. So, a good quality of recording will save you a lot of time in the future!
1.4. Recording the User Interactions
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:
In the username text box, type librarian
Page 6 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
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:
You should now be on the main menu of the Library Information System with the user's name listed in the top-right:
Hover the mouse over the “Welcome librarian” username label on the top-right and click CTRL+1 to bring up the Verify dialog box:
Page 7 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
This box lets you add a checkpoint to verify the properties of an object on the screen.
Select the “Inner Text” option and click X. That will add the verification check to your list of recorded actions:
Next, click the Book Management button. It is highlighted in the next screenshot:
Page 8 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
You should now be on the Book Management page (see the below image).
Click the Create new book link:
You should now be on the Create New Book page (see image below). Click the HOME button to go back to the main menu.
Now, click the Author Management button:
Page 9 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
You should now be on the Author Management page (see image below):
Click the Create New Author link:
You should now be on the Create New Author page (see below). Click the Home button to go back to the main menu.
Page 10 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
At this point, there should be approximately ten rows in the RA dialog grid.
You are now back on the Main Menu. Click Log Out (top-right).
To end the recording session, you can either press CTRL+3 or press the Finish button on the Record
dialog. End the recording session now.
Rapise will ask you whether you want to use this recording or discard it:
Click on the Insert Here button and Rapise will insert the recorded steps into the test grid:
Page 11 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Let's save our test. Press the Save button at the top left of the Rapise window.
1.5. Playback of the Record Actions
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.
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.
Page 12 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Congratulations… You have just recorded and played-back your first automated test script using Rapise.
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.
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.
A copy of the instructions for setting up the web-browsers and Selenium is included in Appendix A and B
of this guide respectively.
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).
Page 13 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
2. Using the Spy Tools in Rapise
2.1. 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:
Now, click on the main ‘Spy’ tool icon and Rapise will start the Web Spy:
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:
Page 14 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
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:
Page 15 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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 o Rapise will list various different XPATH / CSS options that you can choose from.
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:
Click Finish and the object will have been added to your test’s Object Tree:
Page 16 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
Now click on the Ins Row button in the main Test ribbon to add a new row:
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:
Page 17 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Then choose the following:
• Type = Action
• Object = Amsterdam
• Action = GetInnerText You should now have the following:
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:
Page 18 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
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
Page 19 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
Click Finish and the object will have been added to the Object Tree of the current test:
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:
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:
Page 20 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
Now the line:
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:
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”):
This is the message that will be displayed if the test passes correctly.
Page 21 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
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:
Now click Play to playback the new test:
The test should now pass successfully.
3. Next Steps
Now we recommend that you take a look at the Rapise User Manual. This contains several more in-depth
tutorials for using the system as well as an in-depth reference guide of all the different features available.
Page 22 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Appendix A – Configuring Web Browsers
Before you can use Rapise with certain web browsers to do web testing, you will need to install plugins so that Rapise can communicate with them.
A.1. Preparing Internet Explorer (IE)
Unlike the other web browsers, there are actually no steps needed to configure IE. Once Rapise is installed, it is ready to connect to IE for recording, playback and learning without any configuration steps.
A.2. Preparing Firefox
In order to test web applications using the Firefox web browser, you will need to install an extension for Firefox that allows Rapise to interact with it:
1. Launch Firefox. Navigate to the following URL: http://www.inflectra.com/Rapise/Downloads.aspx:
2. Click on the ‘Rapise Add-In For Firefox’ hyperlink and it will take you to the Firefox Add-Ons page:
3. Click on the ‘Add to Firefox’ button to install the Add-On into your instance of Firefox.
Page 23 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
4. Click “Install Now” in the software installation dialog that appears:
5. When installation is complete press “Restart Now” to complete the installation:
6. Once Firefox is started again, you should now see the RapiseFirefox Add-On listed in the
‘Extensions’ section of the Firefox Add-ons Manager:
7. Firefox is ready to be used with Rapise for automated testing.
Note: Rapise requires localhost port 4247 to be accessible for correct operation. Please,
make sure that this port is unblocked in your Firewall.
A.3. Preparing Google Chrome
In order to test web applications using the Google Chrome browser, you will need to install an extension for Chrome that allows Rapise to interact with it:
1. Launch Chrome. Navigate to the following URL: http://www.inflectra.com/Rapise/Downloads.aspx:
Page 24 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
2. Click on the ‘Rapise Extension for Google Chrome’ hyperlink and it will take you to the Chome store:
3. Click on the ‘Free’ button to install the Rapise extension into your instance of Chrome. You will be asked to confirm that you want to Add the extension:
Page 25 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
4. Once the extension has been installed, you will see the following confirmation dialog box:
5. To view the extension, click on the “wrench” icon next to the omnibox and choose Tools > extensions. You should now see the chrome extension manager with the Rapise extension listed:
6. It is recommended to set the "Allow access to file URLs" checkbox so that web pages opened from the local folder (using the file:// protocol) can be also accessed by Rapise when running automated browser tests.
Testing Local Applications
The Rapise Chrome extension is not loaded by Chrome if a web page is opened from the local folder (file://). To overcome this restriction make sure that "Allow access to local URLs" checkbox is set.
1. In Chrome type following URL: chrome://extensions If you don't see the omnibox (the field where
to type URL) please press Ctrl+T to show new chrome window.
2. 2. Set "Allow access to local URLs" checkbox:
Page 26 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Page 27 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Appendix B – Setting up Selenium WebDriver
This section describes the process for setting up Rapise to work with Selenium. Since Rapise is a
Windows® application, you can use a single computer running Rapise to use the following web browsers:
• Internet Explorer
• Google Chrome
• Mozilla Firefox
• Opera
• Microsoft Edge
However because Safari only runs on Apple Mac computers, you will need to use two computers (a Mac
running Safari) and a PC running Rapise to test using the Apple Safari web browser:
B.1. Configuring Selenium on a PC
Once you have installed Rapise on your local computer, you need to perform the following steps to
configure each of the web browsers to use Selenium and Rapise:
Firefox
Unlike the other web browsers, Firefox does not require anything special to be done, it already includes a
built-in plugin for use by Selenium WebDriver. However if you start using Rapise with Firefox and you see
the following issue inside of Firefox:
Then it means that the version of Selenium WebDriver that shipped with Rapise is no longer compatible
with the installed version for Firefox. The solution is straightforward, just go to the main Selenium website:
http://www.seleniumhq.org/download/ and then download the C# WebDriver Bindings:
Page 28 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Download the Selenium-dotnot-x.x.x.zip file from the website. Proceed to unzip the archive and then
look in the net40 subfolder and extract the following two files and copy into the C:\Program Files
(x86)\Inflectra\Rapise\Bin folder (or wherever you installed Rapise):
• WebDriver.dll
• WebDriver.Support.dll
Note: You will need to close Rapise before copying these files into the Bin folder.
Microsoft Edge
To use Selenium with Microsoft Edge, you will need to download the latest version of the Edge Driver
from the Microsoft website:
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/#downloads
Create a new folder on your local PC called: C:\Program Files (x86)\Microsoft Web Driver Download the MicrosoftWebDriver.exe to this local folder you just created:
Page 29 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Internet Explorer
To use Selenium with Internet Explorer, you will need to download the latest version of the Internet
Explorer IE Driver:
http://selenium-release.storage.googleapis.com/index.html
The list of versions at time of writing was:
When you click on the folder for the latest version you will see the various files that can be downloaded:
Download the IEDriverServer_XXXX_X.X.X.zip to your local PC:
Page 30 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
• IEDriverServer_Win32_X.X.X.zip (for 32-bit Internet Explorer)
• IEDriverServer_x64_X.X.X.zip (for 64-bit Internet Explorer)
The file inside the zip archive is called IEDriverServer.exe and you need to copy it into the C:\Program
Files (x86)\Inflectra\Rapise\Bin folder (or wherever you installed Rapise).
Chrome
To use Selenium with Google Chrome, you will need to download the latest version of the Chrome Driver:
http://chromedriver.storage.googleapis.com/index.html
The list of versions at time of writing was:
When you click on the folder for the latest version you will see the various files that can be downloaded:
Download the chromedriver_win32.zip to your local PC.
The file inside the zip archive is called chromedriver.exe and you need to copy it into the C:\Program
Files (x86)\Inflectra\Rapise\Bin folder (or wherever you installed Rapise).
Opera
To use Selenium with Opera, you will need to download the latest version of the Opera Driver:
https://github.com/operasoftware/operachromiumdriver/releases
This page will list the latest version of the driver at the top of the page:
Page 31 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Download the operadriver_winXX.zip to your local PC:
• operadriver_win32.zip (for 32-bit Opera)
• operadriver_win64.zip (for 64-bit Opera)
The file inside the zip archive is called operadriver.exe and you need to copy it into the C:\Program
Files (x86)\Inflectra\Rapise\Bin folder (or wherever you installed Rapise).
Page 32 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
B.2. Installing Selenium on a Mac
The reason for using Selenium running on a Mac is to be able to execute tests against the Safari web
browser. So although you can also use the Mac to test with Firefox, Opera and Chrome, we do not
recommend this as it adds needless complexity.
Safari
The first thing you need to do is download the latest version of the Selenium server for Apple Mac
computers:
http://selenium-release.storage.googleapis.com/index.html
The list of versions at time of writing was:
When you click on the folder for the latest version you will see the various files that can be downloaded:
Download the selenium-server-standalone-X.XX.X.jar to the Mac.
Run this Java application by double clicking the downloaded .JAR file in Finder. This will startup the
Selenium server.
Note: You will need to have the Java (ideally the latest version) installed on the Mac first.
Once you have this running, you will need to then download the actual Safari WebDriver plugin. This can
be found at the following location:
Page 33 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
https://github.com/SeleniumHQ/selenium/wiki/SafariDriver
Download the SafariDriver.safariextz file to the local computer and the double-click to install in Safari:
Once that has been installed, you are now ready to test web applications running on Safari. The final step
is to tell Rapise where it can find that instance of Selenium. To do that, open up Rapise (on your PC) and
click on Options > Tools and then click on the ‘Selenium Settings…’ entry:
Page 34 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Now you need to change the Uri field to point to your Mac. The format of the URI will be:
• http://<IP or DNS name of MAC computer>:4444/wd/hub
(for example it could be http://test-mac01.local:4444/wd/hub or http://192.168.0.52:4444/wd/hub)
Page 35 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Appendix C- Using JavaScript Tests
This section will demonstrate how you can use Rapise to inspect the objects in a web page and Learn
them for testing using the JavaScript test script language instead of the Rapise Visual Language
(RVL) that was illustrated in section 2.
This is useful in cases where you have more complex applications to test and you want to be able to use
the power of a full programming language such as JavaScript to iterate over data, perform calculations
and use if…then…else branches to follow different steps during the test.
C.1. 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:
Now, click on the main ‘Spy’ tool icon and Rapise will start the Web Spy:
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:
Page 36 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
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:
Page 37 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
Click Finish and the object will have been added to your test’s Object Tree:
Page 38 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
You can now expand this object and drag a test function to your test script. For example if you wanted to get the textual value of the cell in your test, drag the “GetInnerText” function into your test script:
C.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:
Page 39 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
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:
4. Finds the table with the specified ID
5. Find any row inside that table that contains a cell with the text ‘Amsterdam’
6. For any matching cell, get its parent row and inside the fifth cell, get any hyperlink
Page 40 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
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:
Click Finish and the object will have been added to the Object Tree of the current test:
To click on this object, simply drag the ‘DoClick’ function for the new object from the Object Tree into the
test script. This will cause the book details page for Amsterdam to be display during test playback:
Page 41 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Since clicking on the Edit link will take you to a different page than where the ‘Create New Book’ link is
available, in the example we have added a second instance of the:
SeS('Book_Management').DoClick();
Command, 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.
Now the line:
SeS('Amsterdam').GetInnerText();
by itself does not do anything, it just gets the text.
So to make the test more useful, we can use the global Tester object to add a step to verify this value.
Drag the “AssertEqual” function from the Tester object to your test script just above the
SeS(“Amsterdam”) line:
Now we need to just consolidate these two lines into the actual test. Using the script editor, change the
two lines from:
Tester.AssertEqual('', null, null);
SeS('Amsterdam').GetInnerText();
To
Tester.AssertEqual('The values match', 'Amsterdam',
SeS('Amsterdam').GetInnerText());
Now click Play to playback the new test:
Page 42 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
The test should now pass successfully.
Page 43 of 44 © Copyright 2006-2017, Inflectra Corporation This document contains Inflectra proprietary information
Legal Notices
This publication is provided as is without warranty of any kind, either express or implied, including, but not
limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement.
This publication could include technical inaccuracies or typographical errors. Changes are periodically
added to the information contained herein; these changes will be incorporated in new editions of the
publication. Inflectra Corporation may make improvements and/or changes in the product(s) and/or
program(s) and/or service(s) described in this publication at any time.
The sections in this guide that discuss internet web security are provided as suggestions and guidelines.
Internet security is constantly evolving field, and our suggestions are no substitute for an up-to-date
understanding of the vulnerabilities inherent in deploying internet or web applications, and Inflectra cannot
be held liable for any losses due to breaches of security, compromise of data or other cyber-attacks that
may result from following our recommendations.
SpiraTest®, SpiraPlan®, SpiraTeam®, Rapise® and Inflectra® are either trademarks or registered
trademarks of Inflectra Corporation in the United States of America and other countries. Microsoft®,
Windows®, Explorer® and Microsoft Project® are registered trademarks of Microsoft Corporation. All other
trademarks and product names are property of their respective holders.
Please send comments and questions to:
Technical Publications
Inflectra Corporation
8121 Georgia Ave, Suite 504
Silver Spring, MD 20910-4957
U.S.A.