From 96fd81bce9500cb090fbd7efcbe6857b693fcd60 Mon Sep 17 00:00:00 2001 From: Marcin Zajaczkowski Date: Wed, 25 Feb 2015 14:15:12 +0100 Subject: [PATCH] [#51] Make Tomcat port in integration test random Acceptance GUI tests with Geb is a separate thing #52. --- .../ofg/twitter/geb/AcceptanceSwaggerUISpec.groovy | 11 +---------- .../com/ofg/twitter/geb/BaseBootGebSpec.groovy | 14 ++++++++++++++ .../ofg/twitter/geb/HealthEndpointUISpec.groovy | 11 +---------- .../geb/MicroserviceControllerUISpec.groovy | 11 +---------- .../places/DependencyFromServiceSpec.groovy | 4 ++-- 5 files changed, 19 insertions(+), 32 deletions(-) create mode 100644 src/test/groovy/com/ofg/twitter/geb/BaseBootGebSpec.groovy diff --git a/src/test/groovy/com/ofg/twitter/geb/AcceptanceSwaggerUISpec.groovy b/src/test/groovy/com/ofg/twitter/geb/AcceptanceSwaggerUISpec.groovy index c43e94d..674db30 100644 --- a/src/test/groovy/com/ofg/twitter/geb/AcceptanceSwaggerUISpec.groovy +++ b/src/test/groovy/com/ofg/twitter/geb/AcceptanceSwaggerUISpec.groovy @@ -1,19 +1,10 @@ package com.ofg.twitter.geb import com.ofg.twitter.geb.pages.SwaggerUIHomePage -import com.ofg.twitter.Application -import geb.spock.GebSpec -import org.springframework.boot.test.IntegrationTest -import org.springframework.boot.test.SpringApplicationContextLoader -import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.web.WebAppConfiguration import spock.lang.Stepwise -@ContextConfiguration(loader = SpringApplicationContextLoader.class, classes = Application) -@WebAppConfiguration -@IntegrationTest("spring.profiles.active:dev,stubrunner.skip-local-repo:true") @Stepwise -class AcceptanceSwaggerUISpec extends GebSpec { +class AcceptanceSwaggerUISpec extends BaseBootGebSpec { def "SwaggerUI home page should be visible"() { when: diff --git a/src/test/groovy/com/ofg/twitter/geb/BaseBootGebSpec.groovy b/src/test/groovy/com/ofg/twitter/geb/BaseBootGebSpec.groovy new file mode 100644 index 0000000..fd6bd22 --- /dev/null +++ b/src/test/groovy/com/ofg/twitter/geb/BaseBootGebSpec.groovy @@ -0,0 +1,14 @@ +package com.ofg.twitter.geb + +import com.ofg.twitter.Application +import geb.spock.GebSpec +import org.springframework.boot.test.IntegrationTest +import org.springframework.boot.test.SpringApplicationContextLoader +import org.springframework.test.context.ContextConfiguration +import org.springframework.test.context.web.WebAppConfiguration + +@ContextConfiguration(loader = SpringApplicationContextLoader.class, classes = Application) +@WebAppConfiguration +@IntegrationTest("spring.profiles.active:dev") +abstract class BaseBootGebSpec extends GebSpec { +} diff --git a/src/test/groovy/com/ofg/twitter/geb/HealthEndpointUISpec.groovy b/src/test/groovy/com/ofg/twitter/geb/HealthEndpointUISpec.groovy index 3df4fd2..d8861cc 100644 --- a/src/test/groovy/com/ofg/twitter/geb/HealthEndpointUISpec.groovy +++ b/src/test/groovy/com/ofg/twitter/geb/HealthEndpointUISpec.groovy @@ -1,21 +1,12 @@ package com.ofg.twitter.geb import com.ofg.twitter.geb.pages.SwaggerUIHomePage -import com.ofg.twitter.Application -import geb.spock.GebSpec -import org.springframework.boot.test.IntegrationTest -import org.springframework.boot.test.SpringApplicationContextLoader -import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.web.WebAppConfiguration import spock.lang.Stepwise import spock.lang.Unroll -@ContextConfiguration(loader = SpringApplicationContextLoader.class, classes = Application) -@WebAppConfiguration -@IntegrationTest("spring.profiles.active:dev,stubrunner.skip-local-repo:true") @Stepwise @Unroll -class HealthEndpointUISpec extends GebSpec { +class HealthEndpointUISpec extends BaseBootGebSpec { def "Setup step"() { when: diff --git a/src/test/groovy/com/ofg/twitter/geb/MicroserviceControllerUISpec.groovy b/src/test/groovy/com/ofg/twitter/geb/MicroserviceControllerUISpec.groovy index bcd9cd4..46e0fd4 100644 --- a/src/test/groovy/com/ofg/twitter/geb/MicroserviceControllerUISpec.groovy +++ b/src/test/groovy/com/ofg/twitter/geb/MicroserviceControllerUISpec.groovy @@ -1,20 +1,11 @@ package com.ofg.twitter.geb -import com.ofg.twitter.Application import com.ofg.twitter.geb.pages.SwaggerUIHomePage -import geb.spock.GebSpec import groovy.json.JsonSlurper -import org.springframework.boot.test.IntegrationTest -import org.springframework.boot.test.SpringApplicationContextLoader -import org.springframework.test.context.ContextConfiguration -import org.springframework.test.context.web.WebAppConfiguration import spock.lang.Stepwise -@ContextConfiguration(loader = SpringApplicationContextLoader.class, classes = Application) -@WebAppConfiguration -@IntegrationTest("spring.profiles.active:dev,stubrunner.skip-local-repo:true") @Stepwise -class MicroserviceControllerUISpec extends GebSpec { +class MicroserviceControllerUISpec extends BaseBootGebSpec { def "Microservice controller is visible on Swagger Page"() { when: diff --git a/src/test/groovy/com/ofg/twitter/places/DependencyFromServiceSpec.groovy b/src/test/groovy/com/ofg/twitter/places/DependencyFromServiceSpec.groovy index 830bcbd..d982fd4 100644 --- a/src/test/groovy/com/ofg/twitter/places/DependencyFromServiceSpec.groovy +++ b/src/test/groovy/com/ofg/twitter/places/DependencyFromServiceSpec.groovy @@ -5,7 +5,7 @@ import com.ofg.twitter.place.extractor.ColleratorClient import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.IntegrationTest -@IntegrationTest("stubrunner.use-microservice-definitions:true") +@IntegrationTest(["stubrunner.use-microservice-definitions:true", "server.port=0", "management.port=0"]) class DependencyFromServiceSpec extends MicroserviceMvcWiremockSpec { @Autowired @@ -18,4 +18,4 @@ class DependencyFromServiceSpec extends MicroserviceMvcWiremockSpec { noExceptionThrown() } -} \ No newline at end of file +}