Selenium Framework for Web App Testing
Selenium Framework for Web App Testing
3
[Link] Freshman engineering, K L University, Guntur Dist., AP, India.
4
Dept. of IST, K L University, Guntur Dist., AP, India.
Abstract environment (e.g. a Java applet) or coded in a browser-supported
Testing has become most important parameter in the case of language (such as JavaScript, combined with a browser-rendered
software development lifecycle (SDLC). The web application mark-up language like HTML) and reliant on a common web
testing is more complicated as it involves different testing strategies browser to render the application executable. Web applications are
and tools, because the tool has to support different characteristic popular due to the ubiquity of web browsers, and the convenience
properties and also different frameworks. Integration testing of using a web browser as a client, sometimes called a thin client.
focuses the verification effort on the smallest unit of software The ability to update and maintain web applications without
design, the software component or module using top-down or distributing and installing software on potentially thousands
bottom-up approach. of client computers is a key reason for their popularity, as is
The main objective of this paper is to propose a framework that the inherent support for cross-platform compatibility. Common
integrates or supports the architectural elements that have been web applications include webmail, online retail sales, wikis etc
already compared with respect to integration testing and finally
doing the same by using the testing tools like QTP, Win runner and Two (2) – Tier Web Application
Load Runner. In this paper, we have compared the architectures Two-tier architecture is client/server architecture, where a request
of two tools and have come-up with different possibilities that to do some task is sent to the server and the server responds by
are leading towards proposing a common framework. Also, in performing the task. A Two-tier architecture is a client/server
order to test any 2-tier web application with respect to Integration application. Client acts as Front End and Server acts as Backend
Testing test cases are required. Here, a framework is proposed like databases.
that satisfies the test requirements.
In our proposed framework, we have taken a tool Selenium under
integration testing and tested several web applications
Key words
Frame work, Web application, Selenium, test case, testing tool,
client, server.
Fig.1.2.3: Two-Tier Architecture
I. Introduction The two-tier model is the one that most computer users are familiar
This paper deals with the testing of Web Applications using a with; it’s the basic foundation of the Internet. Much of the Internet,
testing tool named Selenium under Integration Testing. The main from web browsing to e-mail, is based in some fashion on this
intension of the paper is to test several Web Application and also architecture. The web browser (client) sends a request to a web
to verify the errors if they are present in it. Several test cases server, which determines what the user is looking for and sends
and requirements traceability logs were also considered for this. the information back to the client. Two tier client-server design
derives its name from how it distributes work between client and
Terminologies: server. Clients access databases through the user system interface.
Database management, on the server side, distributes processing
Framework between both client and server. Both tiers, the client and the server,
A framework is a defined support structure in which another are responsible for some of the processing management. Simply
software project can be organized and developed. A framework put, the client uses the user interface to make requests through
may include support programs, code libraries, a scripting language database management on the server side.
or other software to develop different components of a software
project. A web application framework is a software framework that Client Tier
is designed to support the development of dynamic websites, web At the client level we have either a Java client application or a
applications and web services. The framework aims to alleviate web browser as the client. By using a web browser as the client
the overhead associated with common activities performed in Web allows the entire application to be located on the server. The client
development. For example, many frameworks provide libraries for always gets the latest version when they start the application. Also
database access, templating frameworks and session management the client can use any web browser from any location provided
etc and they often promote code reuse. that they can connect to the application server. The client tier
can also consist of an application running on the clients’ desktop
Web Application (usually presenting a rich user interface) and connecting directly
A web application is an application that is accessed over a network or through HTTP to the application server. This requires that the
such as the internet or an intranet. The term may also mean a client have the application installed on their desktop.
computer software application that is hosted in a browser- controlled
w w w. i j c s t. c o m International Journal of Computer Science and Technology 165
IJCST Vol. 2, Issue 3, September 2011 ISSN : 2229-4333(Print) | ISSN : 0976-8491(Online)
Clients Side Elements • You can view Selenium test scripts even in browsers
Html, xml, JavaScript, VB Script that don’t have the Selenium IDE/plug-in installed.
Server Tier : The server is the central computer who gives • Selenium Grid enables you to run tests in parallel on multiple
instructions to the client computer, to make sure everyone can servers reducing the time efforts
logon on any computer (client) can share the resources of sever
like information, peripherals etc The server allow/restrict the II Requirements
client computers to perform any task
Server Side Elements: JSP, ASP, Data Mgmt Components, Testing Requirements
Security Components and other Components like Communication • Select an integration group
Components • Define test conditions
• Determine lowest level module for each test condition
Integration Testing • Reassign condition according to testability
Integration testing (sometimes called Integration and Testing, • Select test conditions for a module's initial test
abbreviated “I&T”) is the phase in software testing in which • All test conditions assigned to a module Grouped into test
individual software modules are combined and tested as a group. cycles
It occurs after unit testing and before system testing. Integration • Construct integration test cycle dependency diagram
testing takes as its input modules that have been unit tested, groups • Estimate effort for testing a test cycle
them in larger aggregates, applies tests defined in an integration • Revise estimates on integration group dependency
test plan to those aggregates, and delivers as its output the diagram
integrated system ready for system testing Integration testing
is of two types Functional Requirements:
i) Top Down Integration In software engineering, a functional requirement defines a
Top-down integration testing is an incremental approach to function of a Software system or its component. A function
construction of program structure. Modules are integrated by is described as a set of inputs, the behaviour, and outputs (see
moving downward through the control hierarchy, beginning with also software).In general, functional requirements define what a
the main control module (main program). Modules subordinate system is supposed to do. Functional requirements are usually in
(and ultimately subordinate) to the main control module are the form of “system shall <do requirement>”. In our paper, the
incorporated into the structure in either a depth-first or breadth- Functional Requirements are Selenium tool, Firefox web Browser,
first manner. Web Application
ii) Bottom Up Integration
Bottom-up integration testing, as its name implies, begins Non – Functional Requirements:
construction and testing with atomic modules(i.e., components In systems engineering and requirements engineering, a non-
at the lowest levels in the program structure).Because functional requirement is a requirement that specifies criteria
components are integrated from the bottom up, processing required that can be used to judge the operation of a system, rather than
for components subordinate to a given level is always available specific behaviours.
and the need for stubs is eliminated. Non functional requirements can be divided into two main
categories 1. Execution qualities, such as security and usability
Objectives and Evolution qualities, such as testability, maintainability etc.
The main objective of this paper is to test any kind of web
application using an automated integration testing tool. We have Core Requirements:
chosen an Integration testing tool named selenium. Generated the • Browse urls
code in different languages that includes JAVA, C# etc. • Render web pages
1.4 Scope: The scope of the testing the Web Application using • Mimic User Actions
Selenium under Integration Testing is as follows: • Validate results
• The user can use any operating system, but should have • Ajax/CSS support
Firefox browser.
• The user should have Selenium tool to test the Web Pragmatic requirements:
Applications. • Language choices
• The user can get the coding in many languages like C#, • Platforms (Browser/OS)
JAVA, Ruby, Python, etc • JS toolkit support
1.5. Purpose: • Distributed tests
The purpose of testing web applications using Selenium because • Scheduled execution
of following features: • Reporting
• Even non-developers can develop tests in the easy-to-use, • Configurability
graphical Selenium IDE and export them as JUnit tests. • Build Integration
• You have a choice of target browsers to run the tests. • Test Creation Environment
Selenium supports browsers like Internet Explorer, Firefox
and Safari. This is in contrast to tools like HTMLUnit and System Requirements Specifications:
Canoo, which have their own implementations of a browser, Software Specifications:
or Watir/Watij, which always use Internet Explorer. Selenium • Operating System: Windows XP, MAC
supports Ajax calls. • Programming Language : C, CPP
• When a test fails, you can send an email with a Screenshot • Graphical User Interface : Java
of the browser. choosing selenium. • Documentation Tool : Ms Access
166 International Journal of Computer Science and Technology w w w. i j c s t. c o m
ISSN : 2229-4333(Print) | ISSN : 0976-8491(Online) IJCST Vol. 2, Issue 3, September 2011
Existing system:
The existing system is manual or usage of the automated testing
tools like win runner and load runner etc. Manual Testing takes
more time efforts for a window-based or a web-based application.
Even the automated testing tools like win runner have some
limitations. All the test cases that are related to the software
must be tested thoroughly in order to avoid the upcoming errors
during the execution of the software.
Proposed System:
In the proposed System, the process of testing can be implemented Fig. 4.1: Architecture of Selenium
in a different way with the help of integration testing tool Selenium.
Failures can be easily detected. Whenever the test case is executed, Working of the system: Selenium IDE
the code is converted into script in java. Our paper proposes a Selenium IDE is the only flavour of Selenium which allows you
framework with respect to some parameters that support the to record user action on browser window. It can also record user
integration testing and we also proposed a web application that actions in most of the popular languages like Java, C#, Perl, Ruby
can be going to be tested by using a testing tool i.e., Selenium etc. This eliminates the need of learning new vendor scripting
with respect to integration testing that helps to test the application language. For executing scripts created in these languages, you
and also helps to find the errors easily. will need to use Selenium Remote Control. If you do not want
to use Remote Control than you will need to create your test
scripts in HTML format. Selenium can be accessed from tool
--> Selenium IDE in your browser toolbar if the installation is
completed successfully. As compared to most of the test automation
tools it is very simple and lightweight. The small red button on the
right hand side gives you an indication on whether Selenium is in
recording mode or not. Also, Selenium IDE will not record any
operation that you do on your computer apart from the events on
Firefox browser window. So go ahead read your mail, open a word
doc or do anything else, Selenium will record only your actions
on browser. Other options present on the Selenium IDE toolbar
Fig.3.3 Proposed Architecture are related to test execution. Run will execute the tests with the
maximum possible speed, Walk will execute them with relatively
Feasibility Study: slow speed and in step mode you will need to tell Selenium to take
Feasibility is a measure of whether something can be done. small steps. Final button present on the Selenium IDE toolbar is
Feasibility also means that it can likely be completed successfully. the Selenium Test Runner. Test Runner gives you nice browser
Feasibility studies aim to objectively and rationally uncover interface to execute your tests and also gives summary of how
the strengths and weaknesses of the existing business or proposed many tests were executed, how many passed and failed. It also
venture, opportunities and threats as presented by the gives similar information on commands which were passed or
environment, the resources required to carry through, and failed. Test Runner is also available to tests developed in HTML
ultimately the prospects for success. Only. If you open the option window by going to Option, you
will see there are some self explanatory options available. For
IV. DESIGN example, encoding of test files, timeout etc.
Selenium RC
Architecture: Selenium RC allows the test automation expert to use a
w w w. i j c s t. c o m International Journal of Computer Science and Technology 167
IJCST Vol. 2, Issue 3, September 2011 ISSN : 2229-4333(Print) | ISSN : 0976-8491(Online)
Add the JUnit Tests to your Java project in your IDE and
run the tests.
Import [Link] and selenium-
[Link] into your IDE (Eclipse,
NetBeans, IntelliJ, etc.) project. Create a new JUnit4 test case
and add the code snippet above to your test method.
@RunWith([Link])
Fig. 4.2.1:Selenium IDE showing various steps in a test case @[Link] ({ [Link] })
2. Export tests created with the Selenium IDE as JUnit tests. public class SeleniumTestSuite extends TestSuite {
Selenium saves the test cases as HTML files. Here is a snippet private static SeleniumServer seleniumServer;
from a test case’s HTML file: public static Test suite()
<tr> {return new JUnit4TestAdapter ([Link]);}
<td>type</td> @BeforeClass
<td>text</td> public static void init() throws Exception{
<td>test</td> //Start selenium server
</tr> [Link](“***Starting selenium ***”);
<tr> RemoteControlConfiguration seleniumConfig=new
168 International Journal of Computer Science and Technology w w w. i j c s t. c o m
ISSN : 2229-4333(Print) | ISSN : 0976-8491(Online) IJCST Vol. 2, Issue 3, September 2011
V. Implementation
The implementation of the system is described in the following
steps
• Take a URL
• Record the Web Application
• Test the Navigations and hyperlinks
• Obtain the Results
BOOKS: [Link] received his MCA from IGNOU ,New Delhi and
1) Roger S .Pressman, ‘Software Engineering- A Practitioner’s [Link] in Computer Science and
Approach’, 5th Edition, McGraw Hill International. Engineering from Acharya Nagarjuna University
2) Practical software testing: a process-oriented approach By and presently pursuing the Ph.D. in K L
Ilene Burnstein. University, Guntur (Dist),AP, India. He is
3) Shari, Lawrence Fleeger, “Software Engineering – Theory working presently as an Associate professor in
and Practice”, Pearson Education Asia. the department of Freshman Engineering in KL
University .He is having 16 years Experience
WEBSITES: in Teaching in reputed institutions. His research
1) [Link] interests include Software Engineering, Datamining. He is life
2) [Link] member of professional bodies like CSI, ISTE. He taught various
3) [Link] subjects in computer science and engineering like software
4) [Link] engineering, computer organization, Database Management
5) [Link] systems, Cryptography and network security, Digital Logic
presentation design, UML ,OOPS etc.
6) [Link]
7) [Link]
8) [Link] T SubhaMastan Rao received his B-Tech degree in Information
Integration+testing+framework Science and Technology from Acharya
9) [Link] Nagarjuna University, Guntur (Dist), India in
Selenium 2001, the [Link]. degree in Computer Science
10) [Link] and Technology from Bharat University in
2008, and presently pursuing the Ph.D. degree
in Web Usage mining from Acharya Nagarjuna
Prasanth Yalla received his [Link]. Degree from Acharya University Guntur (Dist), India. He is working
Nagarjuna University, Guntur (Dist), India in as assistant professor, with Department of
2001,the [Link]. degree in Computer Science Information Science and Technology. His research interests
and Engineering from Acharya Nagarjuna include Testing tools and web usage mining. At present, He is
University in 2004, and presently pursuing the engaged in Data mining concepts and techniques.
Ph.D. in Web services and SOA from Acharya
Nagarjuna University, Guntur (Dist), India. He
was an associate professor, with Department of
Information Science and Technology in KL University, from 2004
170 International Journal of Computer Science and Technology w w w. i j c s t. c o m