Archive for the ‘JDBC’ Category

I guess you people are tired/bored of reading the last series of Groovy script related blog post (Actually i am, if not you ;-). So with this blog post we will focus on a feature which doesn’t require groovy script knowledge however  it is one of the most grooviest feature provided by soapUI.

i am talking about the JDBC teststep in soapUI using which you can interact with your Database and perform quick validation of your teststep response. JDBC teststep uses the jdbc driver/connection to setup a connection with your DB and then it allows you(the tester) to pass/execute the SQL query or stored procedure. Then so executed jdbc teststep will provide the response in XML format (and can be viewed in tabular format with Pro version).

Adding a JDBC request teststep is the same old process of adding any regular teststep or groovy script. Attached snapshot highlighting the same.

Open the newly created teststep and configure the JDBC driver/connection string by clicking the configure button. Provide the required details in the “Database Configuration Wizard” :

Driver : select the respective driver for the connection (like SQL, Oracle, SAP, Sybase and so on)
Host : Name/IP address of the server where your database is residing (in my case it is at my localmachine, so localhost)
: let it remain the default port of communication or change if you know the open port on your DB server
: username having the required permission to login & execute SQL queries/stored procedures.
: respective password for the entered username
: Your DB server may/may not have more than 1 databases. To execute your queries against specific Database provide the name in this field.
Clear properties
: will clear all the entered data – somewhat similar to Reset feature.
: click the Green colored icon to perform the check where your connection is running fine or not. You will get the “Connection Successful” message or an error message based on the parameters provided.

Now enter the SQL query/Stored Proc in the JDBC teststep (with Pro version you can use Build Query window) and execute the JDBC test step. The response returned by the DB will be displayed in the XML format (and tabular format – Pro version only) which can be asserted using simple assertion or advanced assertion (like xPath, xQuery, Script and so on).

NOTE : If you want to restrict your response size (i.e., number of rows) to any specific value, then use the TestStep property MaxRows as visible on bottom left (in above screenshot).

And the fetch size property is to “The fetch size is the number of rows physically retrieved from the database at one time by the JDBC driver as you scroll through a query ResultSet.” as mentioned in eviware forum []