Connecting to DB inside Test Steps for various processes is required most often in any Test Suite.
So how do we get a connection of DB2 database (for that matter any database) using Groovy in SOAP UI ?
Its simple, basically we will get an sql instance first using parameters like JDBC connection URL, driver class name etc..
This link refers to the Sql class’s API which is used to get the connection Say if we use the generic method get Instance(url, user, pwd, driver Name) to get the instance and thence execute some SQL queries, we could proceed this way: The pre-setup for this would be placing the required jars for DB connectivity in lib folder of SOAP UI and setting their paths to the CLASSPATH variable in bin/file.
Or, instead of manually adding HTTP Requests, you may want to use JMeter's HTTP(S) Test Script Recorder to create them.
This is generally only a problem for manually created test plans, as a test plan created using a recorder would continue from the redirected URL.(In case of DB2 connection, we need to place db2and db2jcc_license_jars inside lib directory and set their paths to CLASSPATH variable in file of bin directory). Several test elements use JMeter properties to control their behaviour.The URL and data fields of the parent sample will be taken from the final (non-redirected) sample, but the parent byte count and elapsed time include all samples. Note that the Http Client sampler may log the following message: , the options to encode the parameter, and an option to include or exclude an equals sign (some applications don't expect an equals sign when the value is the empty string).The query string will be generated in the correct fashion, depending on the choice of "Method" you made (i.e. Also, if you are sending a file using a multipart form, the query string will be created using the multipart form specifications.