Integration tests are meant to test a functionality that requires multiple running services. We recommend you test most test cases using unit tests in the module. Use integration tests only when necessary.
Integration tests require running instances of all services. These services must be started by the user.
The integration test suite detects when services are started up and are ready to begin testing.
Perform a general quick start to execute tests within the pipeline.
Follow these steps:
-
Deploy and run all services.
-
Run the following shell script:
./gradlew runIntegrationTests -Dcredentials.user=<MAINFRAME_USERID> -Dcredentials.password=<PASSWORD>
-
(Optional) Change the host/port/scheme for the Gateway and Discovery Service with the following shell script:
./gradlew runIntegrationTests -Dcredentials.user=<MAINFRAME_USERID> -Dcredentials.password=<PASSWORD> -Ddiscovery.host=<DS_HOST> -Ddiscovery.port=<DS_PORT> -Dgateway.host=<GW_HOST> -Dgateway.port=<GW_PORT> -Dgateway.scheme=https
Perform a Localhost Quick start when you need to run the tests on your local machine.
Follow these steps:
-
Deploy and run all services.
-
Run the following shell script:
./gradlew runLocalIntegrationTests
-
(Optional) Run all local tests including all sample services with the following shell script:
./gradlew runAllLocalIntegrationTests
The Discovery Service in HTTP mode is not integrated within the pipeline. You can perfom tests of the Discovery Service in HTTP mode manually.
Follow these steps:
- Set the
spring.profiles
value in the Discovery Service configuration file tohttp
. - Change the
discoveryServiceUrls
value in the configuration file of the service that you want to register tohttp://eureka:password@localhost:10011/eureka/
. - Run Discovery Service and verify that you can login into the Discovery Service homepage by using basic authentication with Eureka credentials.
- Run your service and check that it is registered to Eureka.
Run special integration tests for tests that need to be performed slowly such as when you need to test timeouts.
Note: Executing these slow steps with other tests causes the entire test suite to take longer to execute.
Slow tests are annotated using @Category(SlowTests.class) as in the following example:
@Test
@Category(SlowTests.class)
@SuppressWarnings("squid:S1160")
public void shouldCallLongButBelowTimeoutRequest() throws IOException {
Start the suite of slow tests by executing the following shell script:
./gradlew :integration-tests:runAllIntegrationTests
./gradlew :integration-tests:runIntegrationTests --tests org.zowe.apiml.gatewayservice.PassTicketTest