In Maven, every step related to a goal. It comes from an inbuilt life cycle. Integration tests run after the project that you design and Deploy. This comes from Default life cycle. To illustrate, the integration test phase of default life cycle executed for your project, when it compiled with Maven in selenium.
We all know that Maven is an inbuilt tool, which guides to manage selenium projects. It guides us to create correct project design and handle the Jar files, in a project built path.The main thing in software testing is integrating the test results. The inbuilt tool that your project utilizes it. Developers run tests very easily. Probably they don’t run them. Another Reason you can run your tests very easily. They run Maven skip tests, another reason is integrating tests. For Encouraging clean project that design Process.
Maven in Selenium
Generally, Maven utilizes POM.xml Configuration files, that keeps total project configuration related information. For selenium software, you have to offer selenium web driver that related Information in POM.xml file. Then it downloads each Information that needed for jar files in an automatic way. After that, if you want to modify version of Selenium web driver. Then you have to send modify version In POM.xml file only. After that Maven downloads latest version jar files, that automatically store in the local repository. It shows that if you update any dependency version In Pom.xml file.Moreover, First, you have to check. That version’s Jar files are available. They are not in a local repository. If it is available, maven repository.
Verifier, it verifies the existence of some conditions used for Integration.
Surefire, It runs Junit unit tests in isolated class loader.
Site, it generate a site for current project.
Resources, it copies resources, to output directory that include JAR.
Install, installs the built artifact in local repository.
Failsafe, it operates Junit maven Integration tests with isolated Class loader.
Deploy, it deploy artifact to remote repository.
Compiler, it compiles Java code.
Clean, it cleans up after build.
Maven in Selenium
When we use Maven we find, each and Every seleniumhq artifact, that directly. Included in central Maven repository. For Initiating, we have to use, latest web driver Implementations. That is in your maven project. It will add Dependency for your pom.xml with IT courses.
org.seleniumhq.seleniumselenium-java3.141.59
For Getting an total Overview Over selenium Maven download Artifacts. See below Picture.
If you recognize, you only see web driver Implementation. That is just like onlineitguru Driver. It Doesn’t need Selenium Java Artifact. Furthermore, you have to add dependency on artifact, that you require.
If we go with 2.53.0, we need explicitly, that contain Html Unit Driver as a dependency which contain. Equally Important, Version Number of Driver, that track HTML unit Inbuilt
org.seleniumhq.seleniumhtmlunit-driver2.33.2
Generally, When we use the old, selenium, you have to start selenium server. Usually, it is the trusted way that you have to download selenium server Standalone.jar. As a matter of fact, You can embed selenium server in your project. Furthermore, You can also add Dependency to pom.xml
org.seleniumhq.seleniumselenium-server3.141.59
Simultaneously, From many Days, we are using Selenium API in Code. For that you need selenium jar files for project. In the same fashion, Which is in eclipse, you have to go to properties of your project. For instance, that is Java build path – libraries- added external jars).
For Every Dependency, there is a version number. Moreover, the version number can hard coded or it stored in a property.
Especially, Big Deal is, When we run our project Maven command, it checks libraries in their computer. Eventually, If they don’t do it, they Download them within an automatic mode, with central Maven repository.
Eventually, it will upgrade libraries, you have to update the central repository. Specifically, After that, it upgrades libraries that update version numbers in XML and maven that take care until the end.
For Configuring Pom.xml we need mvn-compiler-plugin and Surfire Plugin
moduleC (only for selenium tests)scr/main/java/com/selenium/A.javasrc/test/java/...
Maven Resource Plugin
resources:resourcesCopy resources to main source code to main output directory.Every time it uses project.build. In the same fashion, resources element to specify the resources to copy.
resources:testResourcesIt Copy resources for the testing source code to the testing output directory.Always uses the project.build.testResources element to specify the resources to copy.
resources:copy-resourcesCopy resources for configured plugin attribute resources.
resources:helpDisplay guide information on maven-resources-plugin.