Skip to content

Trade-off between parametrization conciseness and function name expressiveness #21

@chillenzer

Description

@chillenzer

Should we point out that parametrisation is not always the way to go? One of the big advantages of an extensive test suite is its documenting function that gets a bit spoiled if you have extensive parametrisation in your tests. The additional comments in the parametrisation in "pytest features/Fix the function" are a good example. They are something that would have been part of the function name otherwise. Thus, if, e.g., the "Test non-integers" line failed, pytest would only give you the raw parameter values (and not the comment explaining what the test was supposed to test). One could even have two identical tests that are still supposed to test for two fundamentally different behaviors that only coincidentally happen to be identical. It would be more expressive to indicate that these behaviors are to be distinguished by having two functions. While it would, of course, be possible to split up the parametrised test if this degeneracy ever got lifted, it is not certain that at that point someone will be around to remember that and even know that there are separate behaviors there.

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