Skip to content

Assertions using json schema v3 or v4 #126

Open
@dinesh76in

Description

@dinesh76in

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:

{
    ...
    ...
    "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

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions