This document was ed by and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this report form. Report 3i3n4
Overview 26281t
& View Testing Of Web Applications Ppt as PDF for free.
TESTING WEB APPLICATIONS Department of Computer Engineering National Institute of Technology, Kurukshetra
Presented By: Janardan Verma M.Tech 1’st Year 3125511
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 s 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 the application behavior with specified requirements. Due to large number of different elements and lot of
interdependent components, many challenges during the testing appears.
Challenges In Web Application Testing s :
Different skills sets, os, devices, connection speed etc Locales:
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,
shipping costs determination, transactions etc
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:
Open to world after deployment Integration:
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:
Due to browsers and integration
Functional Testing Checking that application is working as per the specifications.
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
URL
Occurs
Req1
GET /.jsp
3
Req2
POST /.jsp
3
Req3
GET /index.jsp
130
Req4
GET /viewfolder.jsp
130
Req5
GET /.jsp
30
Req6
GET /.jsp
20
Req7
POST /.jsp
20
Req8
GET /delete.jsp
10
Req9
GET /.jsp
2
Cont… •General Session are view, , and delete
•we can easily get the proportion of all the General Sessions by these equations.
Modeling Web-based Applications Models represent the components of the application under test and their interconnections. UML Model Finite State Machine Model
Meta-Model of a Generic Web Application
Model with a Form
Modeling Using FSM
A cluster is collections of Web pages that implements some logical function.
An LWP is either an entire physical Web page or the
portion of a Web page that accepts data from the 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
Top Level FSM SS: Student Services PS: professor Services „ TS: Teaching Assistant Services W0: Screen Off: Logoff
Node Cluster Explanation SS1: Select Service 1 - Menu of named services SS2: Select Service 2 - List of navigation buttons I: Info Form G: Grades - View Grades and Grades pages ‰ ETA: Email TS‰ EP: Email Prof H: Submit homework C: View course info Pages
Architecture Of Web application Testing Tool Interface: Implements interface providing the
access to the functions offered by the tool. Service: The service implements the tool services. Repository: It includes the relational database
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 Result Analyzer Report Generator
Test Case Manager:
Two main functions
Test case design Testing documentation It also allows inserting, modifying, deleting, and browsing test suite, test case, and test log data.
Driver and Stub Generator: It has set-up, execution and clean-up steps. These steps are performed using the driver web pages,
produced by the Driver Generator on the basis of the test model and the test case descriptions stored in the repository
Code Instrumentation Manager:
This component is responsible for instrumenting
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
used to evaluate the coverage obtained by the test execution.
Test Result Analyzer:
Parses the tagged files generated during the execution
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:
First report describes the list of components of the
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
Techniques For Future Web Application Testing Model-Based Testing Search-Based Testing
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
Test Automation Framework A automation framework should be compatible with
the same type of many applications, does not need so much modification. It should ing 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 CONFIG
TEST TYPE
TEST SCRIPT
Run Test Action
Return Result
WEB APPLICATION
TEST REPORT
Components of Automation Framework The integrated auto testing framework includes five components. Model Translator Actionworker Comparator TestresultCollector
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
specific translator name by getTranslatorInstance() and translate()
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 s automatic
test creation and modification. Cactus-Jsp test framework from Apache
Selenium Overview Selenium is a framework for testing websites. Selenium tests run directly in a browser A wide array of browsers ed 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 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
Record Mode
CORE
Bot Mode: HTML tables
RC
Driven Mode. Test Case in different Language
Selenium IDE Firefox plug-in Easy to generate test cases Provides record and playback functionality.
Provides the ability to debug test scripts. Auto complete common selenium commands. Export tests in different formats like Java, Ruby,
Python and so on. s extensions.
Limitations of IDE Browser Selenium IDE is only available for the Firefox.
Language Selenium IDE can execute scripts created in Selenese
only.
Selenium Commands – “Selenese” Actions are commands that generally manipulate the
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 that the state of the application conforms to what is expected, e.g. “ that this checkbox is checked”.
Commands open( url ) Opens a URL in the test frame. This accepts both relative and absolute URLs
Open /mypage Open http://localhost:8080/
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".
Click Checkbox ClickAndWait submitButton
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
Type nameField John Smith typeAndWait textBox something
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
Building Test Cases <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
NEW 5wu5s
NEW
open
/cyberspace/
clickAndWait
link=Domain Search
type
id=domain
asc
Testsuite
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Sample Selenium Test Suite 385928
Selenium Remote Control A server, written in Java and available on all the
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.
Install & Start Ensure that JDK is present on the machine and is in
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
directory where selenium-server.jar is present.
java -jar selenium-server-standalone-2.31.0.jar
Testing With Selenium-RC Client Libraries:
Client libraries provide the programming so that we can run Selenium commands from a program of our own design. Different client libraries for ed languages.
Cont… Client Library(java) Open any desired Java IDE (Eclipse, NetBeans,etc.) Create a java project
Add the selenium-java-
.jar files to
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
Selenium Web Driver Direct calls to the browser using each browser’s native
for automation. How these direct calls are made and the features they , depends on the browser Selenium-RC worked the same way for each ed
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
machines running different browsers and operating systems. It allows running tests in a distributed test execution
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. Marín, 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