Reputation: 157
I have the Groovy Script
test step named Copying_Bulk_File_To_BulkPayment_Folder
.
def rawRequest = context.expand('${SOAP#request}')
def file1 = new File('C:/Actimize/4.23.0.30/Instances/actimize_server_1/QA/BulkPayment/NACHA/Input/RegularNachaPPD.ACH')
file1.write (rawRequest)
After that I have other groovy that should called it 10 times, but it is not doing as expected, below is the respective code.
if( context.loopIndex2 == null )
context.loopIndex2 = 0
if( ++context.loopIndex2 < 10 )
testRunner.gotoStepByName( "Copying_Bulk_File_To_BulkPayment_Folder" )
Upvotes: 1
Views: 4671
Reputation: 21349
I did have similar experience. Either gotoStepByName
does not seem to work or do not know usage of it correctly.
In order get it to work, please do the following change.
From:
testRunner.gotoStepByName("Copying_Bulk_File_To_BulkPayment_Folder")
To:
testRunner.runTestStepByName('Copying_Bulk_File_To_BulkPayment_Folder')
EDIT: OP mentioned that he still has issue without providing the details. Adding another approach to run the test step.
or try below code instead of gotoStepByName
statement.
def step = context.testCase.testSteps['Copying_Bulk_File_To_BulkPayment_Folder']
step.run(testRunner, context)
Upvotes: 1
Reputation: 3891
There are 3 problems in your script.
1) gotoStepByName, change this to runTestStepByName
2) if( ++context.loopIndex2 < 10 ) Since you want a loop better use a for loop instead of an if condition
for(int i=0; i< 10 ; i++ )
3) File name is same all the time i.e. RegularNachaPPD.ACH , even if you copy 1000 times you will not see this since the file name is same, So you should bring a logic by which every time the name of the file is different
int ok= (new Random().nextInt(100000))
print ok
def FileName='C:/Actimize/4.23.0.30/Instances/actimize_server_1/QA/BulkPayment/NACHA/Input/RegularNachaPPD_' + ok + '.ACH'
Below is the code i used and i was able to create 10 files
TestStepName :- test
if( context.loopIndex2 == null )
context.loopIndex2 = 0
for(int i=0; i< 10 ; i++ )
{
testRunner.runTestStepByName( "Copying_Bulk_File_To_BulkPayment_Folder" )
}
TestStepName :- Copying_Bulk_File_To_BulkPayment_Folder
int ok= (new Random().nextInt(100000))
print ok
def FileName='C:/Actimize/4.23.0.30/Instances/actimize_server_1/QA/BulkPayment/NACHA/Input/RegularNachaPPD_' + ok + '.ACH'
def rawRequest = context.expand('${First Step#request}')
def file1 = new File(FileName)
file1.write (rawRequest)
where SOAP is the name of another test step.
The above logic creates a random number which is appended in the name RegularNachaPPD
Hope it helps. I was able to create 10 files with above code
Upvotes: 0