Sie sind auf Seite 1von 5

"Selenium overview"

Automate or not to automate?


Automation has specific advantages for improving the long-term efficiency of a
software team’s
testing processes. Test automation supports:
• Frequent regression testing
• Rapid feedback to developers during the development process
• Virtually unlimited iterations of test case execution
• Customized reporting of application defects
• Support for Agile and eXtreme development methodologies
• Disciplined documentation of test cases
• Finding defects missed by manual testing

Test automation for web application


In an era of continuously improving software processes, such as eXtreme programming
(XP) and Agile, it can be argued that disciplined testing and quality assurance practices
are still underdeveloped
in many organizations.Software testing is often conducted manually.
Test automation means using a tool to run repeatable tests against
the target application whenever necessary.
There are many advantages to test automation. Most are related to the repeatability of
the tests and the
speed at which the tests can be executed.

Selenium is possibly the most widelyused


open source solution. This user’s guide will assist both new and experienced Selenium
users in
learning effective techniques in building test automation for web applications.
Introducing Selenium
Selenium is a robust set of tools that supports rapid development of test automation for
web-based applications.
Selenium provides a rich set of testing functions specifically geared to the needs of
testing of
a web application.These operations are highly flexible, allowing many options for locating
UI elements
and comparing expected test results against actual application behavior.

One of Selenium’s key features is the support for executing one’s tests on multiple
browser platforms.

Selenium-IDE
Selenium-IDE is the Integrated Development Environment for building Selenium test
cases. It operates
as a Firefox add-on and provides an easy-to-use interface for developing and running
individual test
cases or entire test suites. Selenium-IDE has a recording feature, which will keep
account of user
actions as they are performed and store them as a reusable script to play back.

Although Selenium-IDE is a Firefox only add-on, tests created in it can also be run
against other
browsers by using Selenium-RC and specifying the name of the test suite on the
command line.

Selenium-RC (Remote Control)


?
Selenium-RC provides an API (Application Programming Interface) and library for each
of its supported
languages: HTML, Java, C#, Perl, PHP, Python, and Ruby. This ability to use Selenium-RC
with a highlevel
programming language to develop test cases also allows the automated testing to be
integrated with
a project’s automated build environment.

Selenium-Grid
Selenium-Grid allows the Selenium-RC solution to scale for large test suites or test
suites that must
be run in multiple environments. With Selenium-Grid multiple instances of Selenium-RC
are running
on various operating system and browser configurations, each of these when launching
register with a
hub.

Flexibility and Extensibility


You’ll find that Selenium is highly flexible. There are multiple ways in which one can add
functionality
to Selenium’s framework to customize test automation for one’s specific testing needs.
This is, perhaps,
Selenium’s strongest characteristic when compared with proprietary test automation
tools and other open
source solutions.....
SELENIUM BASICS
Getting Started – Choosing Your Selenium Tool

Most people get started with Selenium-IDE. This is what we recommend. It’s an easy
way to get familiar with Selenium commands quickly.
You may also run your scripts from the Selenium-IDE. It’s simple to use and is
recommended for less technical users. The IDE allows developing and running tests
without the need for programming skills
as required by Selenium-RC.
If one has an understanding of how to conduct manual testing of a website
they can easily transition to using the Selenium-IDE for both, running and developing
tests.

Some testing tasks are too complex though for the Selenium-IDE. When programming
logic is required Selenium-RC must be used. For example, any tests requiring iteration,
such as testing each element of a variable length list requires running the script from a
programming language. Selenium-IDE does not support iteration or condition statements.

Finally, Selenium-Core is another way of running tests. One can run test scripts from a
web-browser using the HTML interface TestRunner.html. This is the original method for
running Selenium commands.
It has limitations though. Similar to Selenium-IDE, it does not support iteration.
Selenium-Core also cannot switch between http and https protocols. Since the
development of Selenium-IDE and Selenium-RC, more are using these tools rather than
Selenium-Core.

Introducing Selenium Commands


Selenium Commands – Selenese

Selenium provides a rich set of commands for fully testing your web-app in virtually any
way you may imagine. The command set is often called selenese. These commands
essentially create a testing language.
In selenese, one can test the existence of UI elements based on their HTML tags, test
for specific content, test for broken links, input fields, selection list options, submitting
forms, and table data among other things. In addition Selenium commands support
testing of window size, mouse position, alerts, Ajax functionality, pop up windows, event
handling, and many other web-application features.
A command is what tells Selenium what to do. Selenium commands come in three
“flavors”: Actions, Accessors and Assertions.

• Actions are commands that generally manipulate the state of the application. They do
things like “click this link” and “select that option”. If an Action fails, or has an error,
the execution of the current test is stopped.
Many Actions can be called with the “AndWait” suffix, e.g. “clickAndWait”. This suffix
tells Selenium that the action will cause the browser to make a call to the server, and
that Selenium should wait for a new page to load.

• Accessors examine the state of the application and store the results in variables, e.g.
“store Title”. They are also used to automatically generate Assertions.

• Assertions are like Accessors, but they verify that the state of the application
conforms to what is expected. Examples include “make sure the page title is X” and
“verify that this check box is checked”.

Das könnte Ihnen auch gefallen