Forum Discussion

phil89's avatar
phil89
Occasional Contributor
15 years ago

Stop Load Test Suite from a Groovy Step

Hi,

I generate dynamic request with an properties and an groovy step before launching my parameter request.
Thats'ok
But if my properties doesn't exist i could not stop my LoadTest ?

I have tested without succes following code
// read the file
def properties = new java.util.Properties();
//log.info("lecture");
// le repertoire par defaut est le bin de SOAPUI
properties.load( new java.io.FileInputStream("..\\..\\..\\tirablanc\\VAL\\props_patricia_val60.properties" ));


def targetStep = testRunner.testCase.getTestStepByName( "Properties" );

if(properties.getProperty( "nom"+context.getProperty( "RunCount"))==null ) //detect l'erreur
{
//testRunner.cancel( "Pas de valeurs trouve FIN" )
//throw new Exception( "Something wnt wrong.." )
testRunner.fail( "Fin Erreur" ) //authoriser arret sur erreur dans les options "Fail on error"
}

log.info("lecture"+properties.getProperty( "nom"+context.getProperty( "RunCount")));
// assign single property
targetStep.setPropertyValue( "nom", properties.getProperty( "nom"+context.getProperty( "RunCount")));


targetStep.setPropertyValue( "prenom", properties.getProperty( "prenom"+context.getProperty( "RunCount") ));
targetStep.setPropertyValue( "clef", properties.getProperty( "clef"+context.getProperty( "RunCount") ));
targetStep.setPropertyValue( "inst", properties.getProperty( "inst"+context.getProperty( "RunCount") ));
targetStep.setPropertyValue( "nir", properties.getProperty( "nir"+context.getProperty( "RunCount") ));

Groovy step is stopping and i could see error in logs window, but LoadTest continue !!

Do you have an idea ?

Regards
Philippe
No RepliesBe the first to reply