In previous post we have just seen introduction about Cucumber, now we will see in details how to do setup.
Pre-requisite.
Install JDK
Install and configure Maven
Install and configure Eclipse (with plugins)
Set up selenium web driver component
Pre-requisite.
Install JDK
Install and configure Maven
Install and configure Eclipse (with plugins)
Set up selenium web driver component
Agenda
Here we will write our first cucumber script and run through runner class .
- Download Cucumber Jars from Maven dependencies
- cucumber-jvm and other dependent jars
- Project structure
- Cucumber first feature
- Write step definitions (automation code)
- Runner class
- Results
- Download Cucumber Jars from Maven dependencies
This is the easiest way to configure the other way is to download all one by one jar from maven repository.
There are few prerequisites for setting up cucumber in eclipse.
Once Maven is installed on eclipse and a Maven project is created, the next step is to add cucumber dependencies on the project. SO we need to add dependencies in POM.xml file to point all the jars like
- cucumber-core
- cucumber-java
- cucumber-junit
- cucumber-jvm-deps
- cucumber-reporting
- gherkin
- junit
Please update the pom.xml as shown below. and also make sure that to paste from properties tag.
3. TO understand project structure
- src/main/java: This will ideally contain source code
- src/test/java: This will contain all java code that runs automation
- src/test/resources: This will contain our feature files
- features: This folder contains all the feature files
4 . To create first cucumber feature file
under src/test/resource folder create feature file.
if folder not exists please create a source folder like this
and in the popup name the folder as -> src/test/resources
Create a feature file as sample.feature under this folder as show in below snapshot from project right click and navigate to File in popup below show enter the file name.
Then copy paste this feature file snippet.
under src/test/resource folder create feature file.
if folder not exists please create a source folder like this
and in the popup name the folder as -> src/test/resources
Create a feature file as sample.feature under this folder as show in below snapshot from project right click and navigate to File in popup below show enter the file name.
Then copy paste this feature file snippet.
That;s it, you are done with the basic cucumber setup till report.
Thanks
Thanks