Skip to content

Latest commit

 

History

History
123 lines (90 loc) · 5.72 KB

README.md

File metadata and controls

123 lines (90 loc) · 5.72 KB

Testcontainers for C/C++/Swift and other native languages

Testcontainers Native Logo

Slack: testcontainers-native on slack.testcontainers.org Stability: Experimental GitHub release (latest by date)

!!! warning This is a prototype. There is a lot to do before it can be distributed and used in production, see the GitHub Issues and the project roadmap

This is not a standalone Testcontainers engine, but a C-style shared library adapter for native languages like C/C++, D, Lua, Swift, etc. It is an MVP SDK that can be later extended for the languages. The project is based on Testcontainers for Go which is one of the most powerful Testcontainers implementations.

Contributions and feedback are welcome! Also join the #testcontainers-native channel on the Testcontainers Slack.

Key Features

  • Testcontainers for C/C++ - a shared library and C-style headers that can be used in native projects
  • Support for C, C++, Swift and other native projects.
  • Minimum viable Testcontainers API functionality: starting and terminating containers, passing files, exposing ports, accessing container logs, etc.
  • Minimum HTTP client wrapper to simplify requests and assertions
  • Testcontainers for Go under the hood, with all its reporting and resource management capabilities. Memory might leak a lot in the current versions, but we do not want containers to leak :)
  • Support for Testcontainers Modules

This is what a very simple run without a test framework may look like.

Sample Output

Quick Start

Follow the Getting Started Guide.

Installing the library

It is advised to include CMake as a dependent module for now. If you like living dangerously until proper vcpkg and Conan packages are ready, you can optionally install the library to your system:

# NOT RECOMMENDED
cmake --install ..

Documentation

Using in C/C++/Swift projects

See the examples and demos for more examples.

Using in other languages

TL;DR: You get the C header file, a shared library object or a DLL file from the Testcontainers for C module. Then, you can bind this native library in your project type. It allows supporting many other languages that support using native tooling via dynamically or statically linked libraries:

Languages that can leverage Testcontainers for C

Disclaimer: The schema above shows the most popular languages for Embedded systems, based on the IEEE Spectrum 2021 Report and the JetBrains 2021 Developer Ecosystem Survey for Embedded Software. More native languages exist and can be supported by Testcontainers Native.

Feel free to contribute examples or SDKs for the languages! See the Swift Solution Page for examples. Testcontainers Native Architecture describes how it can be done in principle.

Credits

Using a complex Golang framework from C/C++ is not trivial. Neither the CMake files are. This project would not succeed without many quality articles and help from the community.

Kudos to:

Discuss

For any questions and feedback, join the #testcontainers-native channel on the Testcontainers Slack.

Support the Project

The best support is investing some time in the project. All contributions are welcome, checkout the Contributor Guide. Of course, GitHub Sponsorships will be appreciated too.

Read More