Skip to content

Iptv Assist

Learn More from us

Menu
  • HOW TO
  • Firestick
  • Chromecast
  • PC Apps
  • Lg Smart TV
  • IPTV Services
  • Automation Testing
  • Smart TV
  • Software Testing Tools
  • Contact Us
Menu

Use of Maven Build Automation Tool and Maven Project Setup for Selenium – Selenium Tutorial #24

Posted on January 29, 2023

Best Iptv Service Provider 2023 With 40k+ Channels And 100k+ VOD . 24/7 Suppport . Paypal Supported

In our last Selenium tutorial, we learned a build tool named as “Apache Ant”. We also broadly discussed its applicability and importance besides the practical approach.

Best Iptv Service Provider 2023 With 40k+ Channels And 150k+ VOD . Hurry Up

In this Selenium Testing tutorial, we will learn Maven – a build automation tool which is distributed under Apache Software Foundation. It is mainly used for Java projects. It makes build consistent with another project.

Recommended IPTV Service Providers

  1. IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
  2. IPTVRESALE – Rating 5/5 ( 200+ Reviews )
  3. IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
  4. IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
  5. IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
  6. IPTVTOPS – Rating 5/5 ( 43 Reviews )

 

Maven is also used to manage the dependencies. For example, if you are using selenium version 2.35 and any later point of time you have to use some other version, the same can be managed easily by Maven. You will find more examples of this later in this chapter. It works very effectively when there is a huge number of Jar files with different versions.

Use of Maven Build Automation Tool and Maven Project Setup for Selenium

What You Will Learn:

  • What is a build tool?
  • Build Life Cycle:
  • Maven Setup:
  • Install maven IDE in Eclipse:
  • Build the Project:
  • Conclusion:

What is a build tool?

The build tool is used to set up everything which is required to run your java code independently. This can be applied to your entire java project. It generates source code, compiling code, packaging code to a jar etc. Maven provides a common platform to perform these activities which makes programmer’s life easier while handling the huge project.

Maven provides pom.xml which is the core of any project. This is the configuration file where all required information’s are kept. Many of the IDEs (Integrated Development Environments) are available which makes it easy to use. IDEs are available for tools like Eclipse, NetBeans, IntelliJ etc.

Maven stores all project jars. Library jar is in a place called repository which could be a central, local or remote repository. Maven downloads the dependency jar from a central repository. Most of the commonly used libraries are available in http://repo1.maven.org/maven2/.

Downloaded libraries are stored in the local repository called m2. Maven uses the libraries available in an m2 folder and if any new dependency added then maven downloads from the central repository to local repository. If libraries are not available in the central repository then maven looks for the remote repository. The user has to configure the remote repository in pom.xml to download from the remote repository.

Below is the example of configuring a remote repository to pom.xml file. Provide id and URL of the repository where libraries are stored.

<repositories>
     <repository>
         <id>libraryId</id>
         <url>http://comanyrepositryId</url>
     </repository>
</repositories>

General Phrases used in Maven:

  • groupId: Generally groupId refers to domain id. For best practices company name is used as groupId. It identifies the project uniquely.
  • artifactId: It is basically the name of the Jar without version.
  • version: This tag is used to create a version of the project.
  • Local repository: Maven downloads all the required dependencies and stores in the local repository called m2. More details regarding the same would be shared in the next topic.

Build Life Cycle:

Basic maven phases are used as below.

  • clean: deletes all artifacts and targets which are created already.
  • compile: used to compile the source code of the project.
  • test: test the compiled code and these tests do not require to be packaged or deployed.
  • package: package is used to convert your project into a jar or war etc.
  • install: install the package into the local repository for use of another project.

Maven Setup:

Step 1: To setup Maven, download the maven’s latest version form Apache depending upon different OS.

Step 2: Unzip the folder and save it on the local disk.

Step 3: Create environment variable for MAVEN_HOME. Follow the below step:

Navigate to System Properties ->Advanced System Settings>Environment Variable ->System Variable ->New ->Add path of Maven folder

Maven Tutorial 1

Maven Tutorial 2

Step 4: Edit path variable and provide the bin folder path.

Maven Tutorial 3

Step 5: Now verify the maven installation using command prompt and don’t forget to setup JAVA_HOME

Use mvn –version to verify maven version and output comes like below.

Maven Tutorial 4

Install maven IDE in Eclipse:

Maven provides IDE to integrate with eclipse. I am using eclipse Juno here.

Navigate to Help->Eclipse Marketplace-> Search maven ->Maven Integration for Eclipse ->INSTALL

Maven Tutorial 5

After installation, you have to restart eclipse.

Then right-click on pom.xml and verify all the options are available like below. 

Maven Tutorial 6

Create Maven project:

Step 1: Navigate to File- new-others-Maven-Maven Project-Click Next

Maven Tutorial 7

Step 2: Check the Create a simple project and click Next

Maven Tutorial 8

Step 3: Provide Group Id and Artifact Id.You can change the version of Jar as per your wish. Here I am using the default name. Click Finish.

Maven Tutorial 9

Step 4: After finish, you will find the project structure is created like below. pom.xml is created which is used to download all dependencies.

Maven Tutorial 10
pom.xml file looks like below:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.softwaretestinghelp.test</groupId>
<artifactId>com.softwaretestinghelp.selenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>

Step 5: Add dependencies for Selenium.

All selenium Maven artifacts are available in below central repository

http://repo1.maven.org/maven2/org/seleniumhq/selenium/

Add following dependencies in pom.xml for selenium

 <dependency>
       <groupId>org.seleniumhq.selenium</groupId>
       <artifactId>selenium-java</artifactId>
       <version>2.41.0</version>
 </dependency>

Similarly, following is the dependency for Junit :

<dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.4</version>
 </dependency>

If you want to add other third-party jars then add those dependencies in pom.xml

Step 6: Final pom.xml will be like below:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.softwaretestinghelp.test</groupId> <artifactId>com.softwaretestinghelp.selenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
       <groupId>org.seleniumhq.selenium</groupId>
       <artifactId>selenium-java</artifactId>
       <version>2.41.0</version>
   </dependency>
   </dependencies>
</project>

Step 7: Maven will download all the dependency jars into the local repository called .m2.

M2 folder is basically inside Users->username->m2

All the jars will be placed in a folder called repository which is inside .m2 folder. Maven will create separate folders for the different version and different group id.

Maven Tutorial 11

Step 8: If an m2 folder does not populate in Maven dependencies, then you can populate those jars manually.

– Eclipse Windows ->Preference
– Navigate Java->Build Path->Classpath Variables

Maven Tutorial 12

– Click New Button ->Define M2_REPO and provide the path of the m2 folder.

Step 9: Upon successful setup, you will find Maven Dependencies folder like below which will have the required dependency jar for the project

Maven Tutorial 13

Build the Project:

The project can be built by both using IDE and command prompt.

Using IDE you have to right click on POM-Run As-Maven Build

Maven Tutorial 14

Enter goals like clean install etc. and click Run.
Same can be done using a command prompt. Navigate to project folder where pom.xml lies.
And use below commands to clean, compile and install

For clean: mvn clean
For compile: mvn compile
For Install: mvn install

Below is the info which is displayed when you clean any project and shows “BUILD SUCCESS”.

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building com.softwaretestinghelp.0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
 [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ com.softwaretestinghelp ---[INFO] Deleting C:UsersrshwusWORKSPACEcom.softwaretestinghelptarget
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.702s
[INFO] Finished at: Sat May 24 18:58:22 IST 2014
[INFO] Final Memory: 2M/15M
[INFO] ------------------------------------------------------------------------

Conclusion:

Maven simplifies the code handling and process of building the project. Most of the projects follow maven structure.

Download all dependencies provided the dependencies are available in maven central repository. If any of the dependency is not available in maven central repository then you have to add repository path in pom.xml explicitly.

There are many other build tools available in like ant. But it is better to use maven while dealing with different versions and different dependencies. Maven even can manage the dependencies of dependencies. Other tools may not provide such flexibility like maven. Please post your queries anything related to maven here.

Next Tutorial #25: In the upcoming tutorial, we would discuss continuous integration tool known as Hudson. We would study about its importance, role and benefits into Test Automation Framework. We would look at the Hudson straight from the beginning, from its installation to its working.

Related

Best Iptv Service Provider 2023 With 40k+ Channels And 150k+ VOD . Hurry Up

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • IPTV List: Best iptv lista 2023
  • IPTV Premium: Best Premium IPTV Service Provider List And Benefits
  • Nikon IPTV Review: Over 10,000 Live Channels for $12/Month
  • Iptvwings. Com Review: +18000 Live IPTV Channels ,+70000 Movies, +40000 TV show For $15/1 month
  • IPTVUNO Review: More Than 16000 Live TV channels, 55,000 Movies & VOD For $15/Month

Recent Comments

  1. IPTV List: Play lista iptv 2022 - Iptv Assist on Best IPTV Player in 2023 for Watching Live TV
  2. Cola IPTV – Over 18,000 Live Channels for $12/Month - Iptv Assist on FileLinked – How to Install on Firestick/Fire TV and Android Devices
  3. Cola IPTV – Over 18,000 Live Channels for $12/Month - Iptv Assist on 50+ Best IPTV Service Providers for Streaming Live TV 2023
  4. XoomsTV IPTV – Over 11,000 Channels & VOD for Under $13/Month on Best VPN for IPTV in 2023 and How to Install on Firestick/Android
  5. Voodoo Streams IPTV Review – Over 12,000 Channels for $11/Month - Iptv Assist on Dynasty TV IPTV Review – Over 6,000 Channels for $10/Month

Archives

  • January 2023

Categories

  • Activate
  • Agile Testing
  • Alternatives
  • Android
  • APK
  • Apple TV
  • Automation Testing
  • Basics of Software Testing
  • Best Apps
  • Breakfast Hours
  • Bug Defect tracking
  • Career in Software Testing
  • Chromebook
  • Chromecast
  • Cross Platform
  • Database Testing
  • Delete Account
  • Discord
  • Error Code
  • Firestick
  • Gaming
  • General
  • Google TV
  • Hisense Smart TV
  • HOW TO
  • Interview Questions
  • iPhone
  • IPTV
  • IPTV Apps
  • Iptv Service SP
  • IPTV Services
  • JVC Smart TV
  • Kodi
  • Lg Smart TV
  • Manual Testing
  • MI TV
  • Mobile Testing
  • Mod APK
  • newestiptv.com
  • News
  • Nintendo Switch
  • Panasonic Smart TV
  • PC Apps
  • Performance Testing
  • Philips Smart TV
  • PS4
  • PS5
  • Python
  • QA Certifications
  • QA Leadership
  • QA Team Skills
  • Quality Assurance
  • Reddit
  • Reviews
  • Roku
  • Samsung Smart TV
  • Screenshot
  • Selenium Tutorials
  • Sharp Smart TV
  • Skyworth Smart TV
  • Smart TV
  • Soft Skills For Testers
  • Software Testing Templates
  • Software Testing Tools
  • Software Testing Training
  • Sony Smart TV
  • Sports
  • Streaming Apps
  • Streaming Devices
  • Tech News
  • Test Management Tools
  • Test Strategy
  • Testing Best Practices
  • Testing Concepts
  • Testing Methodologies
  • Testing News
  • Testing Skill Improvement
  • Testing Tips and Resources
  • Toshiba Smart TV
  • Tutorials
  • Twitch
  • Types of Testing
  • Uncategorized
  • Vizio Smart TV
  • VPN
  • Web Testing
  • What is
  • Xbox
©2023 Iptv Assist | Design: Newspaperly WordPress Theme