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

cucumber-parallelly

v1.0.0

Published

Run cucumber tests parallelly

Downloads

1,089

Readme

cucumber-parallelly

Build Status

Usage

Setup

cucumber-parallelly is available as an npm module, it allows you to run cucumber in a parallel fashion. You need to have cucumber installed as well.

cucumber-parallelly should be added to your test codebase as a dev dependency. You can do this with:

$ npm install --save-dev cucumber-parallelly

Alternatively you can manually add it to your package.json file:

{
  "devDependencies" : {
    "cucumber-parallelly": "latest"
  }
}

then install with:

$ npm install --dev

Run

cucumber-parallelly can be run from a terminal as follows:

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly

By default cucumber-parallelly will look for features files under a directory called ./features

Configuration

cucumber-parallelly can be configured through a configuration file, and also via parameters. Let's go through the parameters first, then see how we can collect every parameter into a single configuration file. If you need more help on configuration, try:

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly -h

--tags (or -t)

Defines the tags to use for the test execution. Default value is none: "".

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly --tags "@acceptance ~@wip"
// or
$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly -t "@acceptance,@mobile ~@wip"

--threads (or -p)

Defines the number of parallel threads the test will use for execution. Default value is 5.

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly --threads 2
// or
$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly -p 3

--retries (or -r)

Defines the number of times a failed test will be attempted to rerun. Default value is 0.

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly --retrires 2
// or
$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly -r 1

--silent (or -s)

Boolean value to show logs of the individual threads or suppress them, by default: false.

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly --silent false
// or
$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly -s true

--verbose

Boolean value to show the configuration used for the execution, by default: false.

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly --verbose true

--config (or -c)

Path to the configuration file if there is any. Default location: "./cp_config.js"

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly --confing "./pc_config.js"
// or
$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly -c ./pc_config.js

--env (or -e)

The provided key=value pair will be set as environment variable. The values here overwrite the ones in the configuration file'.

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly --env ENVIRONMENT=dev
// or
$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly -e ENVRIONMENT=dev -e 'ENV_NAME=custom value'

--features (or -f)

Path to the features path. Default "./features". This values can be overwrite into configuration file (see section for the -c option.

$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly --features ./test/features
// or
$ node node_modules/cucumber-parallelly/lib/cucumber-parallelly -f ./test/features

Configuration file

All the above can be set in the configuration file, but there are a couple more settings there. If something (like threads) is set in both the configuration file and via argument, the argument value will overwrite the one in the configuration file.

weightingTags

This is optional. Can determine the order in which the tests will be executed. This can significantly decrease the duration of the test running. From the example under: tests with tag @duration_XL will be the first one to start, and the ones with @duration_XS will be the last. By default every test which doesn't have any special tag will be executed in an alphabetical order.

cucumberPath

The path to the cucumber executable. By default it is in the node_modules folder, but can be set to global ("cucumber") as well, or any special location.

featuresPaths

The path to the features to be executed. By default it is in the folder features. The value can be a array to set multiple features paths.

cucumberOpts

The parameters to the cucumber to start with, like the different requires. The default value is as it's in the example configuration file.

reportPath

The path to the final json report file.

tempReportPath

The path to the report files generated by each scenario. This reports will be added to the final report.

environment

There is a good chance that the tests need some configuration from the environment variables. Anything key value pair can be added here to be set prior to the tests. If a value is already set, this won't overwrite that!

Example configuration
var
  date = new Date(),
  timeStamp = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + "_" + date.getHours()
    + "-" + date.getMinutes() + "-" + date.getSeconds();

module.exports = {
  name: "Basic configuration for cucumber-parallelly",
  reportPath: './reports/report.json',
  tempReportPath: './reports/tmp/',
  featuresPaths: ['./test/features1', './test/features2'],
  weightingTags: {
    pattern: '@duration_',
    default: 25,
    XL: 100,
    L: 50,
    M: 25,
    S: 10,
    XS: 5
  },
  threads: 5,
  retries: 2,
  silent: false,
  tags: "",
  cucumberPath: "node_modules/cucumber/bin/cucumber.js",
  cucumberOpts: "--require features/step_definitions " +
                "--require features/support/env.js " +
                "--require features/support/world.js " +
                "--require features/support/hooks.js ",
  environment: {
    SELENIUM_SERVER: "http://localhost:4444/wd/hub",
    ENVIRONMENT: "integration",
    BROWSER_NAME: "chrome",
    LOG_FILE_FOR_EXECUTION: "./log/log_" + timeStamp + ".log"
  }
};