Skip to main content

Robot Framework keywords for Testcontainers.

Project description

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.

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.2.0.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.

File details

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

File metadata

File hashes

Hashes for robotframework_testcontainers-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e027291bd61ca7dea5f9ca77546f0b47c0e1f907d6497020df915d1a6e081573
MD5 95cedb85751655666092d65f0d6cdd53
BLAKE2b-256 c5dec68f76eb561471895ed45f00c1098c9b963dc4b1c1cc577709d925e6eeec

See more details on using hashes here.

Provenance

The following attestation bundles were made for robotframework_testcontainers-0.2.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_testcontainers-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fdedaedbab40754c64aa03bde54192f7aaa2fe23168abddf9e75a96b6963e33
MD5 53fc31b8297827300bfe1ab317a8944b
BLAKE2b-256 1e77472e90b726854cb9811c502e32832724e79c95fb48530227fc638b06fcde

See more details on using hashes here.

Provenance

The following attestation bundles were made for robotframework_testcontainers-0.2.0-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 Pingdom Monitoring Sentry Error logging StatusPage Status page