Forum Discussion
benonline
11 years agoNew Contributor
A better workaround could be to add almost the same code inside the project 'Event' tab and then for the event name TestRunListener.beforeRun:
Then for every test case the connectionString will be set correctly, this will make my last workaround not necessary to configure it separately for every test suite and test case.
// Get first databaseName.
databaseName = context.testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionAt(0).getName()
// Get connectionString of active environment.
connectionString = context.testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionByName(databaseName).getConnectionString()
// 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)
{
testStep.setConnectionString(connectionString)
}
}
Then for every test case the connectionString will be set correctly, this will make my last workaround not necessary to configure it separately for every test suite and test case.