Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shaikrasheed99/kotlin-springboot-testcontainers-example
Example of Testcontainers with Spring Boot in Kotlin.
https://github.com/shaikrasheed99/kotlin-springboot-testcontainers-example
spring-boot-testcontainers springboot testcontainers testcontainers-junit-5 testcontainers-junit-jupiter testcontainers-kotlin testcontainers-postgres
Last synced: about 2 months ago
JSON representation
Example of Testcontainers with Spring Boot in Kotlin.
- Host: GitHub
- URL: https://github.com/shaikrasheed99/kotlin-springboot-testcontainers-example
- Owner: shaikrasheed99
- License: mit
- Created: 2023-11-28T11:35:32.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-29T16:35:54.000Z (about 1 year ago)
- Last Synced: 2023-11-29T17:38:25.199Z (about 1 year ago)
- Topics: spring-boot-testcontainers, springboot, testcontainers, testcontainers-junit-5, testcontainers-junit-jupiter, testcontainers-kotlin, testcontainers-postgres
- Language: Kotlin
- Homepage:
- Size: 74.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Testcontainers with Spring Boot in Kotlin
In this example, I have created a simple Spring Boot project integrated with JPA to interact with a PostgreSQL database.
This project includes two sets of tests:
* **Unit Tests:**
* Uses a local machine's postgres database for testing.* **Integration Tests with Testcontainers:**
* Uses Testcontainers to run tests with a real PostgreSQL container.## Testcontainers
[Testcontainers](https://testcontainers.com/), a powerful Java library that simplifies and enhances the testing of your applications by providing
disposable containers for databases, web browsers, and more.Testcontainers allows you to write more realistic and reliable tests by running your dependencies, such as databases, in
isolated containers.* **Easily Manage Dependencies:**
* Run databases, queues, and other services as Docker containers for testing purposes.* **Realistic Testing:**
* Testcontainers allows you to test against real instances of your dependencies, ensuring a more accurate
representation of your production environment.* **Disposable Containers:**
* Containers are started before tests and stopped afterward, ensuring a clean and isolated environment for each
test.## Getting Started
1. Clone the Repository:
```bash
git clone https://github.com/shaikrasheed99/kotlin-springboot-testcontainers-example
```2. Move to the project directory:
```bash
cd kotlin-springboot-testcontainers-example
```3. Build the Project:
```bash
./gradlew clean build
```4. Run the Application:
```bash
./gradlew bootRun
```The application will start, and you can access it at `http://localhost:8080`.