The Selenium WebDriver contents are moderate since they gone
through the program. There are numerous things that can enhance the Selenium
WebDriver contents' speed such as quick selectors, less locators, nuclear tests
etc.
The things that can enhance the Selenium WebDriver contents' speed
are as follows:
Utilize FAST
SELECTORS:-
Selenium WebDriver contents permit utilizing many sorts of
locators. While choosing the locator, begin with the quick ones:
1. look by ID
This works if the html component has the id property. It is the
quickest locator as it utilizes the document.getElementById() javascript order
which is streamlined for all programs.
2. NAME selector
This works if the component has a name property.
3. CSS selector
It is quicker than XPATH however not as adaptable.
4. XPATH selector
This is the most adaptable methodology for building locators. In
any case, xpath selectors are the slowest of all as the program dom of the site
page should be crossed for finding the component.
Utilize FEW
LOCATORS IN SCRIPTS:-
Keep the quantity of locators as low as conceivable particularly
if utilizing XPATH. This runs together with keeping contents engaged and short.
Make ATOMIC
TESTS:-
Abstain from testing excessively numerous things in a solitary
content. It is smarter to have all the more little contents concentrated on one
thing just than less huge contents that do an excessive number of things.
·
Each test should test a solitary minor piece of usefulness
·
Each test ought to have up to 20 stages.
·
Each test should keep running in less than 10 seconds.
Having nuclear test is extremely valuable if there should arise an
occurrence of disappointments. The disappointments are clear about where the
issue is.
Illustration:-
Let’s expect that one of the contents is called
testSignupLoginChangePasswordLogout().
This content checks 4 distinct things:
·
Information exchange frame works
·
Login works
·
Change secret word works
·
Logout works
In the event that the content falls flat, which part has a
mistake? Information exchange? Login? ChangePassword? Logout?
Rather, we should utilize littler and nuclear contents: testSignup(),
testLogin(), testChangePassword(), testLogout().
In the event that any of the littler tests falls flat, it is clear
where the issue is.
DONT TEST THE
SAME FUNCTIONALITY TWICE:-
Ensure that your contents are not looking at similar highlights
and over. In the event that you watched that the login works effectively in one
content, there is no advantage from checking it again in content.
Compose GOOD
TESTS:-
Great tests are made by following a couple of basic principles:
·
Great composed tests are quick tests.
·
Dispose of step duplication
·
Keep the contents free
·
Compose simply enough strides to go from A to B in the snappiest
way that could be available
·
Evacuate steps that are not identified with the last outcome
Utilize ONLY
EXPLICIT WAITS:-
A standout amongst other methods for making content quicker is by
utilizing just unequivocal holds up. The content execution is better with
express holds up as HTML components are gotten to when they end up noticeably
accessible. No extra holding up times are required.
Utilize THE CHROME
DRIVER AND CHROME BROWSER:-
On the off chance that you require a genuine program, utilize
Chrome and the Chrome driver. The Chrome program is quicker than IE, Firefox,
Safari and Opera. The same is substantial for the Chrome web driver.
Utilize
HEADLESS BROWSERS AND DRIVERS:-
On the off chance that you don’t require a genuine program or you
utilize constant combination, headless programs and drivers can make your
contents quicker. A headless program is a program that does not have a UI.
The most mainstream headless programs are HTML UNIT and Phantom
JS:
HTML UNIT
·
headless program written in Java
·
uses the RHINO motor; this isn't extraordinary as this motor isn't
utilized by any of the current genuine programs
·
provides javascript and ajax support and fractional rendering
ability
Ghost JS
·
headless program that uses the WEBKIT format motor for rendering
site pages and Javascript Core for executing scripted tests
·
the WEBKIT motor is utilized by genuine programs, for example,
CHROME and SAFARI
·
uses Ghost Driver as an execution of the WebDriver Wire Protocol
REUSE THE
BROWSER INSTANCE:-
A run of the mill JUNIT class incorporates the accompanying parts:
·
constructor
·
setUp() strategy
·
tearDown() strategy
·
test contents
The setUp() strategy utilizes the @Before comment and keeps
running before each test content. Its motivation is more often than not to make
the driver protest and open the program window. The tearDown() strategy
utilizes the @After explanation and pursues each test content. Its motivation
is to annihilate the driver protest and close the program window.
Each test content is utilizing its own particular program case
when the @Before and @After are utilized:
Try not to
LOAD ANY IMAGES IN THE WEBPAGE:-
Many site pages are exceptionally rich in pictures so they don't
stack quickly in the program. In the event that the page stacks quicker in the
program, the content will be speedier too. The page will stack speedier if no
pictures are stacked. This can be expert by setting up another profile for the
program and impair stacking pictures for it.
About Author:
Selenium
training in Bangalore is available at Infocampus.
Infocampus is an institute which can be a great step for freshers to get the
job in IT. It offers 100% placement assistance for candidates. Selenium
training will be provided by a professional expert and classes are focused
on practicals. Enquire at http://infocampus.co.in/best-selenium-testing-training-center-in-bangalore.html to get
more details on selenium
courses in Bangalore or contact 9738001024.
No comments:
Post a Comment