Create new Cucumber Eclipse project

This is a continuation of our previous article on cucumber, where we provided information on how to download Cucumber and Selenium jar files. In this article, we will go a step forward and show you how to setup a cucumber eclipse project from scratch. We will then also add all these jar files to this cucumber project. Let us now start the process of creating cucumber eclipse project.

Note: This article is a part of our Cucumber Tutorial series. Head over to our Selenium Cucumber Tutorial main page for the step by step cucumber setup guide

Open Eclipse IDE

To start with, please make sure that you have downloaded Eclipse IDE on your machine. If not, you can check out this guide on how to download and setup Eclipse IDE. Follow the steps given below to open Eclipse IDE –

1. Open the path where you have the unzipped Eclipse folder. Double click on eclipse.exe to open it

2. Once Eclipse starts opening, you would see the Eclipse logo

3. Next you would see Workspace Launcher popup box. You can either leave the Workspace location as the default value, or you can browse to any folder path you wish. For this article, we are leaving it as default

4. Click on Ok button. Eclipse would start loading all the files. Once its done, you will see the Eclipse IDE Welcome page as shown below

Create new Project in Eclipse

Create a new Java project in Eclipse by following the steps given below –

1. Select File -> New -> Project… option from Eclipse IDE

2. In the New Project popup box, select Java Project and then click on Next button

3. In the New Java Project popup box, write the project name as CucumberTutorial. Leave all the other fields as default and then click on Finish button

4. If the panel at the left side is collapsed, then you can restore it as shown below

5. Eclipse IDE would now look like the image shown below. It would display your newly created project in the left side pane. If there are some additional panes on the right side (Tasks List, Welcome screen etc), then you can close those so that Eclipse IDE looks uncluttered

The new Cucumber project is successfully created in Eclipse. Let’s now start with the next section of this article, where we will add all the jar files to this project.

Add Cucumber and Selenium jars to your Eclipse project

In our previous article, we had showed how to download Cucumber and Selenium jar files. Let us now add these jars to our Cucumber Eclipse project by following the steps given below –

1. Right click on the Project. Then select Build Path > Configure Build Path… option

2. Properties window will now open as shown below. From Libraries tab, click on Add External JARS… button

3. Now, navigate to the folder where you have saved Cucumber jars. Select all the jars and then click on Open button

4. You will now see that all the cucumber related jars are now added to the Libraries tab as shown below

5. Follow above steps and add Selenium webdriver jars to this project. Make sure that you add client-combined jars, as well as the jars in the lib folder, as shown in the below images

Add client combined jars

Add all jars from lib folder

6. Once all the jar files have been added, click on Apply and Close button to close the Properties window. Notice that a new sub-section called Referenced Libraries is created inside the project folder. Expand this Referenced Libraries section. You will see that it lists down all the jar files that you had added in the above steps

With this, we now complete our article where we showed how you can create a project for cucumber using Eclipse. In our next article, we will start with the actual cucumber related concepts, starting with the feature file.

Have any doubts or queries about this article? Or do you have any feedback to share with us? You can get in touch with us using the comments section.

Next Article: Add your first Cucumber feature file in the Eclipse project