3 ms·
Having code which relies on global state is probably the worst possible case, that's why I mentioned you can STILL write independent tests from each other. You
by kissgyorgy 4y ago
Having code which relies on global state is probably the worst possible case, that's why I mentioned you can STILL write independent tests from each other. You could even run them in parallel, but you would have to use locks, but just by running them serially, you don't even need to do that. You just have to make sure that the global state has been reset after each test case properly.
If your project language is Python, pytest is providing all kinds of tools to setup and reset all kinds of global state (see the monkeypatch fixture).
In other languages this can be solvable obviously, you might just need to write more helpers and might be more careful.
If you don't write your tests independent from each other, you will have an awful time debugging any failure and will waste insane working hours which could be prevented by a little bit of discipline.