Pages

Wednesday, 27 December 2023

๐Ÿ’› BDD-Cucumber Quick Notes ๐Ÿงก

 




๐Ÿ’› 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 

SET TRANING VIDEOS AVAILABLE with Live Doubt Session Check Training Page for Course Content or reach out @whatsapp +91-9619094122. 
This includes classnotes, 500+ interview questions, 3 projects, and a Java Coding question set for product companies along with career guidance from FAANG employees for Automation and SDET.


Course_001API Automation +
UI Automation +
Mobile Testing +
ChatGPT For Test Automation +
Jenkins-GIT-Docker
Course_002API Automation +
UI Automation +
Jenkins-GIT-Docker
Course_003API Automation +
ChatGPT for Test Automation +
Jenkins-GIT
Course_004ChatGPT for Test Automation
Course_005API Automation +
Jenkins-GIT


*******************************************************************
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