hpi-epic / BP2021

Working repository in context of the bachelor project "Online Marketplace Simulation: A Testbed for Self-Learning Agents" at the research group Enterprise Platform and Integration Concepts
MIT License
3 stars 0 forks source link

[test_Customer] make the tests deterministic #174

Open blackjack2693 opened 2 years ago

blackjack2693 commented 2 years ago

You can do better assertions if you mock the randomization or initialize it with a fixed seed so the output becomes deterministic.

_Originally posted by @Raandom in https://github.com/hpi-epic/BP2021/pull/151#discussion_r777106504_

The assertion of the customer logic is limited by the randomisation. We should use a seed to make the results deterministic and accurately testable.

NikkelM commented 2 years ago

Apparently pytest-randomly also sets the random.seed according to its seed, so we could use that. https://pythonawesome.com/pytest-plugin-to-randomly-order-tests-and-control-random-seed/