What is Maven?
- Softwareproject-Management-Tool to maintain and manage the project
- Build-Management-Tool for Java Frameworks
Why?
Central Maven Repository to get Dependencies
Maven visits the website, downloads the needed jars and places it in the build path.
e.g. Selenium Jars
just find Selenium Repository
Maintaining common structure for all
One common template across the organisation
this is the empty skeleton:
Flexiblity in integrating with CI Tools
e.g. Maven Commands wich are supported by JenkinsPlugsIns for Test Framework execution
TestNG, JUnit
Vocablary
groupId
: unique identifier (e.g. Selenium)
artifactId
: sub-project of Group ID (e.g. Selenium-Java, a jar name)
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
You can pass all this details and publish it in Maven, then other persons can simply clone it with groupId and artifactId.
Keyword 'test' has to be at the end of each javaclass-file, e.g. SeleniumTest.java.
Install & configure Maven
Download Maven and install
Configure Windows
CLI: mvn (for maven) ---> not found
java -v (for java -version) --> shows you your java version
navigate to Enviroment Variables and set the Path to the Maven Bin Folder. further Information
Create Maven Project in Eclipse
Let it use default Workspace
Use maven-archetype-quickstart template
Fill your POM.xml -File
- Get the Dependencies from Maven Repository Go to the maven repository and get each Dependency and put it inside the Dependencies
- Integrate sureFire Plugin to execute all your testcases in your project
to execute from CLI
(where POM.xml is laying)
- mvn clean (to clean project)
- mvn compile (to check for syntax errors)
- mvn test (first checks dependencies
Top comments (0)