What are the downsides using random values in Unit Testing?

前端 未结 11 1417
不知归路
不知归路 2020-12-06 08:59

I\'m talking about a large scales system, with many servers and non deterministic input in high capacity. When i say non deterministic i\'m talking about messages that are s

11条回答
  •  执念已碎
    2020-12-06 09:43

    Additional Downside that hasn't been mentioned as yet is that your tests may intermittently fail at random, especially when you randomly generate several test variables so they form a convoluted and sometimes untractable dependencies. See example here.

    Debugging these is a right pain in the backside and sometimes is (next to) impossible.

    Also, it's often hard to tell what your test actually tests (and if it tests anything at all).

    Historically in my company we use random tests at multiple levels (Unit, Integration, SingleService Tests), and that seemed like a great idea initially - it saves you code, space and time allowing to test multiple scenarios in one test.

    But increasingly that gets to be a sticky point in our development, when our (even historic and reliable in the past) test start failing at random - and fixing these is way labour-intensive.

提交回复
热议问题