Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ssense/cucumber-testrail-sync

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ssense/cucumber-testrail-sync

Synchronize test cases from TestRail

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
20
increased by100%
Maintainers
2
Weekly downloads
 
Created
Source

cucumber-testrail-sync

This module has two main features:

It can synchronize test cases from TestRail to .feature files on your local filesystem.

It can automatically push test results to TestRail.

Installation

npm i cucumber-testrail-sync [-g]

Usage: synchronize test cases from TestRail

We propose the following collaborative workflow for BDD testing:

Synchronize test cases!


At the root of your project, create the .testrail-sync.js file.

module.exports = {
  testrail: {
    host: '', // testrail host
    user: '', // testrail username
    password: '', // testrail password or api key
    filters: {
      plan_id: '', // testrail plan id
    }
  },
};

There are other possible options:

  • overwrite: Toggle the local .feature file overwrite OR remote test case overwrite if the local Gherkins doesn't match the Gherkins from TestRail.
overwrite: {
  local: 'ask',
  remote: false,
}
  • stepDefinitionsTemplate: The template to use to generate blank step definition files (ie. stepDefinitionsTemplate: 'es5.js')

  • indent: The indentation to use when generating .feature or .js files (ie. indent: ' ')

  • featuresDir: The directory where .feature files should be created (ie. featuresDir: 'features')

  • stepDefinitionsDir: The directory where blank step definition files should be created (ie. stepDefinitionsDir: 'features/step_definitions')

  • directoryStructure: Used to match the TestRail sections tree with the local tests directory structure.

    • type: The variable name to used to create the folders. Can be either section:slug or section:name

    • skipRootFolder: The number of root sections to skip.

Then you can run the cucumber-testrail-sync command (or ./node_modules/.bin/cucumber-testrail-sync if it's not installed globally) to fetch the test cases from TestRail.

Usage: pushing test results to TestRail

You will first need to create the .testrail-sync.js config file, as described above, and set the pushResults option to true.

Then, we have to setup the following things :

  1. Right before running the tests, a Test Run has to be created in TestRail.

  2. After each test case has been run, the result has to be pushed to TestRail (bound to the previously created Test Run).

In order to achieve this, you will need to register some Cucumber event handlers (features/support/hooks.js) :

var testrailSync = require('cucumber-testrail-sync');

module.exports = function () {
  var testResultSync = new testrailSync.ResultSynchronizer(testrailSync.readConfig());

  this.registerHandler('BeforeFeatures', function (features, callback) {
    testResultSync.createNewTestRun(callback);
  });

  this.After(function (scenario, callback) {
    testResultSync.pushResult(scenario, callback);
  });
};

FAQs

Package last updated on 16 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc