Skip to content

Change the default check for status code to be more open #199

@JeffryGonzalez

Description

@JeffryGonzalez

Right now, if you dont assert on a specific status code, the Scenario checks for a 200, or it fails.

In light of changes to Wolverine being more specific with status codes (e.g. 204, etc.) I'd suggest changing the default to "SuccessStatusCode" (from a feature merged last year). It checks for 200-299.

@jeremydmiller suggested this would require a full point release, and I trust him, but it is a bit weird. Nothing currently passing would fail, but it is testing for less than what was expected before. (e.g. if a test didn't specify a status code it would only pass it it was a 200, with this change that test would still pass, but would also pass if the endpoint returned a 201, or 204, or whatever).

I personally feel the SuccessStatusCode would be a better default - it harshes my mellow when I have a passing test, then it fails because I change a post to return a 201 instead of a 200 (and I hadn't specified my intention in the test in the first place).

This seems like a win to me. It might just mean a change here https://github.com/JasperFx/alba/blob/master/src/Alba/Scenario.cs#L270

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions