Forum Discussion
MarcusJ
Staff
12 years agoHi,
This sounds similar to an internal defect of SOAP-1013 and reported on forum link viewtopic.php?f=4&t=14279&p=53164#p53164. As a workaround you can use this script to update the jdbc connection when changing environment.
Add this to event handler TestRunListener.beforeRun
http://www.soapui.org/Scripting-Propert ... dlers.html
This sounds similar to an internal defect of SOAP-1013 and reported on forum link viewtopic.php?f=4&t=14279&p=53164#p53164. As a workaround you can use this script to update the jdbc connection when changing environment.
Add this to event handler TestRunListener.beforeRun
/* Work with more than one JDBC connection set per environment, also does not modify connection strings when JDBC TestStep is not configured using a Project-Level JDBC connection */
// Iterate all test steps in the test case and change connectionString for all ProJdbcRequestTestStep to the selected environment connectionString.
for(testStep in context.testCase.getTestStepList())
{
// Set the connectionString for all ProJdbcRequestTestStep
if(testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.ProJdbcRequestTestStep)
{
// Get databaseName
def databaseName = testStep.getJdbcRequestTestStepConfig().getDbConnectionName()
if(databaseName != null)
{ // Get connectionString of active environment def connectionString = context.testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionByName(databaseName).getConnectionString() testStep.setConnectionString(connectionString) // Get connection password of active environment def connectionPassword = context.testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionByName(databaseName).getPassword() testStep.setPassword(connectionPassword) }
}
}
http://www.soapui.org/Scripting-Propert ... dlers.html