Janine_Billings
16 years agoOccasional Contributor
Data Source and Data Source loops executing all web service requests Help!
Hi
What I want to achieve is read data source from csv file
depending upon a field branch to a specific test request and execute
whilst records exist
what I've configured
DataSource
Groovy Script
Request1
DataSourceLoop1
Request2
DataSourceLoop2
The groovy script is a simple switrch statement - got to Request1 or Request2 based on the flag in the dataSource - this works fine when using the log.info to unit test, see code below
def type = context.expand( '${DS_RNU#Type}' )
log.info('type = '+type)
switch (type)
{
case 'RNU1':
log.info( "gotoStepByName( RNU1 )");
testRunner.gotoStepByName( "RNU1");
break;
case 'RNU2':
log.info( "gotoStepByName( RNU2 )");
testRunner.gotoStepByName( "RNU2");
break;
default: log.info("broken");
}
Expected
-----------
Whilst there are still records in the csv file loop through and branch to the specified request and repeat
Actual
--------
It loops through all records and executes the required branch, however if there is only one record in the csv file and this record is to branch to Request1 it does so correctly and then executes Request2 with the same data. If it n I stop it from doing this, I would like it to end the test case when the correct branch has been executed and no more records exist
This does not occur if it has to go to Request2 1st
Thanks in advance for any assistance
Christopher
What I want to achieve is read data source from csv file
depending upon a field branch to a specific test request and execute
whilst records exist
what I've configured
DataSource
Groovy Script
Request1
DataSourceLoop1
Request2
DataSourceLoop2
The groovy script is a simple switrch statement - got to Request1 or Request2 based on the flag in the dataSource - this works fine when using the log.info to unit test, see code below
def type = context.expand( '${DS_RNU#Type}' )
log.info('type = '+type)
switch (type)
{
case 'RNU1':
log.info( "gotoStepByName( RNU1 )");
testRunner.gotoStepByName( "RNU1");
break;
case 'RNU2':
log.info( "gotoStepByName( RNU2 )");
testRunner.gotoStepByName( "RNU2");
break;
default: log.info("broken");
}
Expected
-----------
Whilst there are still records in the csv file loop through and branch to the specified request and repeat
Actual
--------
It loops through all records and executes the required branch, however if there is only one record in the csv file and this record is to branch to Request1 it does so correctly and then executes Request2 with the same data. If it n I stop it from doing this, I would like it to end the test case when the correct branch has been executed and no more records exist
This does not occur if it has to go to Request2 1st
Thanks in advance for any assistance
Christopher