First of all you need to download DB driver, e.g. ojdbc7.jar and place it in binext folder of dir:

C:Program Files (x86)SmartBearSoapUI-5.3.0binext

Then you can use groovy script to create connection to DB, query test values and assign it to SoapUI parameter:

import groovy.sql.Sql 
import"")"  init DB connection...")

def scriptServer = ""
def scriptPassword = "password"
def scriptSid = "oraSid"
def scriptUsername = "dbUser"
def scriptDBport = "1111""oracle.jdbc.driver.OracleDriver")
sql = Sql.newInstance("jdbc:oracle:thin:@${scriptServer }:${scriptDBport}:${scriptSid}", "${scriptUsername}", "${scriptPassword}", "oracle.jdbc.OracleDriver") 

def queryUserId= "" +
"select userId from " +
"  (select userId from " +
"  users_table " +
"  where age between 21 and 80 and driver_licence = 1"
"  order by dbms_random.value) " +
"where rownum = 1"

def res = sql.firstRow(queryUserId)
def user_id = res[0].toString()

testRunner.testCase.setPropertyValue( "user_id" , user_id)


And then use these variables (as SoapUI castom properties) in of requests & assertions of responses:


Source link


Please enter your comment!
Please enter your name here