mirror of
https://github.com/docker/docs.git
synced 2026-03-27 14:28:47 +07:00
## Description Migrate the first two Testcontainers getting-started guides from [testcontainers.com/guides](https://testcontainers.com/guides/) into the Docker docs site: - **Getting started with Testcontainers for Go** — multi-page guide with 4 chapters (create project, write tests, test suites, run tests). Code updated to testcontainers-go v0.41.0 API (`postgres.Run()`, `CleanupContainer`, `BasicWaitStrategies()`). - **Getting started with Testcontainers for Python** — multi-page guide with 3 chapters (create project, write tests, run tests). Code updated to testcontainers-python 4.14.2 (fixed `get_exposed_port()` returning `int`). Each guide appears as its own entry in the `/guides/` listing with proper language and tag filters (`testing-with-docker`). Chapters render with stepper navigation in the sidebar. Also adds: - A `testing-with-docker` tag to `data/tags.yaml` - A Claude skill (`.claude/skills/testcontainers-guides-migrator/SKILL.md`) that documents the repeatable migration process for the remaining 19 guides - Links from `content/manuals/testcontainers.md` to the new guides - Vale vocabulary entries for `pgx`, `Micronaut`, `psycopg`, `pytest` All guide code was compiled and tests verified passing in containers with Docker socket mounted. ## Related issues or tickets No related issues found. ## Reviews - [ ] Technical review - [ ] Editorial review - [ ] Product review
52 lines
1.9 KiB
Markdown
52 lines
1.9 KiB
Markdown
---
|
|
title: Run tests and next steps
|
|
linkTitle: Run tests
|
|
description: Run your Testcontainers-based integration tests and explore next steps.
|
|
weight: 30
|
|
---
|
|
|
|
## Run the tests
|
|
|
|
Run the tests using pytest:
|
|
|
|
```console
|
|
$ pytest -v
|
|
```
|
|
|
|
You should see output similar to:
|
|
|
|
```text
|
|
============================= test session starts ==============================
|
|
platform linux -- Python 3.13.x, pytest-9.x.x
|
|
collected 2 items
|
|
|
|
tests/test_customers.py::test_get_all_customers PASSED [ 50%]
|
|
tests/test_customers.py::test_get_customer_by_email PASSED [100%]
|
|
|
|
============================== 2 passed in 1.90s ===============================
|
|
```
|
|
|
|
The tests run against a real PostgreSQL database instead of mocks, which gives
|
|
more confidence in the implementation.
|
|
|
|
## Summary
|
|
|
|
The Testcontainers for Python library helps you write integration tests using the
|
|
same type of database (Postgres) that you use in production, instead of mocks.
|
|
Because you aren't using mocks and instead talk to real services, you're free
|
|
to refactor code and still verify that the application works as expected.
|
|
|
|
In addition to PostgreSQL, Testcontainers for Python provides modules for many
|
|
SQL databases, NoSQL databases, messaging queues, and more. You can use
|
|
Testcontainers to run any containerized dependency for your tests.
|
|
|
|
To learn more about Testcontainers, visit the
|
|
[Testcontainers overview](https://testcontainers.com/getting-started/).
|
|
|
|
## Further reading
|
|
|
|
- [testcontainers-python documentation](https://testcontainers-python.readthedocs.io/)
|
|
- [Getting started with Testcontainers for Go](/guides/testcontainers-go-getting-started/)
|
|
- [Getting started with Testcontainers for Java](https://testcontainers.com/guides/getting-started-with-testcontainers-for-java/)
|
|
- [Getting started with Testcontainers for Node.js](https://testcontainers.com/guides/getting-started-with-testcontainers-for-nodejs/)
|