FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [View Raw Code]   [Original HTTPS Page]

testcontainers-java/docs/test_framework_integration/spock.md at master · yorlov/testcontainers-java · GitHub

Latest commit

 

History

History
35 lines (24 loc) · 1.29 KB

File metadata and controls

35 lines (24 loc) · 1.29 KB

Spock

Spock extension for Testcontainers library, which allows to use Docker containers inside of Spock tests.

Usage

@Testcontainers class-annotation

Specifying the @Testcontainers annotation will instruct Spock to start and stop all testcontainers accordingly. This annotation can be mixed with Spock's @Shared annotation to indicate, that containers shouldn't be restarted between tests.

PostgresContainerIT inside_block:PostgresContainerIT

Adding Testcontainers Spock support to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

testImplementation "org.testcontainers:spock:{{latest_version}}"
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>spock</artifactId>
    <version>{{latest_version}}</version>
    <scope>test</scope>
</dependency>

Attributions

The initial version of this project was heavily inspired by the excellent JUnit5 docker extension by FaustXVI.


Back | FazBrowse Home | New Git URL