Skip to content

Emphasize the advantage of isolating non-deterministic behavior #22

Description

@chillenzer

I think "Testing Randomness" is an important section. But I'm missing the big disclaimer in the beginning that this should be a last resort. Most of your code should be deterministic with randomness injected from tiny well-controlled pieces of code. So, while it is a worthwhile section, it would be great to (at the very least) mention the possibility of monkey-patching non-deterministic parts of the code. Even further, I would argue that you hardly ever write anything that produces randomness itself and in any other case your tests could be 100% deterministic if you mock out your source of randomness for something you control during the tests. Python is the perfect playground for this because monkey-patching is so easy.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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