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

tr-tooling

v0.1.8

Published

This project consists of two components which might help to ease the usage of the TestRail (API)

Downloads

20

Readme

TestRail tools

Motivation

This project consists of two components which might help to ease the usage of the TestRail (API)

  • API Wrapper: high level access to the REST API of TestRail
  • tr-report: a command line to to upload test results

Installation

Depending on your needs you might want to install this package in two ways:

  • globally: you want to use the tr-report command line tool
  • locally: you want to create a custom tool on your own and need a high level API for accessing TestRail

API wrapper

The native API of TestRail is a HTTP based REST-like API. There exists a wrapper package on npm which eliminates the need to directly access the API using a HTTP client. This wrapper still requires tracking of object IDs, though.

Therefore a higher level API had been created on top of the HTTP wrapper to further simplify the usage of the TestRail API for node.js:

TestRail.Project.findByName('Sandbox').then((project) => {
    return project.getTestSuites();
}).then((suites) => {
    return suites[0].getTestCases();
}).then((testCases) => {
    _.each(testCases, (testCase) => { 
       console.log(testCase.getId(), '=>', testCase.getTitle()); 
    });
}).catch((err) => {
    console.log('Nope', err);
});

There is no detailed documentation to the API wrapper available so far. In case you want to implement custom tools using the wrapper please refer to the examples folder or the tr-report tool in the bin directory

Command line tool - tr-report

The package comes with a command line tool named tr-report which can be used to upload test results based on a (mocha json report alike) input file.

$ tr-report --help    
  tr-report <command> [options]
  
  Commands:
    run  Create a new test run, attach all test results where a test case can be
         found and close it
  
  Options:
    --help  Show help                                                    [boolean]
  
  Not enough non-option arguments: got 0, need at least 1
$ tr-report run --help
  tr-report run
  
  Options:
    --help          Show help                                            [boolean]
    --host, -h      TestRail host URL                                   [required]
    --user, -u      TestRail user name                                  [required]
    --password, -p  TestRail password                                   [required]
    --project, -n   TestRail project name                               [required]
    --suite, -s     TestRail suite name                                 [required]
    --plan, -l      TestRail plan name
    --run, -r       TestRail run name
    --config, -c    TestRail config name
    --mocha, -m     Mocha test report file name                         [required]

This tool relies on the availability of TestRail test case IDs given in the test result description.

describe('A toaster', function() {
    it('should provide a timer (tr-39)', function() { // TestRail Case ID 39 w/o prefix 'C'
        assert(true);
    });

    it('should emergency stop after 5 minutes (tr-C48)', function() { // TestRail Case ID 48 w/ prefix 'C'
        assert(true);
    });

    it('should not consume power when off (tr-50) (trcfg-My Config)', function() { // TestRail Config Name 'My Config'
        assert(false);
    });
});

Above mocha test will lead to a test report which has TestRail tags (tr-[09]+) attached to the result which are used to refer to the correct test case elements in TestRail.