๐ BDD-Cucumber Quick Notes ๐งก
If you are using BDD-Cucumber then keep this one handy for easy and quick reference:
๐บ @Given:
๐๐ป When to Use:
Describes a pre-condition or initial context for the scenario.
๐๐ป Example:
@Given("user is on the login page")
public void userIsOnLoginPage() {
// Implementation code
}
๐บ @When:
๐๐ป When to Use:
Describes an event or an action taken by the user.
๐๐ป Example:
@When("user enters valid credentials")
public void userEntersValidCredentials() {
// Implementation code
}
๐บ @Then:
๐๐ป When to Use:
Describes the expected outcome or result.
๐๐ป Example:
@Then("user should be logged in")
public void userShouldBeLoggedIn() {
// Implementation code
}
๐บ @And and @But
๐๐ป When to Use:
Enhancements to other annotations for better readability.
๐๐ป Example:
@And("user has an active session")
public void userHasActiveSession() {
// Implementation code
}
๐บ @Before and @After:
๐๐ป When to Use:
Executed before and after each scenario.
๐๐ป Example:
@Before
public void setup() {
// Initialization code
}
@After
public void teardown() {
// Cleanup code
}
๐บ @DataTableType:
๐๐ป When to Use:
Converts DataTable to a custom Java object.
๐๐ป Example:
@DataTableType
public User convertToUser(Map<String, String> entry) {
// Conversion logic
}
๐บ @ParameterType:
๐๐ป When to Use:
Converts step definition parameters to custom Java types.
๐๐ป Example:
@ParameterType(".*")
public CustomType convertToCustomType(String value) {
// Conversion logic
}
๐บ @AfterStep:
๐๐ป When to Use:
Executed after each step in a scenario.
๐๐ป Example:
@AfterStep
public void logStepResult(Scenario scenario) {
// Logging step result
}
๐บ @Scenario Outline
๐๐ป When to Use:
The Scenario Outline keyword can be used to run the same Scenario multiple times, with different combinations of values.
๐๐ป Example:
Scenario Outline: eating
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers
Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |
๐บ @Hooks:
๐๐ป When to Use:
Global hooks applied before or after scenarios or features.
๐๐ป Example:
Before hooks run before the first step of each scenario.
@Before
public void globalSetup() {
// Global setup code
}
After hooks run after the last step of each scenario ๐๐ป
@After
public void globalTeardown() {
// Global teardown code
}
***
๐Explore my hands-on session with real-time projects covering APIs, Postman, RestAssured, Selenium, Grid, Docker, Jenkins, Maven, and Git! Get personalized guidance, help with questions, mock interviews, and coding sessions: https://lnkd.in/gJ-fQQ-W
*****
๐YouTube channel: https://lnkd.in/gGUGmb-P
#sidpost #bdd #cucumber #testautomation #qualityassurance #automation #softwaretesting #selenium #seleniumwebdriver #qa #qaautomation #testing
*****
For the Top API Testing Interview Q&A, refer the link : https://lnkd.in/drhqciDd
*****
๐ For 1:1 call in Resume & LinkedIn profile help, reach out to me : https://lnkd.in/ddayTwnq
๐ Learn more about API Status codes with examples:
https://lnkd.in/gqCmrjMW
************************************************
************************************************
Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session
*******************************************************************For any doubts or career guidance from me, reach out here: https://topmate.io/sidharth_shukla
********************************************************************
****************************************
SDET Interview Question and Answers
TestNG Interview questions and answers
Jenkins Interview Questions and Answers
Appium Interview Questions and Answers
Selenium Interview Questions and answers
Java Coding Interview Questions and Answers
GIT Interview Questions and Answers
************************************************
*************************************************
SeleniumWebdriver Automation Testing Interview Questions:
https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver
API Testing Interview Question Set:
https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html
DevOps Interview Q&A:
https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes
Docker Interview Question Set
https://automationreinvented.blogspot.com/Docker
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign
Java Related Interview Question Set
https://automationreinvented.blogspot.com/search/label/Java
GIT Interview Question Set:
https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html
Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions
Mobile Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Mobile%20Testing
Python Interview Question Set for QAE - SDET - SDE:
https://automationreinvented.blogspot.com/search/label/Python
#APITesting #RestAssured #TestingTips #testautomation #software #api #sdet #automation #restassured #career #technology #qualityassurance
No comments:
Post a Comment