What is Cucumber?
Example:
Feature: Login
Scenario: Successful login
Given the user is on the login page
When the user enters valid credentials
Then the user should be logged in
保存以便复习
保存以便复习
收藏此条目、标记为困难题,或将其加入复习集合。
WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。
了解热门 Cucumber 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。
了解热门 Cucumber 面试题与答案,帮助应届生和有经验的候选人为求职面试做好准备。
搜索问题以查看答案。
Example:
Feature: Login
Scenario: Successful login
Given the user is on the login page
When the user enters valid credentials
Then the user should be logged in
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Feature: Shopping Cart
Background:
Given a user is logged in
Scenario: Add item to cart
When the user adds an item to the cart
Then the cart should display the item
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
@smoke
Feature: User Authentication
Scenario: Successful login
Given the user is on the login page
When the user enters valid credentials
Then the user should be logged in
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
@ignore
Scenario: This scenario will be skipped
Given a precondition
When an action is performed
Then the result is validated
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Feature: Product Management
Background:
Given a user is logged in
Scenario: Add a new product
When the user adds a new product
Then the product should be added successfully
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
cucumber --tags @smoke
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario: Login with valid credentials
Given the user is on the login page
When the user enters valid credentials
Then the user should be logged in
But the user dashboard should be displayed
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
project
|-- src
| |-- test
| |-- java
| |-- features
| |-- login
| |-- login.feature
| |-- search
| |-- search.feature
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
cucumber --dry-run
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario Outline: Search with different keywords
Given the user is on the search page
When the user searches for
Then results should include
Examples:
| keyword | result |
| cucumber | relevant results |
| testing | accurate results |
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Given(/^the user is on the login page$/, () => {
// code to navigate to the login page
});
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario Outline: Search with dynamic data
Given the user is on the search page
When the user searches for
Then results should include
Examples:
| dynamic_keyword | result |
| cucumber | relevant results |
| testing | accurate results |
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Before(() => {
// code to run before each scenario
});
After(() => {
// code to run after each scenario
});
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario: Data-driven login
Given the user is on the login page
When the user enters the following credentials
| Username | Password |
| user1 | pass123 |
Then the user should be logged in
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Feature: Online Shopping
Background:
Given a user is logged in
Scenario Outline: Add item to cart
When the user adds- to the cart
Then the cart should display the
Examples:
| item |
| Laptop |
| Headphones|
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario: Add product description
Given the user is on the product page
When the user adds the following description
"""
This is a detailed description of the product.
It includes features and specifications.
"""
Then the description should be saved
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario Outline: Access different URLs
Given the user navigates to
Then the page should load successfully
Examples:
| url |
| https://example.com |
| https://test.com |
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Feature: Online Shopping
Background:
Given a user is logged in
Scenario: Add item to cart
When the user adds an item to the cart
Then the cart should display the item
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
glue = {"path.to.step.definitions"}
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario Outline: Search with different keywords
Given the user is on the search page
When the user searches for
Then results should include
Examples:
| keyword | result |
| cucumber | relevant results |
| testing | accurate results |
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario Outline: Search with dynamic data
Given the user is on the search page
When the user searches for
Then results should include
Examples:
| dynamic_keyword | result |
| cucumber | relevant results |
| testing | accurate results |
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Feature: Login
Scenario: Successful login
Given the user is on the login page
When the user enters valid credentials
Then the user should be logged in
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario: Sharing data between steps
Given a variable is initialized
When the variable is modified
Then the modified value should be accessible in subsequent steps
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario: Asynchronous operation
Given the user initiates an asynchronous operation
When the operation completes
Then the result should be visible
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario: Sharing data between steps
Given a variable is initialized
When the variable is modified
Then the modified value should be accessible in subsequent steps
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
mvn test -Dcucumber.options="--threads 2"
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
@chrome
Scenario: Test on Chrome browser
Given the user is on the application
When the user performs an action
Then the result should be validated
收藏此条目、标记为困难题,或将其加入复习集合。
Example:
Scenario: Sharing data between steps
Given a variable is initialized
When the variable is modified
Then the modified value should be accessible in subsequent steps
收藏此条目、标记为困难题,或将其加入复习集合。