How to force a fresh version of the Spring context BEFORE the test executes

前端 未结 3 1353
有刺的猬
有刺的猬 2021-02-18 15:54

I use the SpringJUnit4ClassRunner for writing integration tests. I also use @DirtiesContext for tests that leave the context in an broken state behind

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-18 16:38

    There are several options:

    1. You can create an individual spring context for this test by loading another configuration into it. That way, your test will be completely independent of every other test.
    2. You can create a stripped down configuration for this test. That would achieve the same but be faster.
    3. Create a test suite which runs this test first.

提交回复
热议问题