Skip to content

Add Request.WithReporter and WithAssertionHandler #234

@gavv

Description

@gavv

Add two new methods to Request:

  • WithReporter(Reporter)
  • WithAssertionHandler(AssertionHandler)

WithReporter(reporter) should be equivalent to:

WithAssertionHandler(DefaultAssertionHandler{
    Reporter: reporter,
    Formatter: r.config.Formatter,
})

WithAssertionHandler should update r.chain.handler with given handler. For that, we'll need to add new method chain.setHandler.

New methods should have documentation and tests. In tests, we should check that after these calls, request and it's newly created children (i.e. Response, its body, etc) start using new handler to report failures.

For that, we can create a mock reporter, pass it to request using WithReporter or WithAssertionHandler, then perform an assertion that will fail (req.Expect()....) and then check that the mock reporter is in failed state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or requesthelp wantedContributions are welcome

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions