I want to store reponse's Id and Token in 2 variables i.e. responseId and responseToken and then use the responseId in 2nd feature file's request payload.
Feature File 1:
Feature: User Registration
Background: * url 'https://test.com'
Scenario: Register a New User Given path 'register' {
"email": "[email protected]",
"password": "Abc123",
"firstName": "Abc",
"lastName": "API",
"gender": "M",
} When method post Then status 200 * def responseToken = response.token * def responseId = response.id * print 'Token:', responseToken * print 'User ID:', responseId
Now I want to use this responseId's value in 2nd feature file Feature: Validation
Background:
* call read('feature1.feature') {responseId: '#(responseId)'}
* url 'https://test.com'
Scenario: Send OTP
Given path 'sendOTP'
* def requestPayload =
"""
{
"type": "email",
"action": "login",
"device": "Abc"
}
"""
* request.userId = {responseId: '#(responseId)'}
And request requestPayload
When method post
Then status 200
Result : Getting error on * call read('feature1.feature') {responseId: '#(responseId)'}