Skip to content

Commit 5feff51

Browse files
authored
Update README.adoc (#6)
1 parent c442c9f commit 5feff51

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Diff for: README.adoc

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Sometimes tests might pass in development and testing (dev/test) environments, b
3838

3939
=== What is Testcontainers?
4040

41-
Testcontainers is an open source library that wraps Docker in a Java API. It's often used in testing applications that involve external resource dependencies such as databases, message queues, or web services. Testcontainers supports any Docker image, which allows for uniform and portable testing environments. By encapsulating dependencies in containers, it ensures test consistency and simplifies the setup process.
41+
Testcontainers is an open source library that wraps Docker in a Java API. It is often used in testing applications that involve external resource dependencies such as databases, message queues, or web services. Testcontainers supports any Docker image, which allows for uniform and portable testing environments. By encapsulating dependencies in containers, it ensures test consistency and simplifies the setup process.
4242

4343
The microservice that you'll be working with is called `inventory`. The `inventory` microservice persists data into a PostgreSQL database and supports create, retrieve, update, and delete (CRUD) operations on the database records. You will write integration tests for the application by using Testcontainers to run it in Docker containers.
4444

@@ -64,7 +64,7 @@ include::{common-includes}/gitclone.adoc[]
6464
// =================================================================================================
6565
=== Try what you'll build
6666

67-
This guide use Docker to run an instance of the PostgreSQL database for a fast installation and setup. A Dockerfile file is provided for you. Navigate to the `postgres` directory and run the following commands to use the Dockerfile to build the image:
67+
This guide uses Docker to run an instance of the PostgreSQL database for a fast installation and setup. A Dockerfile file is provided for you. Navigate to the `postgres` directory and run the following commands to use the Dockerfile to build the image:
6868

6969
[role='command']
7070
```
@@ -74,7 +74,7 @@ docker build -t postgres-sample .
7474

7575
The `finish` directory in the root of this guide contains the finished application. Give it a try before you proceed.
7676

77-
To try out the test, first go to the `finish` directory and run the `mvn package` command so that the `.war` file resides in the `target` directory and the `.jar` PostgreSQL JDBC driver file resides in the `target/liberty/wlp/usr/shared/resources` directory:
77+
To try out the test, first go to the `finish` directory and run the `mvn package` command so that the `.war` file resides in the `target` directory, and the `.jar` PostgreSQL JDBC driver file resides in the `target/liberty/wlp/usr/shared/resources` directory:
7878

7979
[role='command']
8080
```
@@ -89,7 +89,7 @@ Build the `inventory` Docker image with the following command:
8989
docker build -t inventory:1.0-SNAPSHOT .
9090
```
9191

92-
Now, run the Maven `verify` goal which compiles the java files, starts the containers, runs the tests, and then stops the containers.
92+
Now, run the Maven `verify` goal, which compiles the Java files, starts the containers, runs the tests, and then stops the containers.
9393

9494
[role='command']
9595
```
@@ -170,7 +170,7 @@ Point your browser to the http://localhost:9080/openapi/ui URL to try out the `i
170170

171171
=== Building test REST client
172172

173-
Test REST client is responsible for sending HTTP requests to an application and handling the responses. It enables accurate verification of the application's behavior by ensuring it responds correctly to various scenarios and conditions.
173+
Test REST client is responsible for sending HTTP requests to an application and handling the responses. It enables accurate verification of the application's behavior by ensuring that it responds correctly to various scenarios and conditions.
174174

175175
Begin by creating a test REST client interface for the `inventory` microservice.
176176

@@ -257,7 +257,7 @@ Next, you will learn how to use Testcontainers to verify your microservices in t
257257

258258
=== Building Testcontainer for Open Liberty
259259

260-
Start by defining a custom `LibertyContainer` class which provides a framework to start and access a containerized version of the Open Liberty application for testing.
260+
Start by defining a custom `LibertyContainer` class, which provides a framework to start and access a containerized version of the Open Liberty application for testing.
261261

262262
[role="code_command hotspot file=0" ,subs="quotes"]
263263
----
@@ -329,7 +329,7 @@ The [hotspot=waitingFor file=0]`waitingFor()` method overrides the [hotspot=wait
329329

330330
The [hotspot=getLogger file=0]`LoggerFactory.getLogger()` and [hotspot=withLogConsumer1 hotspot=withLogConsumer2 file=0]`withLogConsumer(new Slf4jLogConsumer(Logger))` methods integrate container logs with the test logs by piping the container output to the specified logger.
331331

332-
The updated [hotspot=setup file=0]`setup()` method prepares the test environment. It checks if the tests are running in dev mode or local runtime, or via Testcontainers, using the [hotspot=isServiceRunning file=0]`isServiceRunning()` helper. If it's in dev mode or local runtime, it ensures the Postgres database is running locally. In the case of no running runtime, the test starts the [hotspot=postgresContainerStart file=0]`postgresContainer` and [hotspot=inventoryContainerStart file=0]`inventoryContainer` test containers.
332+
The updated [hotspot=setup file=0]`setup()` method prepares the test environment. It checks whether the tests are running in dev mode or local runtime, or via Testcontainers, by using the [hotspot=isServiceRunning file=0]`isServiceRunning()` helper. If it's in dev mode or local runtime, it ensures that the Postgres database is running locally. In the case of no running runtime, the test starts the [hotspot=postgresContainerStart file=0]`postgresContainer` and [hotspot=inventoryContainerStart file=0]`inventoryContainer` test containers.
333333

334334
After tests, the [hotspot=tearDown file=0]`tearDown()` method stops the containers and closes the network.
335335

@@ -380,7 +380,7 @@ Notice that the `Testing by dev mode or local runtime` log indicates that the te
380380
// =================================================================================================
381381
== Testing outside of development mode
382382

383-
Running tests in development mode is useful for local development, but there may be times when you want to test your application in other scenarios, such as in a CI/CD pipeline. For these cases, you can use Testcontainers to run tests against a running Open Liberty server in a controlled, self-contained environment, ensuring your tests run consistently regardless of the deployment context.
383+
Running tests in development mode is useful for local development, but there may be times when you want to test your application in other scenarios, such as in a CI/CD pipeline. For these cases, you can use Testcontainers to run tests against a running Open Liberty server in a controlled, self-contained environment, ensuring that your tests run consistently regardless of the deployment context.
384384

385385
To test outside of development mode, exit dev mode by pressing `CTRL+C` in the command-line session where you ran the server, or by typing `q` and then pressing the `enter/return` key.
386386

0 commit comments

Comments
 (0)