Skip to main content

robotframework-testcontainers

Robot Framework keywords for testcontainers.

Keyword Documentation

Installation

  • using pip:
pip install robotframework-testcontainers
  • using uv:
uv add robotframework-testcontainers
  • using poetry:
poetry add robotframework-testcontainers

Usage

Starting a container can be done with a single keyword:

*** Settings ***
Library    TestcontainersLibrary

*** Test Cases ***
Basic Usage Example
    Create Docker Container    image=hello-world

TestcontainersLibrary keeps track of all created containers. It will take care of stopping all created containers at the end of the test, by making use of the end_test/end_suite listener methods.

If you require more control, you can also manually start and stop the container. Additionally, you can use different wait strategies to wait for the container to be ready:

*** Settings ***
Library    TestcontainersLibrary

*** Test Cases ***
Advanced Usage with more control
    ${container}=    Create Docker Container    image=traefik/whoami    start=False    ports=[80]
    Start Container    ${container}
    Wait For Http Endpoint    ${container}    port=80    path=/api
    Stop Container    ${container}

You can also use any of the community maintained containers. Be aware that you have to make sure to install the required dependencies yourself.
For example: starting a CockroachDB container requires installing testcontainers[cockroachdb]. Use the Create Community Container keyword and specify which class to import from which module. Any additional arguments can be passed in as keyword arguments.

*** Settings ***
Library             TestcontainersLibrary


*** Test Cases ***
Starting an CockroachDb Container
    ${password}=    Evaluate    str(uuid.uuid4())
    ${container}=    Create Community Container
    ...    module=testcontainers.cockroachdb
    ...    container_class=CockroachDBContainer
    ...    username=demoUser
    ...    password=${password}
    Log    ${container.get_connection_url()}

You can read the acceptance tests in test/acceptance/ for more concrete usage examples.

License

This project is licensed under the MIT License.

Third-Party Licenses

This library depends on the testcontainers-python package, which is licensed under the Apache License 2.0.

No parts of testcontainers-python are copied or modified in this project. It is used only as a dependency.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework_testcontainers-0.2.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotframework_testcontainers-0.2.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_testcontainers-0.2.1.tar.gz.

File metadata

File hashes

Hashes for robotframework_testcontainers-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8bf6ba333b343e63ca076effcd3d8c855f81b733570932eb922e087203565a76
MD5 78983e235c9b1581fd78b643f60d8128
BLAKE2b-256 4834eede6adbbd6a2d703e4777819e4b6842c0fc463474beb4483225d6383d48

See more details on using hashes here.

Provenance

The following attestation bundles were made for robotframework_testcontainers-0.2.1.tar.gz:

Publisher: publish.yml on DudeNr33/robotframework-testcontainers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file robotframework_testcontainers-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_testcontainers-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36f03010e1433109334e28257cd59fd7d5eba8aa9f1ea7650016cf963cf04d82
MD5 9294e23d22983e9987cb0a1b45be2895
BLAKE2b-256 32b1c48ff8cb7183f96a237bf8e8a7face324a57f696aee69c94f766a9a42d53

See more details on using hashes here.

Provenance

The following attestation bundles were made for robotframework_testcontainers-0.2.1-py3-none-any.whl:

Publisher: publish.yml on DudeNr33/robotframework-testcontainers

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page