gno
gno copied to clipboard
RFC(gnovm): make all gno unit tests independent (and parallel)
In Go, unit tests can share state, and developers need to manually reset the state. While we can follow the same approach, I propose a shift to make unit tests more independent by default. This involves running a new fresh gno.Machine
for each test, ensuring no shared state and allowing tests to run in parallel.
With independent tests, we can safely run all tests in parallel, speeding up the testing process. Additionally, this ensures that gno test -run XXX
is consistent, with no test dependencies. Another benefit is that it makes it harder to have implicit or hard-to-read dependencies between tests, improving the overall readability and maintainability of the test suite.
A potential need will be to show more examples of "flows" by writing subtests or test suites (a single TestXXX
with several steps). However, this doesn't seem like a big deal compared to the benefits of having independent and parallel tests. This issue is an RFC, so please share your thoughts and feedback on this proposal.