Forum Discussion
czyzyk29
12 years agoContributor
It's not working with your handler. In Soap UI and in Testrunner I have failed tests because of wrong data source (wrong connnection to data base)
In may first post I give you my event with refresh of my enviroment - only in Sopa UI not in testrunner.
May I discribed better.
I have 2 enviroments connect with 2 data base
-env trunk -> trunk base
-env dev -> dev base
In data source I connect to this data base by Data Connection, it's JDBC connection.
In event TestRunListener.beforeTestStep I refresh Data Connection and refresh datasource (I add connection password)
It't work fine in SOAP UI but not in Testrunner.
In may first post I give you my event with refresh of my enviroment - only in Sopa UI not in testrunner.
May I discribed better.
I have 2 enviroments connect with 2 data base
-env trunk -> trunk base
-env dev -> dev base
In data source I connect to this data base by Data Connection, it's JDBC connection.
In event TestRunListener.beforeTestStep I refresh Data Connection and refresh datasource (I add connection password)
//take database Name
def databaseName = context.testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionAt(0).getName()
//take connection String
def connectionString = context.testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionByName(databaseName).getConnectionString()
def connectionPassword = context.testCase.testSuite.project.activeEnvironment.databaseConnectionContainer.getDatabaseConnectionByName(databaseName).getPassword()
//for all step in test case
for(testStep in context.testCase.getTestStepList())
{
//if therr are data source
if(testStep instanceof com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep)
{
//not be a grid (i have same grids in project)
if(!(testStep.getDataSource() instanceof com.eviware.soapui.impl.wsdl.teststeps.datasource.GridDataSource))
{
//not by disabled
if(testStep.disabled == false)
{
//change connection string
testStep.getDataSource().databaseConnection.setConnectionString(connectionString)
testStep.getDataSource().databaseConnection.setPassword(connectionPassword)
}
}
}
}
It't work fine in SOAP UI but not in Testrunner.