2017-04-26 4 views
0

Als ich das Projekt erstellen (ob Maven von Terminal) Integrationstests laufen nicht. Dies ist das Protokoll:Frühling Boot-Integrationstests laufen nicht während Build

15:10:20.381 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.company.abc.restrictions.AddInterfaceTest] 
15:10:20.396 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate] 
15:10:20.412 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)] 
15:10:20.427 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [com.company.abc.restrictions.AddInterfaceTest] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper] 
15:10:20.669 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.company.abc.transactions.VisaCreditTest]: using defaults. 
15:10:20.684 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] 
15:10:20.684 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [or[email protected]557caf28, org.springframework.test[email protected]408d971b, org.springframework.boot.test.a[email protected]6c6cb480, org.springfra[email protected]3c46e67a, org.springframew[email protected]c730b35, org.sp[email protected]206a70ef, org.spri[email protected]292b08d6, org.springf[email protected]22555ebf, org.springframework[email protected]36ebc363, org.springframework.boot.test.autoconfi[email protected]45752059, org.springframework.boo[email protected]34e9fd99, org.springframework.boot.test.autoconfi[email protected]3c41ed1d] 
15:10:20.684 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Neither @ContextConfiguration nor @ContextHierarchy found for test class [com.company.abc.transactions.VisaDebitTest], using SpringBootContextLoader 
15:10:20.684 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.company.abc.transactions.VisaDebitTest]: class path resource [com/company/abc/transactions/VisaDebitTest-context.xml] does not exist 
15:10:20.684 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [com.company.abc.transactions.VisaDebitTest]: class path resource [com/company/abc/transactions/VisaDebitTestContext.groovy] does not exist 
15:10:20.684 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [com.company.abc.transactions.VisaDebitTest]: no resource found for suffixes {-context.xml, Context.groovy}. 
15:10:20.684 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.company.abc.transactions.VisaDebitTest] 
15:10:20.684 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.company.abc.transactions.VisaDebitTest]: using defaults. 
15:10:20.684 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener] 
15:10:20.700 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [or[email protected]6ad82709, org.springframework.test[email protected]510f3d34, org.springframework.boot.test.a[email protected]7817fd62, org.springfra[email protected]8297b3a, org.springframew[email protected]2362f559, org.sprin[email protected]9a9c, org.spri[email protected]4c178a76, org.springf[email protected]fa4c865, org.springframework[email protected]3bd82cf5, org.springframework.boot.test.autoconfi[email protected]544fa968, org.springframework.boo[email protected]247bddad, org.springframework.boot.test.autoconfi[email protected]d35dea7] 
15:10:20.700 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [com.company.abc.restrictions.AddInterfaceTest] 
15:10:20.700 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [com.company.abc.restrictions.AddInterfaceTest] 

Results : 

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 

dies ist die Haupttestklasse:

@RunWith(SpringRunner.class) 
@SpringBootTest(classes = MyServiceStarter.class, webEnvironment= SpringBootTest.WebEnvironment.DEFINED_PORT, 
     properties = {"flyway.locations=filesystem:../database/h2", "server.port=9100", "spring.profiles.default=dev"}) 
@Category(IntegrationTest.class) 
public abstract class AbstractModulIntegrationTest { ... } 

alle Infos geschätzt werden.

Antwort

0

Wenn Sie Feder-boot-parent pom sind usign, können Sie gehen hinein und diese Zeilen

   <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId> 
        <configuration> 
         <includes> 
          <include>**/*Tests.java</include> 
          <include>**/*Test.java</include> 
         </includes> 
         <excludes> 
          <exclude>**/Abstract*.java</exclude> 
         </excludes> 
        </configuration> 
       </plugin> 

Wie Sie sehen alles mit abstraktem ist ausgeschlossen sehen kann. Daher wird es nicht ausgeführt. Ändern Sie den Namen Ihrer Testklasse oder überschreiben Sie dieses Plugin und entfernen Sie diese Zeile

<exclude>**/Abstract*.java</exclude> 
+0

die Sache ist, dass auf meinem Kollegen Maschine funktioniert es gut. (Wir haben es gerade überprüft). Das ist wahrscheinlich nicht der Grund. Danke trotzdem. – IKo

+0

Haben Sie Inhalte in Ihrem AbstractModulIntegrationTest haben oder einfach nur Anmerkungen? Bitte fügen Sie dem Beitrag einen nicht abstrakten Test hinzu, zum Beispiel VisaCreditTest. Außerdem habe ich festgestellt, dass @Category (IntegrationTest.class) verwendet wurde. Hast du TestSuite? –

Verwandte Themen