Maven for build Automation explained easy
Maven tool from Apache is used for the build automation.
To install maven in windows environment https://mkyong.com/maven/how-to-install-maven-in-windows/
Earlier, there used to be a manual build to be done by the developer and provide the generated war, jar, or ear file to the testing team. The testing team conducts multiple scenarios and thus finally sent to the administration team. then they follow the deployment procedure to make the application available to access.
With the help of maven one can generate the build from anywhere without installing the eclipse in the environment, and the test cases also can be run along with the maven and on success or failure generate a report and thus continue the process.
The other main advantage of the Maven is the addition of dependencies. i.e, the jar files or library files that are required to fulfill some of the functionalities of the development are to be added manually in the beginning. But, with maven one can just import the required jar files from the maven repository. Maven repositories can be maintained both external and local. Some payments and security related dependencies are maintained locally. for ex., if we need the selenium or testing jar file. We can simply specify the dependencies in the POM.xml file as shown below.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
All the files that belong to selenium will be pulled to eclipse and will be utilized.
Maven Architecture:
Architecture mainly consists of 3 phases:
Maven compiles: to compile we need a compile jar file.
Maven Test: Surefire jar dependency to be added.
Maven Resource: A resource jar file to be added thus helps in generating the required Jar, war, and ear files.
Maven commands:
mvn clean install
The above command is used to start a new compile and run all the test cases and generate a build file at the end.
mvn test:
The above command is used to run all the test cases that are defined in the application.
mvn install -DskipTests:
The above command helps in skipping the test and just compile and generate the files. There are other ways to skip test. Here we are going with real time easy ways.
Comments
Post a Comment