npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ares-helper

v1.0.3

Published

Simplifies communication from Node.js to the API for the www.testastra.com/ares dashboard

Downloads

2

Readme

ares-helper

Simplifies communication from Node.js to the API for the www.testastra.com/ares dashboard

What is ARES? (www.testastra.com/ares)

ARES (TOOL AGNOSTIC TEST AUTOMATION DASHBOARD) is a Dashboard for test reports. It is a nice Dashboard with a REST-api.

The REST api has its downsides - non-consequent naming of properties (camelcase and underscore) mixed, and many properties that are mandatory to send even if they often are empty/unnecessary.

That's the reason for this module - it's simplifies communication with ARES from Node.js.

Basic principles of communication

In order to report your test to ARES you must first create an account at https://www.testastra.com/ares.

You then tell ARES to start a test run, start a module within that test run, report test results within that module, end reports within that module and end the test run.

(If you want to can set up your system to run several modules in parallell.)

Installation

Install this module:

npm install ares-helper

and then use it in your scripts:

const ares = require('ares-helper');

Create a json file with your ARES account and project details

You could call the json file ares-config.json and put it at root level in your Node.js project. The structure of the file should look like this

{
  "userToken": "user token copied from the ARES website",
  "workspaceName": "workspace name copied from the ARES website",
  "projectKey": "project key copied from the ARES website",
  "projectName": "project name copied from the ARES website"
}

API/methods

ares.setProjectInfo(path to json)

ares.setProjectInfo('ares-config.json');

Sets the basic project info by pointing to a JSON file.

(Alternatively you can send the json data directly to the method.)

ares.startTests();

Start a test run:

await ares.startTests();

ares.startModule({...})

Start a module within the test run:

await ares.startModule({
  moduleName: 'A name of your own choice',
  totalTests: 3 // Total number of tests in the module
})

ares.testResult({...})

Save a test result for a test within a module:

await ares.testResult({
  moduleName: 'A name of a module you have started',
  title: 'The name of the test',
  passed: false, // true = passed or false = failed
  errorMessage: 'Provide an errormessge if failed'
});

More options

Please note: You can provide much more info if you want. Additional properties you can use are: testData, failStacktrace, testBrowser, testMachine, testDevice, testOs, testSuite, imageLink, videoLink, runBy, errorMessage, executionMode and failType.

ares.endModule({...})

When you have reported all test results within a module:

await ares.endModule({
  moduleName: 'The name of the module you want to end'
});

ares.endTests()

When the whole test run is done:

await ares.endTests()

Debugging

If you want to debug what happens in the communication between your application and the ARES server:

ares.debug = true;

This will output a verbose log to the console.

Example code

This is some example code to quickly test that communication works. (However normally, in a real-life scenario, you would spread your calls to ares throughout different test steps and files...)

const ares = require('ares-helper');

async function tryItOut(){

  ares.debug = true;

  ares.setProjectInfo('ares-config.json');

  await ares.startTests();

  await ares.startModule({
    moduleName: 'Dummy module 1',
    totalTests: 3
  });

  await ares.testResult({
    moduleName: 'Dummy module 1',
    title: 'Test 1',
    passed: true
  });

  await ares.testResult({
    moduleName: 'Dummy module 1',
    title: 'Test 2',
    passed: false,
    errorMessage: 'Could not compute!'
  });

  await ares.testResult({
    moduleName: 'Dummy module 1',
    title: 'Test 3',
    passed: true
  });

  await ares.endModule({
    moduleName: 'Dummy module 1',
  });

  await ares.endTests();

}

tryItOut();