In this post i would like to discuss about Maven.
Here are few basic questions:
What is Maven?
What are the advantages of Maven.
How to use Maven in Selenium projects.
How to Create a maven project?
What is Maven:
Maven -- is a build tool and it is mainly used for Java projects.
Maven is used to manage dependencies.
For example if you are using selenium latest version 2.47.1 and later point of time if you have to upgrade to newer version of selenium, then it can be manged very easily by using Maven dependencies.
What are the advantages of Maven.
It is a build tool, so it is used to setup everything which is required to run your java code independently.
Maven provides pom.xml which is core to any project.
Maven is used to manage dependencies.
Maven is a plugin for many of IDEs. (Eclipse, Netbeans, IntelliJ etc..)
Frequently used terms in Maven:
GroupID:
Group id refers to domain ID. For example you can use company name as groupID.
Artifact ID:
Name of the project. what ever the name you provide in artifact ID it is nothing but your project ID.
Local repository:
Maven downloads all required jar files and stores in local repository with folder name .m2 (C:\Users\username\.m2)
Maven Set Up:
Pre-requisites:
Make sure Java is installed
Make sure Java_Home and path are set under environmental properties.
Latest version of eclipse (Luna or Mars)
If you are using Luna or Mars you need not to install Maven plug in, bcs maven plug in is already installed in these versions of Eclipse EclipseIDE
Verify Maven is already installed or not.
1. Open Eclipse, Click on Help ----> select About Eclipse..a window will open.
if you see m2 symbol there ..that means maven is installed.
2. Click Next in "New Maven Project Screen"
3. select "maven-archetype-quickstart" from list of artifacts. (be default quickstart will be selected)
4. Enter Group ID, Artifact ID Click Finish
Add Dependencies:
Open pom.xml
Click on pom.xml tab
Add a testNG dependency.
4. Add Selenium related dependencies.
http://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java/2.47.1
org.seleniumhq.selenium
selenium-java
2.47.1
Here are few basic questions:
What is Maven?
What are the advantages of Maven.
How to use Maven in Selenium projects.
How to Create a maven project?
What is Maven:
Maven -- is a build tool and it is mainly used for Java projects.
Maven is used to manage dependencies.
For example if you are using selenium latest version 2.47.1 and later point of time if you have to upgrade to newer version of selenium, then it can be manged very easily by using Maven dependencies.
What are the advantages of Maven.
It is a build tool, so it is used to setup everything which is required to run your java code independently.
Maven provides pom.xml which is core to any project.
Maven is used to manage dependencies.
Maven is a plugin for many of IDEs. (Eclipse, Netbeans, IntelliJ etc..)
Frequently used terms in Maven:
GroupID:
Group id refers to domain ID. For example you can use company name as groupID.
Artifact ID:
Name of the project. what ever the name you provide in artifact ID it is nothing but your project ID.
Local repository:
Maven downloads all required jar files and stores in local repository with folder name .m2 (C:\Users\username\.m2)
Maven Set Up:
Pre-requisites:
Make sure Java is installed
Make sure Java_Home and path are set under environmental properties.
Latest version of eclipse (Luna or Mars)
If you are using Luna or Mars you need not to install Maven plug in, bcs maven plug in is already installed in these versions of Eclipse EclipseIDE
Verify Maven is already installed or not.
1. Open Eclipse, Click on Help ----> select About Eclipse..a window will open.
if you see m2 symbol there ..that means maven is installed.
Create Maven Project:
1. File ---New --Other ---Expand Maven and select Maven Project
3. select "maven-archetype-quickstart" from list of artifacts. (be default quickstart will be selected)
4. Enter Group ID, Artifact ID Click Finish
5. Once you created a project in eclipse you can see the project
Add Dependencies:
Open pom.xml
Click on pom.xml tab
Add a testNG dependency.
- Navigate to MavenRepository and search for TestNG
- Select the desired version.
- Copy testNG dependency and paste it in pom.xml
4. Add Selenium related dependencies.
http://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java/2.47.1
Allow some time to download those Jar files and these files will be automatically added to your project. Files will be stored under .m2 folder (C:\Users\username\.m2)
Now you can write your normal Selenium-TestNG program and run the script.
If you want to run test case from maven you need below dependencies:
Pre requisite: Create a testNG test suite.
Add below plugins to POM.xml
- maven-compiler-plugin
- maven-surefire-plugin
- testng.xml
The maven-surefire-plugin is used to configure and execute tests. Here plugin is used to configure the testing.xml for TestNG test and generate test reports.
The maven-compiler-plugin is used to help in compiling the code and using the particular JDK version for compilation. Add all dependencies in the following code snippet, to pom.xml in the node
Maven-Compiler-plugin:
http://maven.apache.org/plugins/maven-compiler-plugin/usage.html
Maven-sure-fire plugin:
http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html
To run your test cases:
Right click on POM.xml--Run As ---mvn test
scripts which are in testNG.xml will be executed and results will be available under:
Project---target---surefire--report
POM.xml looks like this:
Nice post buddy....
ReplyDeleteVery nice Naga :)
ReplyDeletelearnt.. :)
ReplyDeleteI have been reading your blog posts. You blog posts are awesome. They provide good and extremely information which is more valuable. Best selenium training in chennai is predominant famous for Selenium Automation Training and how to get the necessary knowledge about the technology and implement it in a effective way.
ReplyDeleteAmazing & Great informative blog,it gives very useful practical information to developer like me. Besides that Wisen has established as Best Java Online Training from India . or learn thru Online Training mode Hibernate Online Training . Nowadays Hibernate ORM has tons of job opportunities on various vertical industry. or learn thru JavaScript Online Training from India. Nowadays even JavaScript has tons of job opportunities on various vertical industry.
ReplyDeleteGreat blog.you put Good stuff.All the topics were explained briefly.so quickly understand for me.I am waiting for your next fantastic blog.Thanks for sharing.Any coures related details learn...
ReplyDeletesoftware testing course in chennai
Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog... Selenium Training in Chennai | Selenium Training institutes in Chennai
ReplyDeleteInformative article.. Keep posting more useful like dis to help otheres to gain knowledge....
ReplyDeleteSelenium training in Velachery
Selenium training institute in chennai
Selenium training in chennai
I am really happy with your blog because your article is very unique and powerful for new reader.
ReplyDeleteSelenium Training in Chennai
Fantastic article!!! I like so much very helpful for me. I learn more ideas from this post. Thank you.
ReplyDeleteEthical Hacking Course in Chennai
Hacking Course in Chennai
Certified Ethical Hacking Course in Chennai
Ethical Hacking Training in Chennai
Ethical Hacking Course
The article is so informative. This is more helpful. Thanks for sharing.
ReplyDeleteBest online software testing training course institute in chennai with placement
Best selenium testing online course training in chennai
Learn best software testing online certification course class in chennai with placement
Very Nice...
ReplyDeleteinternship in chennai for ece students with stipend
internship for mechanical engineering students in chennai
inplant training in chennai
free internship in pune for computer engineering students
internship in chennai for mca
iot internships
internships for cse students in
implant training in chennai
internship for aeronautical engineering students in bangalore
inplant training certificate
very good post...
ReplyDeleteinternship report on python
free internship in chennai for ece students
free internship for bca
internship for computer science engineering students in india
internships in hyderabad for cse students 2018
electrical companies in hyderabad for internship
internships in chennai for cse students 2019
internships for ece students
inplant training in tcs chennai
internship at chennai
r programming training in chennai
ReplyDeleteinternship in bangalore for ece students
inplant training for mechanical engineering students
summer internships in hyderabad for cse students 2019
final year project ideas for information technology
bba internship certificate
internship in bangalore for ece
internship for cse students in hyderabad
summer training for ece students after second year
robotics courses in chennai
nmd
ReplyDeletekyrie 3
golden goose
golden goose
yeezys
golden goose shoes
kevin durant shoes
moncler jackets
lebron shoes
jordan 1 off white
Check This Out more information read what he said sites Continue Reading read this
ReplyDeleteuse this link important site look at more info Related Site check out this site replica louis vuitton
ReplyDelete