Selenium Cucumber Java BDD Framework 1 – Setup | Step by Step | Raghav Pal
Free Tutorials –
Quiz –
Step 1, create a maven project: 0:00-3:12
Step 2, download maven dependencies: 3:13-6:53
Step 3, create file structure: 6:54-8:19
Step 4, 5, 6, create feature file: 8:20-17:20
Step 7: 17:21-19:19
Step 8, glue code: 19:20-27:38
Step 9, runner class: 27:39
Step 1 – Create a new maven project
Step 2 – Add maven dependencies
Cucumber Java | Cucumber JUnit | JUnit | Selenium Java
Step 3 – Create a folder Features under src/test/resources
Step 4 – Under features folder create a new feature file login.feature
Step 5 – Download cucumber plugin from Eclipse Marketplace
Step 6 – Create feature file and add contents
Feature
Scenario
Steps
Scenario Outline
Example
Tags
Comments
Step 7 – Try to run the feature file
Step 8 – Add Step Definitions / Glue Code under src/test/java package
Step 9 – Create a Runner class
import org.junit.runner.RunWith;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(features="src/test/resources/Features",
glue={"StepDefinitions"})
public class TestRunner {
}
monochrome = true
plugin = { "pretty", "html:target/reports"}
plugin = { "pretty", "json:target/reports/cucumber.json"}
plugin = { "pretty", "junit:target/reports/cucumber.xml"}
tags="@smoketest"
Step 10 – Create Add Cucumber Options for generating reports
HTML | JSON | JUNIT/XML
Step 11 – Run and verify results
Never Stop Learning
Raghav Pal
GitHub Repositories
Join this channel to get access to perks:
Hit Like and. Subscribe button, if you like this video. It gives me great motivation.
You can support my mission for education by sharing this knowledge and helping as many people as you can
If my work has helped you, consider helping or any animal welfare group near you, in any way you can.
Free courses –
Udemy Discounts –
Stories –
Hello Raghav, I would first like to thank you for all of your hard work and great tutorials, I’ve finished watched your beginners Selenium course. One point I’m happy to make is you’re now choosing descriptive file names, everything on that course was “test1, test2, test3” etc., a great improvement. Keep up the great content!!
So happy to know this
In case you face issues generating HTML REPORT at 35:32 then under target folder manually create a folder named HtmlReports and in the code add the following:
plugin= {“pretty”, “html:target/HtmlReports/report.html”}
(names can be changed)
Thanks sir, “pretty”,”html:target/Reports/reports.html” worked for me
@Pulkit Singhal Please share your code for the plugin line. Followed as per authors instruction with no issue
I am also facing the same issue not able to view the reports
Hello Sir, I am getting abstract method error when run through JUNIT how to resolve it??
problem did not get solved, target folder is empty still after following above procedure in comments. I wrote the code, Runned it and refreshed, but no file appears.
Hello Raghav! Thank you so much for this video. It is very helpful to understanding. I learned BDD framework only from your video. Since long times I was getting lots of errors but your explanation is awesome. Thanks a lot again!
Great to hear this Juhi
Hello Raghav, I was struggling with Cucumber project for 3 days due to dependency issues and was just thinking of dropping it but then you came as a Silver Lining in Dark Cloud.Thanks alot for sharing correct dependencies and such a precise presentation.Finally,I have correct jar files and project is working.
One query or suggestion, I was getting errors “Cucumber Options can not be resolved to a type”.When I changed “test” as “compile” in xml file then it worked properly. Am I going in the correct way? BTW, thanks again.
Great to know Monica, yes, its fine, pls continue, all the best
monica thankyou so much for commenting this
Thankyou sir, your explanation and the way of approaching and the acsent all in a prefect sync. Making your sessions more intresting and very eager to learn. Thanks a lot for your great work sir.
You’re most welcome Vignesh
Hi Raghav, The tutorial was extremely useful. I could easily follow and do it. This tutorial is strongly recommended for others and I will do it. Great work !!!
So glad to see this Shaji, do share in all your groups
Thanks Raghav! This is very helpful in a easy understanding explanation! Can’t wait for following sessions, please include bobcat framework, especially with bobcat aem6.5 module please!
Hi Adrienne, happy to know this. more coming up next week
Hi Raghav, Am new to selenium, trying to learn from the scratch. This video was very useful. I was trying the same steps as you and it gave me lot of confidence. Your explanation and teaching is so good. Thanks a lot. will proceed further with other videos.
All the best
Perfect explanation. Thank u Raghav.
I hope you will cover POM with BDD as well, in the coming sessions.
Yes, soon Saurabh
I wish I had found this video earlier in my testing career, this is really well done!!
thanks for liking Johnny
From the bottom of heart, I say thanks to you sir, my project was stuck, struggled for more than 3 days, atlast saw your video and got it cleared sir, thank you so much, please continue your great works sir
Most welcome Srinivasan
This is an excellent tutorial and I am so glad I found. It will familiarize you with everything you need to know to get started and give you a good foundation for learning more. Thanks so much!
Glad it was helpful Laura
@Automation Step by Step It was great. I really needed something to get myself started for work, and was having much luck.
All the best Laura
As usual well explained step by step. Thank you, Raghav for providing such a video. You are really “Awesome”.
Thanks a ton Manish
Thank you Ragav for this session, it is short and clear. Awaiting for the upcoming sessions on Jenkins integration with this suite.
Thanks for watching Naveen. I will add more
Mr. Raghav. It is really really and really fantastic. I just follow your each second of deployment, and now i learnt a lot and end i am able to create the xml, hmtl and json based reports. Wow…more clarity…step by step…slow moves….. Your this video gives me more confident also. Surely will visit your series. Keep educate us/me. Thanks. Jeyakumar from Houston, Texas.
Glad to hear that Jeyakumar, Can find more here https://automationstepbystep.com/
Excellent tutorials. Very understandable even for absolute beginners. Thank you.
Most welcome
Thank you Raghav, your explanation and the way of approaching all in a prefect sync.
So happy to read this
This is the very useful clear explanation and easy to understand, Thanks for bringing this valuable content I am excited to watch all the 12 videos as per playlist. Great work.
Hello Raghav,
I am facing the Html reports issue. The report is generated only but missing some files such as you mentioned index.html and also showing some warning on project icon how to resolve this, Thanks for advance.
You’re very welcome Suraj
hello sir, i have no words to say thanks to u .I was in search this kind of tutorial since log. It helped me a lot
Awesome work. Great. Again thank you
Most welcome Suchi
Hi Raghav, for adding all the imports in stepdefinitions in one go, we can use, ctrl+A and shift+ctrl+O
thanks for adding