GCP Datastore : Integration Testing using Spring Boot
In this article, I'll show you how you can create an in-memory datastore used by your tests. Configuring a Datastore Profile Testing Spring 3.1 introduced the bean definition profiles which can help us implementing an appropriate configuration for testing datastore staff. So, we'll have a specific profile for the GCP Datastore environment. Basically, the GCPDatastoreTester() class helps us saving data to the local in-memory datastore. Custom Annotation In order to support the population of test data for each test case, we will create an annotation in which you can add the JSON file name as argument. In the test execution listener, we'll check for the existence of the annotation and load the data accordingly. We'll use the annotation as follow : Implementing Custom TestExecutionListener The TestExecutionListener interface in the spring-test module defines a listener API for intercepting the events of the test case execution. Process : ...