Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Cucumber is a tool for running automated tests written in plain language. It allows you to write tests that anyone can understand, regardless of their technical knowledge. Cucumber supports Behavior Driven Development (BDD) and is used to bridge the communication gap between stakeholders and developers.
Writing Features in Gherkin
Cucumber uses Gherkin syntax to define test scenarios in plain language. This makes it easy for non-technical stakeholders to understand and contribute to the test cases.
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 actual code implementations of the steps defined in Gherkin. They link the plain language steps to executable code.
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
});
Hooks
Hooks allow you to run code before and after each scenario. This is useful for setting up and tearing down test environments.
const { Before, After } = require('@cucumber/cucumber');
Before(function () {
// code to run before each scenario
});
After(function () {
// code to run after each scenario
});
Data Tables
Data tables allow you to run the same scenario with multiple sets of data. This is useful for testing different input combinations.
Feature: User login
Scenario Outline: Successful login with multiple users
Given the user is on the login page
When the user enters <username> and <password>
Then the user should be redirected to the dashboard
Examples:
| username | password |
| user1 | pass1 |
| user2 | pass2 |
jest-cucumber is a library that allows you to use Cucumber's Gherkin syntax with Jest. It provides a way to write BDD-style tests using Jest as the test runner. Compared to Cucumber, jest-cucumber is more tightly integrated with Jest and may be easier to set up for projects already using Jest.
cypress-cucumber-preprocessor is a plugin for Cypress that allows you to write your tests in Gherkin syntax. It combines the power of Cypress for end-to-end testing with the readability of Cucumber. This package is ideal for teams that prefer using Cypress for their testing needs but want to leverage BDD.
CodeceptJS is an end-to-end testing framework that supports BDD-style tests. It allows you to write tests in plain language and supports multiple test runners and helpers. Compared to Cucumber, CodeceptJS offers more flexibility in terms of test runners and integrations.
Cucumber is a tool for running automated tests written in plain language. Because they're written in plain language, they can be read by anyone on your team. Because they can be read by anyone, you can use them to help improve communication, collaboration and trust on your team.
Cucumber.js is the JavaScript implementation of Cucumber and runs on the maintained Node.js versions and modern web browsers.
We've put a demo of Cucumber.js to run in your browser. Why don't you give it a try before anything else?
See CONTRIBUTING.md for info on contributing to Cucumber.js.
Everyone interacting in this codebase and issue tracker is expected to follow the Cucumber code of conduct.
Cucumber.js is available as an npm module.
$ npm install cucumber
The following documentation is for master. See below for documentation for older versions.
FAQs
The official JavaScript implementation of Cucumber.
The npm package cucumber receives a total of 180,371 weekly downloads. As such, cucumber popularity was classified as popular.
We found that cucumber demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.