This module provides a way to integrate trace-based testing into your existing Typescript or Javascript code. It allows you to create, run, and orchestrate Tracetest Tests.
To find a detailed step-by-step tutorial on how to use this module head out to the main integration page in our docs.
import Tracetest from '@tracetest/client';
const { TRACETEST_API_TOKEN = '' } = process.env;
const tracetest = await Tracetest(TRACETEST_API_TOKEN);
Follow the guide in the Tracetest documentation website to generate the
TRACETEST_API_TOKEN
const definition: TestResource = {
type: 'Test',
spec: {
id: 'my-test',
name: 'My Test',
skipTraceCollection: true,
trigger: {
type: 'http',
httpRequest: {
method: 'GET',
url: 'google.com',
},
},
}
}
const test = await tracetest.newTest(definition);
const run = await tracetest.runTest(test);
await run.wait();
// Optional: You can add this to the code to fail the execution based on the trace-based tests results
console.log(await tracetest.getSummary());
Successful: 1
Failed: 0
[✔️ My Test] #1 - https://app.tracetest.io/organizations/ttorg_ced62e34638d965e/environments/ttenv_b42fa137465c6e04/test/my-test/run/1
- For a detailed step-by-step tutorial on how to use this module: visit https://docs.tracetest.io/tools-and-integrations/typescript
- If you want to get in touch with the Tracetest team: visit https://dub.sh/tracetest-community