rs79
rs79

Reputation: 2321

Query parameteriztion in SoapUI JDBC Requests

My test has 2 JDBC Requests.
I'd like to use the results of the first JDBC Request in the WHERE clause of the second JDBC request.

For example, querying a DB2 database, I have tried:

  1. JDBC Request 1: select member_id from Employees fetch first 1 row only
  2. JDBC Request 2: select bonus_amount from EmployeesBonuses where member_id = '${JDBC Request 1#ResponseAsXml#//MEMBER_ID}'

Unfortunately, this method of referencing doesn't work. Further, the 2 steps above reference different databases, so constructing a join'd statement is not possible.

Upvotes: 0

Views: 913

Answers (1)

Rao
Rao

Reputation: 21389

It is because Property Expansion does not work in sql query of Jdbc Request step.

Instead, have the query for 2nd as given below:

select bonus_amount from EmployeesBonuses where member_id = :MEMBERID

Above to the sql query, SoapUI allows to define the parameters. Define a parameter, MEMBERID and provide the value as Property Expansion i.e., ${#JDBC Request 1#ResponseAsXml#//MEMBER_ID}.

Now, try executing the query. For more details of query parameterization in SoapUI, refer documentation

Upvotes: 1

Related Questions