Using Maven with Selenium TestNG

Last updated on Nov 24 2021
Swaminathan M

Table of Contents

Using Maven with Selenium TestNG

Maven is that the latest build testing tool. it’s several new features as compare to Ant, like dependency, etc.
Maven may be a project build or project management tool. it’s wont to check the compilation issues between framework components whenever multiple test engineer integrates their files into an equivalent framework.
It always maintained the monitor, framework components, or build, and it provides build status modification, whenever modification happens within the framework.
It provides ‘build success’ message if no compilation issues within the framework alternatively provide ‘build failure’ message.
Maven has new features like dependency, which is employed to download the dependency jar from the web before the test execution.
With the assistance of Maven, we will execute the test scripts within the instruction without an eclipse. And it always provides the framework folder structure.
There are two software available in Maven:
• Maven Eclipse Plug-in
• Maven instruction plug-in

Page 2 Image 1 2
Maven

Maven Eclipse plug-in

It is a default plug-in for the newest Eclipse versions like Mars, Luna, oxygen, which is employed to make a Maven project through Eclipse.
Installing Maven plug-in for Eclipse and use it with Selenium TestNG
Most of the time, Maven plug-in is automatically installed within the Eclipse, but if it’s not present, we’ll attend the Eclipse Market Place and look for Maven and download the M2E integrated version from there.

Page 3 Image 2 2
Installing Maven

Steps to make Maven project
To create a Maven project, follow the below steps:
• Go to the File → New → Project

Page 3 Image 3 1
Maven project

• Then, expand the Maven folder and choose the Maven Project options, and click on on subsequent

Page 4 Image 4 2
Maven folder

• Again click on subsequent button for the further process.

Page 5 Image 5 1
New Maven Project

• Click on subsequent button without doing anything.

Page 6 Image 6 2
New Maven Project

• After click on subsequent button, we’ll provide the Group ID and Artifact ID in our case, and that we will give the Group id as MavenProject and Artifact ID as MavenProject, and click on on the Finish button as we will see within the below screenshot:

Page 7 Image 7
New Maven Project

• Once we are through with creating the Maven project, our Maven folder structure will appear as if this:

Page 7 Image 8
Maven folder structure

Maven instruction plug-in

It is wont to execute the Selenium test script within the prompt without an Eclipse, and this software should be installed explicitly.
Installation steps for Maven instruction Plug-in
To install the Maven instruction plug-in, follow the below steps:
Note: Before we’ll start the installation process of Maven, we’ll confirm that Java is installed and therefore the environment variable is additionally set.
Step1: Download Apache Maven
• First, attend Google look for Maven download and click on on the primary link, as we will see within the below screenshot:

Page 8 Image 9
Download Apache Maven

• Once we click on the link, it’ll navigate to the Maven community. And besides the Binary zip archive, click on the given link, as we will see within the below screenshot:

Page 8 Image 10
Navigate Maven community

• Download the zip folder, and then , unzip the folder and place it to the C drive, and replica the situation of the folder.

Page 9 Image 11
zip folder

Step2:
Add M2_Home within the System Variable
• Once we copy the situation , we’ll attend the Environment Variables window and click on on the New button on the System variable section, as we will see within the below image:

Page 10 Image 12
window

• After that, we’ll provide the Variable name and Variable value, and click on on the OK

Page 10 Image 13
Variable name value

Step3:
Add %M2_Home%\bin to the trail
• Once we create the M2_Home system variable, we’ll find the trail variable, and click on on the Edit button, as we will see within the below screenshot:

Page 11 Image 14
Trail variable

• The Edit variable window will appear on the screen, then we’ll click on the New button and %M2_Home%\bin value, and click on on the OK

Page 12 Image 15
window

Step4:
Verify
• After fixing the environment variables, we’ll check whether the Maven is installed successfully or not.
• For this, we’ll open the prompt and sort the below command:
1. mvn- version

Page 13 Image 16
Command prompt

• And we will see within the above screenshot the Apache is successfully installed.
So, this brings us to the end of blog. This Tecklearn ‘Using Maven with Selenium TestNG’ blog helps you with commonly asked questions if you are looking out for a job in Selenium and Automation Testing. If you wish to learn Selenium and build a career in Automation Testing domain, then check out our interactive, Selenium Certification Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:
https://www.tecklearn.com/course/selenium-training-certification/

Selenium Certification Training

About the Course

Tecklearn’s Selenium Certification Training enables you to master the complete Selenium suite. The Selenium Training is designed to train developers and manual testers to learn how to automate web applications with a robust framework, and integrate it within the DevOps processes of an organization. This Selenium Certification Training will also help you master important concepts such as TestNG, Selenium IDE, Selenium Grid, Selenium WebDriver, etc. Get hands-on experience on widely used automation frameworks such as Data-Driven Framework, Keyword-Driven Framework, Hybrid Framework, and Behavior Driven Development (BDD) Framework. Throughout this online Instructor-led Selenium Certification Training, you will be working on real-life industry use cases.

Why Should you take Selenium Certification Training?

• The average salary of a Selenium Test Automation Engineer is $94k per year – Indeed.com.
• Automation Testing Market is expected to grow at a Compound Annual Growth Rate (CAGR) of 18.0% in the next three years.
• Global software testing market to reach $50 billion by 2020 – NASSCOM. Selenium tool supports more browsers and languages than any other testing tool.

What you will Learn in this Course?

Getting started with Selenium

• Introduction to Selenium testing
• Significance of automation testing
• Comparison of Manual and Automation Testing
• Installation of Java JDK, JRE and Eclipse

Setting the environment in Eclipse for Selenium

• Java Introduction
• Creating a Java function and executing
• Concepts of Java
• Properties File
• Reading Data from Excel File
• Database Connection
• Hands On

Advantages of Selenium automation testing

• Selenium Features
• Concept of Selenium Integrated Development Environment
• Understanding of the Selenium IDE features
• Addition of Script assertions and general commands
• Deploying the first Selenium Script
• Sample project IDE
• Recording Selenium test case
• Hands On

Selenium Web driver Automation

• Architecture of Selenium Web Driver
• Download and installation
• Creating a Java function using Selenium and execution
• Hands On

Deploying Web Drivers for scripting

• Getting the HTML source of Web Element
• Table and Form Elements
• Firebug extension and Fire Path installation
• Advance User Interactions and Cross Browser Testing
• Hands On

Deep dive into Selenium Web Driver

• Action Commands
• Web Table / Date Picker
• How to Implement Switching Commands in WebDriver
• Alerts
• Frames
• Hands On

Switching Operations in WebDriver using Window

• Selenium Webdriver Wait
• Implicit wait, Explicit wait
• Deploying searching elements using the link text, name, using XPath
• Calendar
• Hands On

Introduction to TestNG Framework

• Introduction to TestNG
• Advantages of TestNG
• Installing TestNG on Eclipse
• Rules to write TestNG
• TestNG Features
• Annotations
• Grouping
• Sequencing: Prioritization and Dependency
• Enable/Disable a test case
• Parameterization: Using Xml file and DataProvider
• Parallel Testing & Cross Browser Testing
• TestNG Report: HTML Report, Console Report, XML Report

JUnit Operations and Test Framework

• Annotations, Methods in JUnit
• Junit Test Suites, ANT Build and JUNIT reporting
• Types of Test Automation Framework
• Module Based Testing Framework
• Data Driven Testing Framework
• Keyword Driven Testing Framework
• Hybrid Driven Testing Framework
• How to implement Testing Framework in Project

Object Repository

• Understanding of Object Repository
• Learning sample scripts using object repository
• Page Object Modelling
• Page Factory

JavaScript Functions

• Autosuggestion
• Headless Browser
• Sikuli
• XPath

Got a question for us? Please mention it in the comments section and we will get back to you.

0 responses on "Using Maven with Selenium TestNG"

Leave a Message

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