Tesults API Library

1.2.1 · active · verified Wed Apr 22

Tesults is a reporting service for test automation results, providing a centralized dashboard to visualize and manage test outcomes. The `tesults` npm package, currently stable at version 1.2.1, offers an API client for Node.js applications to upload test data. This version was published in 2017, and while the package itself has not seen recent updates, the Tesults service continually evolves. Its key differentiators include comprehensive test result management, support for aggregating results from various test frameworks and languages, release record keeping for auditable history, and features like release checklists that consolidate automated and manual test tasks. It aids in identifying flaky tests and managing associated bugs, fostering better release readiness.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates installing the Tesults package, configuring it with a token (preferably from environment variables), and uploading a sample set of test results using the callback-based API. It includes examples of passing and failing tests with descriptions and additional parameters.

import * as tesults from 'tesults';

const TESULTS_TOKEN = process.env.TESULTS_TOKEN ?? 'your_tesults_token'; // Replace or use environment variable

const data = {
    target: TESULTS_TOKEN,
    results: {
        cases: [
            {
                name: 'User Login Test',
                desc: 'Verify a user can log in with valid credentials.',
                suite: 'Authentication Suite',
                result: 'pass'
            },
            {
                name: 'Invalid Password Test',
                desc: 'Attempt login with an incorrect password and check error message.',
                suite: 'Authentication Suite',
                result: 'fail',
                reason: 'Expected error message "Invalid credentials", but got "User not found".'
            },
            {
                name: 'Data Persistence Check',
                desc: 'Ensure saved user data remains after logout and re-login.',
                suite: 'Data Integrity',
                result: 'pass',
                params: {
                    userType: 'admin',
                    region: 'US-East'
                },
                files: [] // Optionally attach log files or screenshots
            }
        ]
    }
};

tesults.results(data, function (err, response) {
    if (err) {
        console.error('Tesults library error:', err);
        return;
    }

    if (response.success) {
        console.log('Test results successfully uploaded to Tesults.');
    } else {
        console.error('Failed to upload results:', response.message);
        if (response.warnings && response.warnings.length > 0) {
            console.warn('Warnings:', response.warnings);
        }
        if (response.errors && response.errors.length > 0) {
            console.error('Errors:', response.errors);
        }
    }
});

view raw JSON →