java - Why does SpringJUnit4ClassRunner not work with surefire parallel=methods? -
why tests throw random exceptions when use surefire setting parallel=methods
?
that's because junit creates 1 runner instance per test class, used multiple threads when using parallel=methods
. springjunit4classrunner
creates 1 testcontextmanager
, stores test instance in instance field, isn't thread safe.
when use parallel=classes
should fine, because junit creates 1 runner dedicated testcontextmanager
per thread.
i have filed bug that: https://jira.spring.io/browse/spr-12421
Comments
Post a Comment