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

@cucumber/cucumber

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cucumber/cucumber

The official JavaScript implementation of Cucumber.

  • 8.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
decreased by-2.86%
Maintainers
2
Weekly downloads
 
Created

What is @cucumber/cucumber?

@cucumber/cucumber is a popular tool for Behavior-Driven Development (BDD). It allows you to write tests in a natural language that non-programmers can read, using Gherkin syntax. This makes it easier for teams to collaborate on defining the behavior of an application.

What are @cucumber/cucumber's main functionalities?

Defining Features with Gherkin

This feature allows you to define the behavior of your application in plain language using Gherkin syntax. The example defines a feature for user login with a scenario for successful login.

Feature: User login
  Scenario: Successful login
    Given the user is on the login page
    When the user enters valid credentials
    Then the user should be redirected to the dashboard

Step Definitions

Step definitions are the glue between Gherkin steps and the actual code that executes them. This example shows how to implement the steps defined in the Gherkin feature.

const { Given, When, Then } = require('@cucumber/cucumber');

Given('the user is on the login page', function () {
  // code to navigate to login page
});

When('the user enters valid credentials', function () {
  // code to enter credentials
});

Then('the user should be redirected to the dashboard', function () {
  // code to check redirection
});

Running Tests

You can run your Cucumber tests using the `cucumber-js` command. This will execute all the feature files and their corresponding step definitions.

npx cucumber-js

Other packages similar to @cucumber/cucumber

Keywords

FAQs

Package last updated on 28 Jul 2022

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