Forum Discussion
benonline
12 years agoNew Contributor
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.
And on test case levels inside the 'Setup script' tab I added the following Groovy script.
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.
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.
Related Content
- 2 months ago
- 4 years ago
Recent Discussions
- 17 days ago