Weitere ähnliche Inhalte Ähnlich wie 7 Effective Practices to Follow for Selenium Automation Testing (20) Mehr von TestingXperts (20) Kürzlich hochgeladen (20) 7 Effective Practices to Follow for Selenium Automation Testing1. To know more about our services
please email us at
info@testingxperts.com
www.TestingXperts.com
UK | USA | NETHERLANDS | INDIA | AUSTRALIA
© 2018 TestingXperts, All Rights Reserved
ScantheQRCode
tocontactus
© www.testingxperts.com
Selenium as a test automation tool is available as open- source, shows efficiency, repeatability,
and has ease of usage; it continues to be the most preferred for test automation. Primarily, it is
used for automating web applications as it is quick and easy to use record and playback features.
The other major advantage with selenium testing is that, tests can be coded in multiple
programming languages and executed across various web browsers (Cross-browser support)
and operating systems.
This is a popular test automation design pattern that helps to develop robust testing frameworks
which are resistant to any small tweaks made in the user interface. The major benefit with this
page object model is that it enhances test maintenance and reduces the duplication in code. In
these models, the web pages are defined as classes and the different elements on the page
become the variables and the user interactions are commonly implemented as methods. The
POM frameworks are comparatively more reliable and are easy to maintain. The scripts are
readable and the test scripts are reusable. It also eliminates duplicity altogether and hence POM
is preferred over other models.
Perform action on
the HTML element
Run tests and
record the test
results using a
selenium driven
test automation
framework
Create an instance
of the WebDriver
interface
Navigate to
the Web page
Basic Steps for Selenium Testing include:
An Overview of the 7 Best Practices to Follow to
Achieve Effective Selenium Automation Testing
STEP - 1 STEP - 2 STEP - 3
7 Effective Practices
to Follow for Selenium
Automation Testing
Test conclusion with
a Quit () method
Get hold of Browser
response through
implicit and explicit
waits
STEP - 4 STEP - 5 STEP - 6
Adopt Page Object
Model (POM)
Use Selenium for System
Functional testing
Prefer to Use Java
Runtime Environment
(JRE):
Ensure proper
communication between
QA, Developers, and
Operations teams
Prefer to use Wait
command in place of
Thread. Sleep
Adhere to usage of
Right Locators
Keep the Tests
Independent of
Each other
ADOPT PAGE OBJECT MODEL (POM)
At the heart of selenium frameworks is interaction with the browser letting to navigate, click, type,
and check different objects and it achieves this using different types of locators. The different
types of locators include Class, ID, Link Text, Xpath, CSS Selector and Tag Name. Thus, selecting
the right locators can be the difference between a test script that is flexible enough and a brittle
test that breaks with any slightest change made to the user interface.
ADHERE TO USAGE OF RIGHT LOCATORS
Atomic testing strategy wherein testing a single action or process is independent of the other.
This type of testing avoids chained and brittle tests. Hence tests should be kept as small as
possible especially with agile and Continuous integration DevOps models on the go it is always
suitable to maintain small tests.
KEEP THE TESTS INDEPENDENT OF EACH OTHER
It is always preferred to use Wait command and it is more important to understand the usage of
implicit wait and explicit wait instead of using the Sleep command. This Sleep command waits
until the defined time even after the task is completed; while wait command performs the actual
time to wait. Sleep command slows down the test while with the Wait, the test time is not
affected.
PREFER TO USE WAIT COMMAND IN PLACE OF THREAD. SLEEP
Selenium is best suited when the same test and same code is used for different inputs. It is most
preferred for system functional testing as well as for browser compatibility testing.
USE SELENIUM FOR SYSTEM FUNCTIONAL TESTING
The Selenium server is programmed with Java and hence when if any run time error is
encountered, it is important to use the latest version of JRE 1.6.
PREFER TO USE JAVA RUNTIME ENVIRONMENT (JRE)
With the agile and DevOps methodologies on the go, it is important to have proper collaborate
between various teams of QA, developers and operations teams to achieve successful selenium
testing.
ENSURE PROPER COMMUNICATION BETWEEN QA,
DEVELOPERS, AND OPERATIONS TEAMS