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.
This is the last version in the cucumber
series. New releases will henceforth
be made under the @cucumber/cucumber
package name.
By installing this version you are implicitly installing the new @cucumber/cucumber
package.
You should npm uninstall cucumber
and then npm install --save-dev @cucumber/cucumber
.
After doing this you should replace your require
or import
statements to load
@cucumber/cucumber
instead of cucumber
.
If you are using TypeScript, npm uninstall @types/cucumber
(v7 has types built-in). Also
replace TableDefinition
with DataTable
if you are using these in your code.
[7.0.0-rc.0] - 2020-09-14
--publish
option to publish reports to reports.cucumber.io #1423, #1424transpose
method to data table interfacelog
function to world, providing a shorthand to log plain text as attachment(s)@types/cucumber
in TypeScript projectscucumber
to @cucumber/cucumber
- require
/import
statements must be changed from cucumber
to @cucumber/cucumber
TableDefinition
to DataTable
event-protocol
formatter has been removed and replaced with message
typeName
from options object for defineParameterType
in favour of name
CUCUMBER_TOTAL_SLAVES
is now CUCUMBER_TOTAL_WORKERS
CUCUMBER_SLAVE_ID
is now CUCUMBER_WORKER_ID
--format=./relpath/to/formatter
). Previously this was always loaded as a file relative to the current directory.json
formatter is deprecated and will be removed in next major release. Custom formatters should migrate to use the message
formatter, or the standalone JSON formatter as a stopgap.--retry-tag-filter
CLI argumentFAQs
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.