mvn clean install: all tests pass

run all tests in IntelliJ: the same 6 tests fail every time

run those 6 tests in IntelliJ: they pass


  • 2
    Somehing doesn't cleans itself up in your tests.
  • 1
    This is probably what's happening:
    1. The order of tests isn't guaranteed, maven can run them in a different order than InteliJ

    2. Your tests aren't properly stateless and somehow interact in some order. Maybe leftover files or database items.

    2.1 it could also potentially be an environment problem. If you're using property files or environment variables make sure neither overrides then with something. The context is very different between InteliJ and mvn
  • 0
    Or race conditions.
  • 0
    @stop Thats my suspiscion. Its an integration test that interacts with a DB through testcontainers. Not the first time Ive seen odd behaviour with it.
Add Comment