Testing of Web Applications
Testing of Web Applications
Outlines
Introduction Challenges In Web Application Testing Functional and Non- Functional Testing Modeling Web-based Applications Architecture of Web application Testing Tool Techniques For Future Web Application Testing A Test Automation Framework Selenium Automated Testing Tool Conclusion References
Introduction
A web application is a system, with a client-server or
multi-tier architecture, with these characteristics. A wide number of users distributed all over the world and accessing it concurrently. Heterogeneous execution environments composed of different hardware, network connections, operating systems, Web servers and Web browsers.
Cont.
The main aim of testing a Web application is to
discover failures in the required services and verify the application behavior with specified requirements.
Due to large number of different elements and lot of
Internationalization issues such as language translations, time zone considerations, and currency conversions
For eg. in case of e-commerce Web application lots of issues like tax calculation,
Testing Environments:
Need duplicate production environment i.e. Web servers, application servers, and database servers to ensure the quality and test the Web applications.
Cont
Security:
Components developed by different vendors and integrated to the applications according to the business need. S0 this integration can also result the misfunctioning.
Compatibility issues:
Functional Testing
Checking that application is working as per the specifications.
Non-Functional Testing
Performance testing
o
Load testing o Stress testing Compatibility testing Usability testing Security testing Interface Testing
Load Testing
Measuring QoS performance based on actual
customer behavior Script recorder records the communication Load generator replay recorded scripts concurrently Hardware and software statistics will be monitored and collected . At last, all these statistics will be analyzed and a load testing report will be generated.
Log:
Request
Req1 Req2 Req3 Req4 Req5 Req6
URL
GET /login.jsp POST /verify.jsp GET /index.jsp GET /viewfolder.jsp GET /download.jsp GET /upload.jsp
Occurs
3 3 130 130 30 20
Req7
Req8 Req9
POST /upload.jsp
GET /delete.jsp GET /logout.jsp
20
10 2
Cont
General Session are view, download, upload and delete
we can easily get the proportion of all the General Sessions by these equations.
portion of a Web page that accepts data from the user through an HTML form.
Testcase Approach
Phase 1: Build a model of the Web application. Partition the Web application into clusters Define logical Web Pages Build FSMs for each cluster Build an FSM to represent the entire Web application Phase 2: Generate test from the model defined in phase 1 Generate tests as sequences of transitions Identify values for inputs
storing the W A model, test cases, and test logs, files of instrumented web pages, driver web pages, stub web pages, and test reports.
Services
Test Case Manager Driver and Stub Generator Code Instrumentation Manager
Test case design Testing documentation It also allows inserting, modifying, deleting, and browsing test suite, test case, and test log data.
produced by the Driver Generator on the basis of the test model and the test case descriptions stored in the repository
client and server web pages by inserting scripts in order to carry out a dynamic analysis of the W A when the test cases are executed.
This information will be stored into a tagged file and
of the instrumented web pages, and extracts the data items making up the test logs.
Compares the actual results against the expected
values of output variables, output actions, exceptions, and environment state obtained after the test execution
Report Generator:
web page The second report describes, for each web page, both the set of exercised components and the set of components that were not exercised during the test
Search-Based Testing
Uses search Algorithms to test data generation
Suitability of search algorithms for testing is based on
ability to produce effective solutions for complex and poorly understood search spaces with many dimensions Dimensions of the search spaces are directly related to the number of input parameters. Search-based testing can be improved by applying genetic programming to web applications
Steps
An appropriate fitness function is defined for the test
aim, and some search algorithm has been selected. An initial set of individuals (i.e., test data) is generated, usually at random For each testdata set test is executed and monitored and the fitness value is determined Test data with high fitness values are selected with a higher probability than those with a lower value
Cont
Then by combination and mutation processes new
offspring test data is generated. New population of test data is formed by merging offspring and parent individuals. The process repeats itself, starting with selection until the test objective is fulfilled or another given stopping condition is reached
Cont
A European project EvoTest has successfully applied search-based testing techniques to various real-world complex systems
Queues that fill up when some components are faster
than others, or the clients generate a lot of traffic Races between components resulting in different results for the same tests Deadlocks that occur due to a set of components
the same type of many applications, does not need so much modification. It should supporting a variety of Web browser for solving web applications compatibility across the browsers. It should provides testers with a simple interface. Testers should be able to configure different browsers conveniently for web application test.
TEST DATA
TEST CASE
TEST TYPE
TEST SCRIPT
TEST REPORT
Return Result
WEB APPLICATION
Translator
Translator has two levels. Translate the test case which
is prepared by tester to a tool test case which can be recognized by a specific test tool.
Get a translator name by getTranslatorName() To translate the testcase to a scope testcase with a
ActionWorker
This component creates a specific actionWorker and then performs specific actions. Gets a actionworker name by getActionWokerName()
Gets a actionworker instance by
getActionWorkerInstance()
Perform action by doAction()
Comparator
This component collects the test result and collects
expected result, and compares both Get an instance test result by collectTestResult() from the getTestResultCollectorInstance() with getTestResultCollectorName() To collect the expected result of the running test case by collectExpectedResult() Compare the test result with the expected result by compare() and then give the result of comparing.
WebLight-html link
ASPUnit-Asp Adobe Browser Labs Rational AppScan- IBM tool that supports automatic
Selenium Overview
Selenium is a framework for testing websites.
Selenium tests run directly in a browser A wide array of browsers supported by Selenium are
Internet Explorer, Mozilla Firefox on Windows, Linux, and Macintosh Selenium uses JavaScript to embed a test automation engine in the browser It work with any JavaScript-enabled browser Support for many other languages Java, Ruby, Python
Selenium Variants
Can be used in isolation or in combination to create complete automation suite for web applications.
Selenium Core:
A JavaScript library that can interact with the page, allowing automatically rerun tests against multiple browsers. That library eventually became Selenium Core
Selenium IDE Selenium Remote Control Selenium Web Driver
Selenium Grid
Selenium
IDE
CORE
RC
Record Mode
Selenium IDE
Firefox plug-in
Easy to generate test cases Provides record and playback functionality.
Limitations of IDE
Browser
Selenium IDE is only available for the Firefox.
Language
Selenium IDE can execute scripts created in Selenese
only.
state of the application, like click this link and select that option. If an Action fails, the execution of the current test is stopped. Accessors examine the state of the application and store the results in variables, e.g. storeTitle Assertions are like Accessors, but they verify that the state of the application conforms to what is expected, e.g. verify that this checkbox is checked.
Commands
open( url ) Opens a URL in the test frame. This accepts both relative and absolute URLs
click( elementLocator ) Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), use "clickAndWait".
Cont..
type( inputLocator, value ) Sets the value of an input field. Can also be used to set the value of combo boxes, check boxes, etc
select( dropDownLocator, optionSpecifier ) Select an option from a drop-down, based on the optionSpecifier
Select dropDown Australian Dollars Select dropDown index=0 selectAndWait currencySelector label=In*ian
Testsuite
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Sample Selenium Test Suite</title> </head> <body> <table cellpadding="1" cellspacing="1" border="1"> <thead> <tr><td>Test Cases for De Anza A-Z Directory Links</td></tr> </thead> <tbody> <tr><td><a href="./a.html">A Links</a></td></tr> <tr><td><a href="./b.html">B Links</a></td></tr> <tr><td><a href="./c.html">C Links</a></td></tr> <tr><td><a href="./d.html">D Links</a></td></tr> </tbody> </table> </body> </html>
goBackAndWait verifyTextPresent type type id=phone Welcome to My Home Page (555) 666-7066
Id=address1
delhi
50
Selenium Locators
id fastest method
name
link dom xpath slowest method
Example Execution
platforms. Acts as a proxy for web requests from them. Have client libraries for many popular languages Bundles Selenium Core and automatically loads into the browsers Automatically launches and kills browsers.
the class path. Unzip to any directory on your file system. Change directory to the Selenium Server on the command line or terminal.
Start Selenium Server(open command prompt, go to
Client libraries provide the programming support so that we can run Selenium commands from a program of our own design.
Different client libraries for supported languages.
Cont
Download Client Library(java)
Open any desired Java IDE (Eclipse, NetBeans,etc.) Create a java project
project as references. Run Selenium server Export test script from Selenium-IDE in any language and use for selenium-RC or learn API.
Example Execution
support for automation. How these direct calls are made and the features they support, depends on the browser
Selenium-RC worked the same way for each supported
browser. It injects JavaScript functions into the browser when the browser was loaded and then used its JavaScript to drive the AUT within the browser.
What is Selenium-Grid
Multiple tests can run at parallel against different
environment.
Limitations
If website has lots of Flash component, Selenium
automation is tricky. Automation of web page involving multiple frames. Testing functionality provided by third party tools out of scope of test automation tool. Performance testing can not be done.
Conclusion
All the testing aspects that are directly dependent on
the implementation technologies have to be adapted to the heterogeneous and dynamic nature of the Web applications. Web applications develops very rapidly. So it is urgent to improve the older testing techniques, so as to gain better quality and adaptability. Future work will address a further experimentation involving a wider set of web applications by using other testing coverage criteria .
References
1. Sneed,Harry M.,"Testing a Web application" IEEE International Telecommunications Energy Conference, INTELEC, Page(s):3-10, 2004 2. G. A. Di Lucca, A. R. Fasolino, F. Faralli, and D. Carlini., Testing web applications, IEEE International Conference on Software Maintenance(ICSM), pp310-319, 2002 3. Holmes, Antawan ; Kellogg, Marc, "Automating functional tests using Selenium ", Proceedings of Agile 2006 Conference, Page(s):269-275, 2006 4. F. Ricca and P. Tone!la, "Analysis and Testing of Web Applications", Proc.of International Conference on Software Engineering ICSE 2001, IEEE Computer Society Press,Page(s): 25-34, 2001 5. D. Lowe, B. Henderson-Sellers, Characteristics of Web Development Process, International Conference Advances in Infrastructure for Electronic Business, Science, and Education on the Internet. SSGRR 2001 6. Marn, Beatriz ; Vos, Tanja E J ; Giachetti, Giovanni ; Baars, Arthur I. ; Tonella, Paolo,"Towards testing future Web applications" IEEE International Conference on Research Challenges in Information Science (RCIS),Page(s): 1-12, 2011
References
9. Kuk, Seung Hak ; Kim, Hyeon-Soo, "Automatic Generation of Testing Environments for Web Applications "International Conference on Computer Science and Software Engineering,Page(s): 694 - 697, 2008
10. Xu, Lei ; Xu, Bao-wen,"A framework for Web applications testing", International Conference on Cyberworlds, Page(s): 300 - 305, 2004 11. Khanna, Rashmi,"A Test Automation Framework Based on WEB", IEEE/ACIS International Conference on Computer and Information Science (ICIS), Page(s):683-687, 2012
12. http://www.ibm.com/developerworks/library/wa-webapptesting
13. http://www.linuxjournel.com/artical/10601