-1

All existing tests are annotated with

@RunWith(SpringRunner.class)
@SpringBootTest
@ActiveProfiles({"test"})

I have added

spring-cloud-contract-wiremock

to my project and created a test with the following annotations:

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@AutoConfigureWireMock(port = 10000, stubs = {"classpath:stubs/mappings"})
@ActiveProfiles({"test"})

When I run all the tests together, then all the tests followed after that WireMock test are starting to fail.

Issues are like:

Caught exception while invoking 'beforeTestMethod' callback on TestExecutionListener [org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@42f3156d] for test method [public void com.example.MyClass.foo1()] and test instance [com.example.MyClassTest@5e3569e8]
org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of class path resource...

These failing methods are annotated with:

@Test
@SqlGroup
user3475366
  • 113
  • 1
  • 11

1 Answers1

0

I found the solution. I have

ddl-auto: create-drop 

in my config, but it should be

ddl-auto: create-only
Dada
  • 6,313
  • 7
  • 24
  • 43
user3475366
  • 113
  • 1
  • 11