Forum Discussion

itaykaldi's avatar
itaykaldi
Contributor
12 years ago

Connection string empty when changing enivrument

Hey,
When I change enivrument, the connection string is empty in JDBC requests, although I set it before.

Every time I change environment, its empty connection for all JDBC requests... (See attachment)

There is any way SoapUI will remember my connection for each environment?

10x.

1 Reply

  • Hi,

    This is due to a bug that we are aware of (SOAP-1210). Please use this workaround. Add the following script to this Event Handler in your project: TestRunListener.beforeRun.
    If you have not used Event Handlers in SoapUI Pro before, you can find out more here: http://www.soapui.org/Scripting-Properties/custom-event-handlers.html

    // 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()
    // 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)
    }
    }


    Regards,

    Giscard
    SmartBear Support