Forum Discussion

anusha21's avatar
anusha21
Occasional Contributor
7 years ago

REST Request Test Step is not running when i ran it from test case

HI all,

 

Goal: my goal is to run my script million times to store my values in DB, it ran fine upto 760000 and stopped . since then its not running from test case or when i run it from script (from my 3rd test step) so i want to finish remaining 300000 records)

 

 

Please help me on this ,(more details as follows)

 

Suddenly my test step stops running when i run it from test case, when i open Test step i am seeing (attachment 1 with no raw response) 

 

- Please see my attachment 2 where i am sending valid json response by getting data from Project properties

 

I ran same request on test step itself and it ran fine and Output is also displaying as expected (see attachment 3)

 

When You look at My test case you notice i created 3 test steps

1. POST request 

2. Groovy script with below code and 

3. Groovy test step with Below code

 

 

2. code as follows

import com.eviware.soapui.support.XmlHolder


def parsedJson = new groovy.json.JsonSlurper().parseText(context.response)

log.info parsedJson
// def arg = [parsedJson.permissionName,parsedJson.scopeObjectId,parsedJson.userId]

def PnameTextAndValue = CallPermissions(parsedJson.permissionName)
PnameTextAndValue = PnameTextAndValue.substring(PnameTextAndValue.indexOf("[") + 1, PnameTextAndValue.indexOf("]"))
def Pnamefields = PnameTextAndValue.split(',');
int PnameIntVlal = Pnamefields[1].toInteger() + 1
def PnameAlpha = Pnamefields[0] + PnameIntVlal.toString()
log.info "PnameAlpha--->"+PnameAlpha
testRunner.testCase.testSuite.project.setPropertyValue("permissionName", PnameAlpha)

def SOIdTextAndValue = CallPermissions(parsedJson.scopeObjectId)
SOIdTextAndValue = SOIdTextAndValue.substring(SOIdTextAndValue.indexOf("[") + 1, SOIdTextAndValue.indexOf("]"))
def SOIdfields = SOIdTextAndValue.split(',');
int SOIdIntVlal = SOIdfields[1].toInteger() + 1
def SOIdAlpha = SOIdfields[0] + SOIdIntVlal.toString()
log.info "SOIdAlpha--->"+SOIdAlpha
testRunner.testCase.testSuite.project.setPropertyValue("scopeObjectId", SOIdAlpha)

def UIdTextAndValue = CallPermissions(parsedJson.userId)
UIdTextAndValue = UIdTextAndValue.substring(UIdTextAndValue.indexOf("[") + 1, UIdTextAndValue.indexOf("]"))
def UIdfields = UIdTextAndValue.split(',');
int UIdIntVlal = UIdfields[1].toInteger() + 1
def UIdAlpha = UIdfields[0] + UIdIntVlal.toString()
log.info "UIdAlpha--->"+UIdAlpha
testRunner.testCase.testSuite.project.setPropertyValue("userId", UIdAlpha)

 


String CallPermissions(def currentFieldValue )
{
String[] parseArg = currentFieldValue.split("(?<=\\d)(?=\\D)|(?=\\d)(?<=\\D)");
def numb = Arrays.toString(parseArg[1])
String numbResult = numb.substring(numb.indexOf("[") + 1, numb.indexOf("]"));
// int IntVlal = numbResult.toInteger()
// log.info "IntVlal--->"+IntVlal
log.info (Arrays.toString(parseArg[0]))
String TextResult = (Arrays.toString(parseArg[0]))
TextResult = TextResult.substring(TextResult.indexOf("[") + 1, TextResult.indexOf("]"));
log.info "TextResult-->"+TextResult

return [TextResult,numbResult]
}

 

 

3. Code as follows

 

import com.eviware.soapui.support.XmlHolder


for(int i=1; i<=300000; i++)
{
def testStep = testRunner.testCase.testSteps['POST']
testStep.run( testRunner, context )
def testStep1 = testRunner.testCase.testSteps['IncrementPermission']
testStep1.run( testRunner, context )
}

 

  • anusha21's avatar
    anusha21
    Occasional Contributor

    its sorted and working fine

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      Just as a note, you posted this in the TestComplete forum, not the ReadyAPI or SoupUI forum.  

      • anusha21's avatar
        anusha21
        Occasional Contributor

        thanks i will make sure i will post my questions in there