Skip to content

RFC(gnovm): make all gno unit tests independent (and parallel) #2376

@moul

Description

@moul

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    📥 Inbox

    Status

    Need lots of help

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions