Rapise - Global commands - Database

February 20th, 2015 by inflectra

In Rapise there are several options as far as controlling interaction with a database from outside the user interface. Most of what you do in Rapise is interaction just like a user would, clicking buttons and interacting with drop-downs, text boxes, and on-screen data, but occasionally there is a need to make a manipulation behind the scenes.

Why Access a Database?

Data Validation

One of these situations is in the case of validation. When needing to validate that your on-screen actions are having the desired effect. Let's say you have just entered a new order into your POS system, or client tracking system. The primary function is to have that data available later. In order for that to happen, it must be logged into the database and stored. Sure, you could do a lookup from the screen, and probably should, but this does not ensure that the data has left memory and been actually put into storage for the long term.

The scenario, in this case, involved querying the database pre-insertion to insure record does not exist in its final form, performing the task to enter or modify the record, validating that the record has been modified in the database, then validating that it is accessible from the user interface. This way you have ensured that the test case is not corrupted by pre-existing data and you validate that the process works through validating data storage and retrieval.


Another scenario you may wish to consider is one where the data for the test is contained in a database. In this case, the database may be queried for the most recent or relevant data depending on other elements. Real-time queries can provide for some very powerful tests on systems that are changing moment by moment.

There are certainly other types of queries and manipulations you may wish to do as a part of your database testing, experiment, and feel free to play. Please be sure that you are not testing on a production database as data destruction is not looked at as a kindly mistake. If you must test on production please make a backup of the database pre-test, and restore post-test. One final item of note, check your database permissions. If you attempt to query or manipulate without acceptable permissions the test will fail through no fault of the tool, but a "fault" of security.

The Rapise Database Commands

To access the database commands in Rapise, select the object tree element on the left-hand side. One of the elements you will see in the collapsed form is Global. Expand global by clicking on the plus sign and you will see one of the contained items is Database. By expanding the Database section you can drag and drop the various commands into your test.

The commands are as follows…

  • DoAttach(connection_string, sql) - this is how you start the process, it attaches to a Database with given ActiveX Data Object (ADO) or ODBC connection string and SQL query. Your hardest part of this will be determining your connection string. We would recommend speaking with your database administrator to determine the best way to build it. This command returns a TRUE if it was successful
  • DoMoveToRow(rowInd) - this command will move to a designated row number in the database
  • DoRandom() - will select a random row and column in the database.
  • DoSequential() - Move to the next row in the table currently in use. When the end of the table is encountered the return will be FALSE.
  • GetColumnCount() - returns a number representing the number of columns
  • GetColumnName(index) - returns the column name.
  • GetColumnNames() - returns all names in table
  • GetCurrentRowIndex() - returns current row index, zero based.
  • GetRowCount() - returns number of rows in the result set
  • GetValue(columnId, rowId) - returns current value of data in table designated by row and column id

rapise automation buttons