Contributions
Re: [Res] DB Connection string is not updated when changing env
A better workaround could be to add almost the same code inside the project 'Event' tab and then for the event name TestRunListener.beforeRun: // 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.11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.3KViews0likes0CommentsRe: [Res] DB Connection string is not updated when changing env
Here at Topicus Finan we also have this issue and I have created a workaround for it with help of Groovy. On all suite levels inside the 'Setup script' tab I added the following Groovy script. // Get first databaseName. databaseName = testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionAt(0).getName() // Get connectionString of active environment. connectionString = testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionByName(databaseName).getConnectionString() // Iterate all testcases in the suite. for(testCase in testSuite.getTestCaseList()) { // Iterate all test steps in the test case and change connectionString for all ProJdbcRequestTestStep to the selected environment connectionString. for(testStep in testCase.getTestStepList()) { // Set the connectionString for all ProJdbcRequestTestStep if(testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.ProJdbcRequestTestStep) { testStep.setConnectionString(connectionString) } } } And on test case levels inside the 'Setup script' tab I added the following Groovy script. // Get first databaseName. databaseName = testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionAt(0).getName() // Get connectionString of active environment. connectionString = 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 testCase.getTestStepList()) { // Set the connectionString for all ProJdbcRequestTestStep if(testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.ProJdbcRequestTestStep) { testStep.setConnectionString(connectionString) } } Now when you switch from environment inside a suite or test case the setup script will automatically set the correct connection string based on the configured JDBC inside the enviroment tab of the working project. Regards, Ben.11 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.3KViews0likes0Comments