To configure eclipse with Cucumber, we need to launch the Eclipse IDE, create a Workspace, create a Project and add Extern Al libraries to the project.
Step 1:select WorkSpace on Eclipse start up
A) Double click on ' Eclipse.exe ' to start eclipse. First time when you start eclipse, it'll ask you to select your workspace where your work'll be stored as shown in Bel ow image.
b) Create a "working directory" for all of your projects. Think of it Like "My Documents" in the Windows operating system. It's a folder which contains a lot of your documents, but there's nothing to prevent the from creating another folder call Ed "My Other Documents" (for instance) to house other documents.
Typically need one workspace, and you can think the it as your "My Documents" for Java code. If you wanted to, you could has more than one, but chances is you won ' t has a use for more. I like to choose my own workplace location and would place all my TOOLSQA tutorial projects under it.
You can change it later on from ' Switch Workspace ' under ' File ' menu of Eclipse. After selecting Workspace folder, Eclipse would be open.
c) You could see the window as this, the Welcome window for Eclipse. You may close the this window.
Step 2:create a New Project
PROJECTS:A collection of related code. Generally speaking, each project encompasses one independent program. Each programming assignment your do would typically require its own project.
Once you ' ve established your workspace, you'll want to create a project and begin writing code. In Eclipse, Projects is the Next-smallest functional unit after workspaces, and where you might has only one workspace, You'll usually have several projects inside one workspace.
A) Create new Java project from File > New > Java Project.
Note:you may see a direct option for Java Project, if your is using the latest version of Eclipse like LUNA.
b) Select Java Project and click Next.
c) Give your Project name ' Onlinestore ' as shown in below given figures. Click on Finish button.
Note:i am naming this as Onlinestore, as toolsqa.com gives your opportunity to practice Automation on Live demo site. This demo website are a complete ecommerce website where a customer can register and purchase electronic items.
Website:www.store.demoqa.com
D) If or May is not see the this message if the case is you get any, check the ' Remember my decision ' and click on Yes.
Now your new created project ' Onlinestore ' would display in Eclipse Project Explorer.
Step 3:add External Jars to Java build path
We is almost ready to write the first cucumber selenium test but before so we need to associate all the Selenium & Cucumber jars to the newly created project.
ADD Selenium Jars
A) Let ' s first add Selenium Jars. Right click on Project ' Onlinestore ' > Select Properties > Java build path. Then navigate to Libraries tab and click Add External JARs.
b) Add Selenium Java jar, you may add the source file too.
c) Add all the jars from the Libs folder as well.
d) Click OK.
ADD Cucumber Jars
A) Right click on Project ' Onlinestore ' > Select Properties > Java build path. Then navigate to Libraries tab and click Add External JARs.
b) Add all the Cucumber ' s Jars to the project and click Open.
c) Click on Ok.
D) This is what the project looks like in Eclipse as of now.
That's all about the configuration of Cucumber & Selenium Webdriver with Eclipse. Now your is ready-to-write your test script in eclipse.