How to create Selenium Maven Project in Eclipse?
Before creating Selenium Maven testing Project for cucumber testing in Eclipse, first we must have the following dependencies in our computer system:
Here we are creating a Maven project to test the registration feature through the data table:
In order to create a Maven project first, Go to File → New → Others → Maven → Maven Project → Next.
After clicking the Next, a window will prompt. In this window, we need to provide group Id (group Id identifies the project uniquely across all projects). We have provided group Id as "com.javatpoint." You can give any name on your own choice.
Also, provide artifact Id (artifact Id represents the name of the project). We have provided artifact Id as "CucumberTesting." You can give any name on your own choice.
Click on Finish.
Open pom.xml by using the following steps:
Add dependency inside pom.xml for Selenium: This will indicate to Maven, which Selenium jar files will be downloaded from the central repository to the local repository.
Add dependency inside pom.xml for Cucumber-Java: It will indicate to Maven; which Cucumber files will be downloaded from the central repository to the local repository.
Add dependency for Cucumber-Junit: It will indicate to Maven, which Cucumber JUnit files will be downloaded from the central repository to the local repository.
Add dependency for Junit: It will indicate to Maven, which JUnit files will be downloaded from the central repository to the local repository.
After completing all dependencies, verify binaries.
Now, create a package named dataTable under src/test/java folder of your project.
Create a Feature file:
Feature - Data table Verify that the new user registration is successful after passing correct inputs. Scenario: Given the user on the user registration page. When user enter invalid data on the page | Fields | Values | | First Name | Preeti | | Last Name | Sharma | | Email Address | email@example.com | | Re-enter Email Address | firstname.lastname@example.org | | Password |PASSWORD | | Birthdate | 02 | Then the user registration should be successful.
Creation of the step definition file:
After creating the step definition file now, we need to create a runner class file.
Save this file, and run the test by using the following options:
If your execution is successful, you will observe the following things: