concept integration test in category microservice

This is an excerpt from Manning's book Bootstrapping Microservices with Docker, Kubernetes and Terraform.
Listing 8.8 shows a simple function that can be used for loading test data. We can call this function from our test code and you’ll see an example of that soon. We simply need to specify the name of the collection and the data records to load. Note how we are accessing the microservice’s database through the db field of our microservice object (which is saved in a variable as you can see in listing 8.6). This saves having to make multiple connections to the database. We don’t need to do that because the microservice has already made the connection and we can reuse it.
Listing 8.8 - A helper function to load a database fixture (extract from chapter-8/example-3/src/index.test.js)
// ... async function loadDatabaseFixture(collectionName, records) { #A await microservice.db.dropDatabase(); #B const collection = microservice.db.collection(collectionName); await collection.insertMany(records); #C } // ...
Now we can get setup to invoke our Cypress tests with npm just like we did with Jest. example-4 is of course a separate project to the other examples and we are using a different testing tool (Cypress instead of Jest). Nevertheless we’d like to be able to run Cypress with the conventional npm test script like this:

This is an excerpt from Manning's book Testing Java Microservices: Using Arquillian, Hoverfly, AssertJ, JUnit, Selenium, and Mockito.
A persistence layer is usually implemented using an ORM such as JPA, so in most cases, this layer just deals with the core class of the system. (In the case of JPA, this is EntityManager.) If you decide that writing unit tests for persistence objects isn’t going to pay off, then at least write integration tests for them. But if some logic is encompassed in mapping the response, then a solitary unit test and mocking the core class, such as EntityManager, should be sufficient to provide mapped objects.
Generally speaking, integration tests aren’t slow per se, but their speed depends on the logic and the interactions with modules in the subsystem under test that impact test performance. Because such subsystems usually require one or more container(s) in which to run (servlet container, CDI container, Spring container, and so forth), integration tests are slower than unit tests because they need to start and stop the container(s) they require.
Figure 5.1 illustrates what an integration test might look like. As you can see, a test involves calling at least one module (or class) and all the associated peers of that module. The purpose of such a test is to verify not the behavior of each module, but rather the communication between modules.
Moving on from this brief introduction to the concept of integration tests, let’s see how integration tests apply to the microservices architecture.
If you need to write integration tests for the SQL persistence layer, you must add an Arquillian Persistence Extension dependency:
dependencies { testCompile group: 'org.jboss.arquillian.extension', name: 'arquillian-persistence-dbunit', version: '1.0.0.Alpha7' }Finally, to write integration tests for NoSQL databases, you need to add a NoSQLUnit dependency. Because NoSQL databases are by definition heterogeneous, each NoSQLUnit-supported database has its own dependency. This is the dependency for MongoDB:
In this section, you’ll write integration tests for the Gamer application. Usually, unit tests are created in the de facto test directory, src/test/java. For integration tests, you can follow three different strategies: