Does automatic golden master unittest generation exist/or is it feasible?

dieter dieter at handshake.de
Wed Apr 5 04:30:01 EDT 2017


fleshw at gmail.com writes:

> I have a really large and mature codebase in py2, but with no test or documentation.
>
> To resolve this I just had a simple idea to automatically generate tests and this is how:
>
> 1. Have a decorator that logs all arguments and return values
>
> 2. Put them in a test case
>
> and have it run in production.

This works only for quite simple cases -- cases without state.

If you have something with state, than some function calls
may change the state and thereby changing the effect of later
function calls. This means: the same function call (same function,
same arguments) may give different results over time.

As a consequence, the initial state and the execution order
becomes important.




More information about the Python-list mailing list