#Equivalent to @Setup/@BeforeAll in rust

5 messages · Page 1 of 1 (latest)

astral gazelle
#

I'm trying to call a function before any tests are ran, I'm currently calling a setup function in every test, that uses a once cell to ensure it only runs setup once, but this doesnt feel particularly great, is there a better way?

unborn jungle
#

Tests ideally shouldn't depend on any state outside themselves and thus shouldn't need setup code.

#

But if you have to anyway, then a OnceCell is a perfectly good answer.

astral gazelle