testcontainers / testcontainers-c

Testcontainers for C and, soon, C++, built on the top of Testcontainers for Go. Includes a WireMock module for test/demo purposes

Home Page:https://oleg-nenashev.github.io/oleg-nenashev/testcontainers-c/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Testcontainers for C/C++ and other native languages

Testcontainers for C/C++ Logo

Slack: testcontainers-c 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-c channel on the Testcontainers Slack.

Key Features

  • 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 C, C++, Swift and other native projects.
  • C-style header file for the library. A fancy C++ wrapper is coming soon
  • 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 C module, Then, you know the drill. Feel free to contribute examples or SDKs for the languages!

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:

Read More

About

Testcontainers for C and, soon, C++, built on the top of Testcontainers for Go. Includes a WireMock module for test/demo purposes

https://oleg-nenashev.github.io/oleg-nenashev/testcontainers-c/

License:MIT License


Languages

Language:Go 48.2%Language:C 28.1%Language:CMake 22.2%Language:Dockerfile 1.6%