robertc
16 years agoOccasional Contributor
How do I determine the type of a test step in a groovy script
I am reading environment variables in from an ini file in my test suite setup script and updating the properties for each step. However the JDBC step does not like properties that are not used in the SQL so I want to avoid updating the properties for a JDBC step.
My code looks like:
for (tcase in testSuite.testCaseList) {
for (tstep in tcase.testStepList) {
tstep.setPropertyValue("Endpoint", props.getProperty ( "Endpoint" ))
tstep.setPropertyValue("Username", props.getProperty( "Username" ))
tstep.setPropertyValue("Password", props.getProperty ( "Password" ))
}
}
I want it to be the following
for (tcase in testSuite.testCaseList) {
for (tstep in tcase.testStepList) {
if (tstep.type <> 'JDBC Request') {
tstep.setPropertyValue("Endpoint", props.getProperty ( "Endpoint" ))
tstep.setPropertyValue("Username", props.getProperty( "Username" ))
tstep.setPropertyValue("Password", props.getProperty ( "Password" ))
}
}
}
I tried tstep.config.type but that always returns 'request' regardless of the step type.
I have search the API but could not find what I am looking for.
Any suggestions would be appreciated.
Robert
My code looks like:
for (tcase in testSuite.testCaseList) {
for (tstep in tcase.testStepList) {
tstep.setPropertyValue("Endpoint", props.getProperty ( "Endpoint" ))
tstep.setPropertyValue("Username", props.getProperty( "Username" ))
tstep.setPropertyValue("Password", props.getProperty ( "Password" ))
}
}
I want it to be the following
for (tcase in testSuite.testCaseList) {
for (tstep in tcase.testStepList) {
if (tstep.type <> 'JDBC Request') {
tstep.setPropertyValue("Endpoint", props.getProperty ( "Endpoint" ))
tstep.setPropertyValue("Username", props.getProperty( "Username" ))
tstep.setPropertyValue("Password", props.getProperty ( "Password" ))
}
}
}
I tried tstep.config.type but that always returns 'request' regardless of the step type.
I have search the API but could not find what I am looking for.
Any suggestions would be appreciated.
Robert