Tutorial 1:Cucumber with java maven project

Table of contents
Reading Time: 2 minutes

Hi Folks. From this Blog we will start a series of cucumber BDD tool .Before go through the cucumber We should know how to integrate cucumber with java maven project.

To run Cucumber test with Java, following are the steps.

Step 1. Install Eclipse IDE -Make sure java should already be installed on your machine.

Step 2. Then Create the New Project in Eclipse IDE by following steps:

  • Click on new –> Other –> Maven –> Maven Project — > Next
  • After that click on Simple project and keep the default workspace location
  • Provide details as Artifact id, Group id, name and description. and click on Finish.

Step 3. Then Configure Cucumber with Maven.

  •  Open the pom.xml
  • Add dependency for Cucumber-Java, Cucumber-JUnit pom2

Step 4. Once pom.xml is edited successfully, save it. After adding dependencies of Cucumber, this is how pom.xml should look like:


And then

Go to Project → Clean and build the project , it will take few second .

You will be able to see all the dependencies(jars) under Maven repository.

Step 5. We will create a simple project structure, to keep files at logical places. We need to create few packages,  Please find the below Screenshot for better understanding.

Create feature files in src/test/resources. and then Create corresponding Step definition classes in src/test/java.

Along with we create CucumberTest class (Test Suite) in src/test/java through which we will generate test report. In target folder, We will get our Test Report .

cucumber with java

Hope the blog helpful for the first time User.In next we will go through How to write simple test cases in cucumber.

Written by 

Principal Architect at Knoldus Inc

1 thought on “Tutorial 1:Cucumber with java maven project1 min read

Comments are closed.