1

In Karate, I have following: Feature file FA containing scenario SA and Feature file FB containing scenario SB

String Variable VA is generated in scenario SA. From scenario SB, I would like to initialize a new string variable VB by calling the variable VA from scenario SA. I don't know how to do that after researching. Can someone please suggest?

astar
  • 111
  • 2
  • 12

1 Answers1

0

First I can point you to an example: Api calling in loop sending different id in url each time

Note how the variable bookingid is set in the second Scenario. Please spend time reading the docs here to understand how it works: https://github.com/karatelabs/karate#call

To make things even more clearer, here is another example:

Feature:

  Scenario: caller
    * def result = call read('@called')
    * match result.foo == 'bar'

  @called
  Scenario:
    * def foo = 'bar'
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248