Friday, March 3, 2017

How Create Maven Project for Selenium - Cucumber Automation?

In First Test Case in Selenium with Cucumber post we created java project and added all the required Jars to project build path. This involved more manual intervention work like downloading jars one by one from Maven Central Repository. But in Maven project we will avoid that maven intervention by adding all the dependencies in pom.xml.

Dependencies Required for Maven Project for Selenium with Cucumber:
        1. cucumber-java
        2. cucumber-junit
        3. junit
        4. selenium-standalone-server
Follow the below steps :
Step 1: Install Maven Plugin in Eclipse IDE

Step 2: Create the maven project, Select File > Other > Maven > Next
Step 3: Provide Group ID and Artifact ID and Click Finish. That’s it maven project is created.
Step 4: The maven project should be created.

Step 5: Now add all the Jars required to project by copying the below dependencies to pom.xml file and Save the file (Ctrl+S). Double click on pom.xml to open.

Step 6: We should see Maven Dependencies folder added under project and all jars under it.
Step 7:  Create Features, Test Runner Class, Step Definitions.
  • In Features folder we need create "gmailLogin.feature" and below cucumber tests. 

  • Create a Test Runner Class and the below code.

  • Create a Step Definitions class and the below code.
Please go through my previous post First Test Case in Selenium with Cucumber to understand how to write the cucumber tests in features file and how to create Test Runner class and Step Definitions class.
Step 8: Now go to Test Runner Class "" Right Click > Run As > Junit. Now the cucumber tests should start executing.

No comments:

Post a Comment

DevOps 01: What is DevOps and How it benefits organizations?

DevOps is a culture in an organization, where the development team and operations team help each other by sharing information, process and t...