You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi, the following issue popped up with v1.1.0.RC5 - in case of several chained feature calls the payload variable defined in one of the intermediate levels gets uninitialized (or gone from the scope?) when attempting to update the payload with set. Looks like it's related to #1685 .
Here comes an example.
Given:
scenario.feature from where we call the first nested feature passing the test data examples:
an intermediate feature where we initialize jsonRequest payload variable and call another feature:
Feature:
Scenario:
* def jsonRequest = read('user.json')
* def result = call read('feature2.feature')
* print 'Result: ', result
a functional feature that actually sends the request, where we update the payload according to the test data examples:
Feature:
Scenario:
Given header Content-Type = 'application/json'
And url 'https://reqres.in/api/users'
And request jsonRequest
And set jsonRequest.name = userName
And set jsonRequest.job = userJob
When method post
Then status 201
And match response.name == userName
And match response.job == userJob
Actual result:
13:43:13.114 [main] ERROR com.intuit.karate
And set jsonRequest.name = userName
variable is null or not set 'jsonRequest'
Some notes: it works perfectly fine if not update the payload with set - i.e. jsonRequest variable remains initialized until that line.
Of course there are workarounds to overcome it - for ex., passing the jsonRequest explicitly as a parameter from feature1 to feature2 solves the issue, - however for the huge and complex projects like ours it would require a lot of refactoring efforts.
My intention of reporting it is rather to pay your attention on it as it's something that worked in RC4, but got changed in RC5. If you think it's an inevitable behavior in the light of #1685 refactoring benefits - I understand, otherwise I'm happy to help with testing.
The text was updated successfully, but these errors were encountered:
@ptrthomas verified on develop build and confirm it works, thanks! 👌
yup, I agree about the best practices :) I put it as a simplified example, in real we have a complex logic for manipulating with the soap payloads for external integrations.
hi, the following issue popped up with v1.1.0.RC5 - in case of several chained feature calls the payload variable defined in one of the intermediate levels gets uninitialized (or gone from the scope?) when attempting to update the payload with
set
. Looks like it's related to #1685 .Here comes an example.
Given:
scenario.feature from where we call the first nested feature passing the test data examples:
an intermediate feature where we initialize
jsonRequest
payload variable and call another feature:a functional feature that actually sends the request, where we update the payload according to the test data examples:
Actual result:
Some notes: it works perfectly fine if not update the payload with set - i.e.
jsonRequest
variable remains initialized until that line.Of course there are workarounds to overcome it - for ex., passing the
jsonRequest
explicitly as a parameter from feature1 to feature2 solves the issue, - however for the huge and complex projects like ours it would require a lot of refactoring efforts.My intention of reporting it is rather to pay your attention on it as it's something that worked in RC4, but got changed in RC5. If you think it's an inevitable behavior in the light of #1685 refactoring benefits - I understand, otherwise I'm happy to help with testing.
The text was updated successfully, but these errors were encountered: