1

I need to use the parameters from one request in another request's URL parameter. The code snippet is as follows:

  Scenario: Lists all Students (limited information)
    Given path "/students"
    When method GET
    Then status 200
    * def student = response.students[0]
    Then print student

  Scenario: GET - Retrieve the complete details of a Student 
    Given path "/students/" + student.id 
    When method GET
    Then status 200
    Then print response

On using this karate throws the following exception:

ReferenceError: "student" is not defined in <eval> at line number 1 

What went wrong here? Any help would be appreciated.

Venkat
  • 2,604
  • 6
  • 26
  • 36
  • Remove the line containing the second Scenario keyword. You need to have both the requests within a single scenario. – Neodawn Apr 26 '20 at 17:08

0 Answers0