0.2.1 • Published 1 year ago

@tracetest/client v0.2.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year 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

1 year ago

0.2.0

1 year ago

0.0.40

2 years ago

0.0.41

2 years ago

0.1.32

1 year ago

0.1.33

1 year ago

0.1.0

1 year ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.37

2 years ago

0.0.35

2 years ago

0.0.36

2 years ago

0.0.34

2 years ago

0.0.33

2 years ago

0.0.31

2 years ago

0.0.32

2 years ago

0.0.30

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.0.27

2 years ago