authorjapps / authorjapps/zerocode

Assertions using json schema v3 or v4

Open
#126 9 comments 1 reaction 1 assignee Claimed by @Yash-cor View on GitHub
good first issue low-priority
Dominant language
Java
Stars
1k
Forks
453
Avg merge
7d 2h
Merged PRs (30d)
5

Description

AC1:
GIVEN-The JSON `schema` of the API response
WHEN-I assert the API response using the schema with version as parameter
THEN-I should be able to get the desired result as PASS or FAIL to determine the test status.
AND-If failed, it should display or log(WARN or ERROR level) list the failure reasons in a pretty format.

AC2:
Have mechanism to pass the Schema file for the API response in the DSL.

Note:
"responseSchema" : (* new field which you can introduce) : Keep it optional. If supplied by the user, only then validate against it(the "body" of the response).

I think only the "body" should match the Schema definition, right?
Definitely not the "status" I mean. Have a look at the Schema definition file.
If yes, then implement the field as "responseBodySchema" (instead of "responseSchema")

Example:
```JSON
{
...
...
"responseSchema": {
"schemaPath": "path/to/schema/file",
"schemaVersion": "W3 Version? 3.0 or 4.0" //<--- optional (assign a default value if not supplied by user)
},
"verify": {
"status": 200,
"body": {
"login": "octocat",
"id": 583231,
"type": "User"
}
}
}
```

--------------

AC3: (Future purpose - Implement via a new ticket if there is a Usecase for this, otherwise not needed now as AC2 shd cover most usecases)
GIVEN-I want to assert the API response using a given `schema` of v3 or v4(parameterised)
WHEN-I receive the API response
THEN-I should be able to get the desired result as PASS or FAIL to determine the test status

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.