Is it possible to define message values as optional?
Opened this issue · 0 comments
In GTP example Create Request defines what fields should be present. By this example I've managed to prepare Create Response. But unlike Request we may receive either predicted set of fields, or only part, all depending on Cause in Response.
For example. On Create Response where Cause is Accepted, there we can expect F-TEID of PGW. But if Cause is not Accepted (i.e. System Failure), then no additional fields will be present besides Cause itself.
Thus if in the test I expect failed Create procedure, then I define Create response with only Cause present. But due to some bug I receive Accepted response with additional fields present. And Robot FW fails on message parsing due to unknown fields are present.
[FAIL] Not enough data for 'F-TEID.ie_type'. Needs 1 bytes, given 0
So question is: can I define protocol where some fields and values might be optionally present? Or present if some condition is met?
Then I could define generic Create response and check if expected fields are present:
Test Failed Create Response
[Tags] GTPv2 Smoke
Create Session Request
Client Sends Message APN.value.access_point_name:apn.to.fail.test
Create Session Response # here I want to have generic Response message applicable for most scenarios and than will be verified in lines below
${response}= Client receives message header:teid:0x12345
Should Be Equal As Integers ${response.Cause.value.cause} ${Cause_MissingOrUnknownAPN}
Should Be Empty ${response.F-TEID}