Skip to main content

Robot Framework keywords for Testcontainers.

Project description

robotframework-testcontainers

Robot Framework keywords for testcontainers.

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.

Project details


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.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

File details

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

File metadata

File hashes

Hashes for robotframework_testcontainers-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bde83b187fcf0cc6caea2b66850bbfc2a119d6503a833a207f48412cb7e37ac3
MD5 b051c07c2e33549b28e290a990968c86
BLAKE2b-256 6354a17a334363777da3fbd13b95dea2af89fdbd6c20af125f55811a6ff26d9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for robotframework_testcontainers-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 662735ff09e65707c6e7c8c2363bfb0f8260c4dfee25ab9acfa71243eb4b9c04
MD5 c9d842b9282d2ee06923afa3070e7d73
BLAKE2b-256 91095e01f5591cbaafa559341448c9a7347ba74eb8de74d2b27ec5c38d56d1f5

See more details on using hashes here.

Supported by

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