0.2.1 • Published 9 months ago

@tracetest/client v0.2.1

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

@tracetest/client

NPM Published Version

About

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.

Usage

Import and Create the Tracetest Instance

import Tracetest from '@tracetest/client';
const { TRACETEST_API_TOKEN = '' } = process.env;

const tracetestClient = await Tracetest({ apiToken: TRACETEST_API_TOKEN });

Follow the guide in the Tracetest documentation website to generate the TRACETEST_API_TOKEN

Create your Test

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 tracetestClient.newTest(definition);

Run your Test

const run = await tracetestClient.runTest(test);
await tracetestClient.wait();

Log the Trace-Based Tests Summary

// Optional: You can add this to the code to fail the execution based on the trace-based tests results
console.log(await tracetestClient.getSummary());

Output

Successful: 1
Failed: 0

[✔️ My Test] #1 - https://app.tracetest.io/organizations/ttorg_ced62e34638d965e/environments/ttenv_b42fa137465c6e04/test/my-test/run/1

Useful Links

0.2.1

9 months ago

0.2.0

10 months ago

0.0.40

1 year ago

0.0.41

1 year ago

0.1.32

11 months ago

0.1.33

11 months ago

0.1.0

12 months ago

0.0.38

1 year ago

0.0.39

1 year ago

0.0.37

1 year ago

0.0.35

1 year ago

0.0.36

1 year ago

0.0.34

1 year ago

0.0.33

1 year ago

0.0.31

1 year ago

0.0.32

1 year ago

0.0.30

1 year ago

0.0.28

1 year ago

0.0.29

1 year ago

0.0.27

1 year ago