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
Question
I have a case where we are retrieving a large json and we need to change some fields based on some conditions.
We have a cucumber test with a table, and when certain conditions of that table apply we need to add or replace some values in the JOSN message to be send by citrus to the SUT.
Example table (original table contains more):
A | B | C | D
1 | true | abc | false
A is always mapped to some field
So when B is true we need to change a field in the JSON to another constant value, if false leave it as is.
I would like to be able to manipulate the JSON-string before sending it to the TestCaseRunner so I don't need to use the process(jsonPath().expression()). The process does not allow me to apply on condition. So I'm missing that part of functionallity to change the JSON based on some conditions (condition apply to certain fields to be changed or not). In XSLT we were able to apply some transformation based on conditions.
What I've tried so far
Additional information
Would it be possible to do without having to parse the same JSON multiple times (for each condition)?
The text was updated successfully, but these errors were encountered:
Should I use something like JsonPath from com.jayway.jsonpath:json-path ?
Bealdung has here more information about extracting but I see you can also manipulate the json, and can use predicates.
Citrus Version
Latest
Question
I have a case where we are retrieving a large json and we need to change some fields based on some conditions.
We have a cucumber test with a table, and when certain conditions of that table apply we need to add or replace some values in the JOSN message to be send by citrus to the SUT.
Example table (original table contains more):
A | B | C | D
1 | true | abc | false
A is always mapped to some field
So when B is true we need to change a field in the JSON to another constant value, if false leave it as is.
I would like to be able to manipulate the JSON-string before sending it to the TestCaseRunner so I don't need to use the process(jsonPath().expression()). The process does not allow me to apply on condition. So I'm missing that part of functionallity to change the JSON based on some conditions (condition apply to certain fields to be changed or not). In XSLT we were able to apply some transformation based on conditions.
What I've tried so far
Additional information
Would it be possible to do without having to parse the same JSON multiple times (for each condition)?
The text was updated successfully, but these errors were encountered: