If You Cannot Use the SDK#

Antithesis provides a variety of language-native SDKs, which are recommended for integrating with Antithesis. However, you might be unable to use any of these libraries, either for policy reasons or because one has not yet been implemented in your language of choice. In this case, Antithesis enables you to access nearly all SDK functionality by logging low-level JSON messages to a special location.

As part of the Antithesis environment, Antithesis modifies your software’s container environment by injecting the variable ANTITHESIS_OUTPUT_DIR, which points to a directory. Antithesis watches this directory and captures any output written to it. This directory contains in particular the special file location $ANTITHESIS_OUTPUT_DIR/sdk.json, or the SDK capture file. Antithesis interprets the SDK capture file as a source of SDK messages.

When JSON messages are written to this file, Antithesis will ingest these messages and use SDK functionality as if SDK functions had been invoked inline. Each message should be written atomically as a single line of JSON terminating with a newline character.

Important

JSON examples in this section are formatted into multiple lines for readability. However, the Antithesis environment is different: SDK messages are line-delimited and each individual message must be contained within a single line.

SDK functionality: fallback options#

Antithesis SDKs provide three types of functionality:

  • Assertions, which define test properties through writing assertions inline in your code. If you cannot use our SDKs, you can still use our assertions framework by emitting JSON documents to the SDK capture file in a format for SDK assertion messages.

    These assertions will be recognized by our platform, which will evaluate the assertions and record the results in our reports.

  • Lifecycle, which indicates that certain milestones in program setup and execution have been reached. If you cannot use our SDK, you can still indicate these milestones by emitting JSON documents to the SDK capture file in a format for SDK lifecycle messages.

  • Randomness, which requests structured and unstructured randomness from the Antithesis platform. If you cannot use our SDK, you may read from the system random devices. You should not use your language’s PRNG.

    The SDKs are preferable—these indicate to Antithesis the purpose of your randomness, which enables more intelligent exploration of code.