Skip to content

proposal: more readable stack trace for big JSON payload with restito integration testing #70

Open
@bieli

Description

@bieli

When I try to find bug in my JSON payload in integration tests using restito it doesn't support me with clear debug process.

For example output for failed test:

    Condition failed with Exception:

    verifyHttp(restitoServer) .once(post("/endpoint"), withPostBodyContainingJson(asString(mySpecialBigPayload)))
    |          |               |    |                     |                          |        |
    |          |               |    |                     |                          |        class path resource [payload_big.json]
    |          |               |    |                     |                          {
    |          |               |    |                     |                            "id": "51abb572-c22b-11e8-b3f9-699386e0b5fe-54091516",
    |          |               |    |                     |                            "prop": "value",
    |          |               |    |                     |                            "id": [
    |          |               |    |                     |                              "54091516"
    |          |               |    |                     |                            ],

... ~500 lines of big JSON

    |          |               |    |                     com.xebialabs.restito.semantics.Condition@6d442a82
    |          |               |    com.xebialabs.restito.semantics.ConditionWithApplicables@70b57756
    |          |               java.lang.AssertionError: Expected to happen 1 time(s), but happened 0 times instead
    |          com.xebialabs.restito.server.StubServer@73101e8b
    com.xebialabs.restito.builder.verify.VerifyHttp@7361820a
        at
 ...
        Caused by:
        java.lang.AssertionError: Expected to happen 1 time(s), but happened 0 times instead
            at com.xebialabs.restito.builder.verify.VerifyHttp.times(VerifyHttp.java:58)
            at com.xebialabs.restito.builder.verify.VerifyHttp.once(VerifyHttp.java:42)

I had wrong values in two JSON properties/fields and I think searching/debugging phase problems too longer than I expected.

Ideal solution it will be suggest what is different or probably wrong.

It will be possible to add more clear output when test failed ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions