Database Verification Point Reference

prevnext

About the Database Verification Point


A database verification point is a preconstructed verification point used to verify data in a JDBC accessible data source. This is the verification point that you typically use in EJB testing.

You can use this verification point within a test script to ensure that the changes that the component-under-test makes to the data source are correct.


Requirements for Using the Database Verification Point

The database verification point requires QualityArchitect.

In addition, the ClassPath must reference a number of .JAR files. For a list of the required .JAR files, see Running Test Scripts.


Components of the Database Verification Point

The database verification point contains the following classes and interface:

These classes are included in the package com.rational.test.vp.


Examples

This section contains examples of how you can insert a static and a dynamic database verification point into a test script.

Note that the verification point framework does much of the work for you. The test script defines the verification point's metadata and calls the performTest() method in the specialized Verification Point class. Depending on whether you are inserting a static, dynamic, or manual verification point, the test script might also build the expected data object and the actual data object.

For an overview of the steps required to insert a verification point into a script, see Setting Up Verification Points in Test Scripts.


Example of a Static Database Verification Point

In a static verification point, the performTest() method does not pass data objects to the verification point . As a result, the framework must provide both the expected (baseline) and actual data objects.

String sJDBCdriver = "sun.jdbc.odbc.JdbcOdbcDriver"; 
String sJDBCurl = "jdbc:odbc:COFFEEBREAK"; 
String sJDBCuser = ""; 
String sJDBCpassword = "";  

DatabaseVP regressionVP = new DatabaseVP( "RegressionVP1",	 
	 	 	 	 "SELECT * FROM COFFEES",sJDBCuser, sJDBCpassword,
	 	 	 	 sJDBCdriver, sJDBCurl );

regressionVP.performTest( null ); 

Example of a Dynamic Database Verification Point

In a dynamic verification point, the test script creates a DatabaseVPData object for the expected data and passes the expected data object to the verification point through the performTest() method. As a result, the framework encapsulates only the actual data object.

String sJDBCdriver = "sun.jdbc.odbc.JdbcOdbcDriver"; 
String sJDBCurl = "jdbc:odbc:COFFEEBREAK";  
String sJDBCuser = ""; 
String sJDBCpassword = "";  
String sFilter = "1";

DatabaseVPData vpdExpected = new DatabaseVPData(); 
String[] asColumns = new String[2]; 
asColumns[0] = "Brand"; 
asColumns[1] = "Price"; 
vpdExpected.setColumns(asColumns); 

Vector vData = new Vector(); 
String[] asData = new String[2]; 
asData[0] = "Peets"; 
asData[1] = "5.5"; 
vData.add(asData);  
vpdExpected.setData(vData); 

String sSQL = "SELECT Brand, Price FROM COFFEES WHERE ID = " + sFilter; 
DatabaseVP VP1 = new DatabaseVP( "CoffeeVp1", sSQL, sJDBCuser,
	 sJDBCpassword, sJDBCdriver, sJDBCurl ); 

// Perform the test
VP1.performTest(null, vpdExpected); 

prevnext


Rational Test Script Services for Java Rational Software Corporation
Copyright (c) 2003, Rational Software Corporation http://www.rational.com
support@rational.com
info@rational.com