cancel
Showing results for 
Search instead for 
Did you mean: 

Request Not Modified

SOLVED
Highlighted
New Contributor

Request Not Modified

I need to test multiple requests in a same testcase.Below Steps have been followed to achieve this.

  1. Declared Property at Testsuite Level (eg. Number  1,2,3)
  2. Split those values and set the property in Property Step level. So each time during the iteration the property at Property Step will change.
  3. Then run the request.                           

But the issue i am facing is, the property at PropertyStep gets updated for every iteration. But the values is not passed to the request.

 

This is my code.

 

ef number = testRunner.testCase.testSuite.getPropertyValue( "number" )
String[] nu = number.split(",")
for (int i=0;i<nu.size();i++)
{
nums=nu[i]
testRunner.testCase.testSteps["Prop"].setPropertyValue( "number",nums )
def prop = testRunner.testCase.testSteps["Prop"].getPropertyValue( "number" )
log.info prop
def Response = ""

Response = testRunner.testCase.testSteps["request1"].testRequest.response.contentAsString
log.info Response
def file = new PrintWriter ("C:\\Users\\Laksh\\PycharmProjects\\BRMCODE\\response_"+i+".xml")
file.println(Response)

file.close()
}

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
New Contributor

Re: Request Not Modified

In the above code i am getting only the response without running.

i have included the below code to run the Request.This Helps

 

reqrun= testRunner.testCase.testSteps["request1"]

Response= reqrun.run(testRunner,context)

Response.getResponse().responsecontent

View solution in original post

2 REPLIES 2
Highlighted
New Contributor

Re: Request Not Modified

In the above code i am getting only the response without running.

i have included the below code to run the Request.This Helps

 

reqrun= testRunner.testCase.testSteps["request1"]

Response= reqrun.run(testRunner,context)

Response.getResponse().responsecontent

View solution in original post

Highlighted
New Contributor

Re: Request Not Modified


@Lachulearns wrote:

I need to test multiple requests in a same testcase.Below Steps have been followed to achieve this.

  1. Declared Property at Testsuite Level (eg. Number  1,2,3)
  2. Split those values and set the property in Property Step level. So each time during the iteration the property at Property Step will change.
  3. Then run the request.                           

But the issue i am facing is, the property at PropertyStep gets updated for every iteration. But the values is not passed to the request.

 

This is my code.

 

ef number = testRunner.testCase.testSuite.getPropertyValue( "number" )
String[] nu = number.split(",")
for (int i=0;i<nu.size();i++)
{
nums=nu[i]
testRunner.testCase.testSteps["Prop"].setPropertyValue( "number",nums )
def prop = testRunner.testCase.testSteps["Prop"].getPropertyValue( "number" )
log.info prop
def Response = ""

Response = testRunner.testCase.testSteps["request1"].testRequest.response.contentAsString
log.info Response
def file = new PrintWriter ("C:\\Users\\Laksh\\PycharmProjects\\BRMCODE\\response_"+i+".xml")
file.println(Response)

file.close()
}

 



In the above code i am getting only the response without running.

i have included the below code to run the Request.This Helps

 

reqrun= testRunner.testCase.testSteps["request1"]

Response= reqrun.run(testRunner,context)

Response.getResponse().responsecontent

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors