The software development life cycle contains a very important phase that is testing. Testing is a process in which we test the app or the software to make sure that it is bug-free and working properly. The main motive behind testing is to provide you the best quality apps that mean efficient use of your money. Testing has two major aspects, first is Automation and the second one is Manual.
- In manual testing, the person forms the QA team that will test the app/product as an end-user and refer it to the development team with their feedback and suggestions over it.
- While in case of the automation testing, the testers need to mess up with the code. In this, the testers use some tools to write the code and test the project just like 50% lemon juice, 30% water and 20% sugar shake it well and enjoy the special drink.
Read the complete article and know how to create Maven Project in Eclipse in Selenium with different steps-
How to Create a Maven Project Using Selenium in Eclipse?
So here, I am telling you how to create a maven project for automation testing using selenium in eclipse. Please read the complete article and let me know in the comment box how was the lemonade. Let’s start the party-
Step – 1
First of all, download JDK latest and Eclipse and install the prerequisites. Then, you need to start the eclipse and move further.Navigate to File -> New -> Other.
Navigate to File -> New -> Other.
Step – 2
It will display a wizard, Now choose Maven -> Maven project
Step – 3
Now click on the next and check the Create a simple project and choose the workspace directory if you want to save it at another place. I am going with default so now click on next.
Step – 4
Now please fill the Group id and Artifact id and version no. (in case of custom), click on the finish.
Step – 5
Hold on your seat and wait for creating the project. Once it’s done, then you will see the following structure.
Step – 6
In the maven project, we use the POM file to add the required dependencies. Double-tap on pom.xml file-
Step – 7
We need to add some dependencies related to Selenium WebDriver, TestNG in our Maven Project.
- So navigate to https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java.
- Click on the latest stable version of the selenium -> and copy the content under the maven tab and paste it into your Pom.xml file under the dependencies tag.
- Now navigate to https://mvnrepository.com/artifact/org.testng/testng/7.0.0.
- Click on the latest stable version of the testing -> and copy the content under the maven tab and paste it into your Pom.xml file under the dependencies tag.
- The final file will be looking something like-
Step – 8
In the TestNG framework, we need to create a Testing.xml file to create and handle multiple test classes. We do configure our test run, set test dependency, include or exclude any test, method, class or package and set priority in the XML file. So, let’s create it-
- Right-click on the Project folder, go to New and select ‘File’ as shown in the below image.
Step – 9
In New file wizard, add filename as testing.xml as shown in the below-given image and click on the Finish button.
Step – 10
Now add the below code to this file. You can choose any name for your Test Suite & Test Name according to suitability.
<class name="softwareTestingMaterial.STMTestNGClass" />
Step – 11
Now for executing TestScript, right-click on it. A menu bar will be opened. You need to click on ‘Run As’ and then select ‘Run Configuration’.
Path: testfile>Run As>Run Configurations-
Step – 12
The Run configuration UI will get opened and now you need to follow the below-given steps-
- Select “Maven Build Option” and click on the icon “New Launch Configuration” then Maven configuration will appear.
- Select the Base Directory from the workspace then write the Goals “clean test”.
- Now, select current JRE from JRE Tab and click on the ‘Run’ button as shown in the image below:
Step – 13
After all the execution of these setups, you will get the following output-
Now, everything is all set and it’s time to rock the party.
Hope these steps are very helpful to you and you easily understood How to Create Maven Project in Eclipse for Selenium. For more knowledge, you can know about TestNG Maven Dependency that How To Execute Testng.Xml.
You can leave the concerned queries in the comment box below. I will try to provide the most appropriate answer as soon as possible. Stay connected with us for more similar blogs.