Document not found! Please try again

Dynamic Content Testing of Web Application ... - IET Digital Library

13 downloads 329 Views 219KB Size Report
ABSTRACT. Dynamic Content of a Web Application gives acclivity to whole set of new challenges in the field of web application testing. After canvassing several ...
Dynamic Content Testing of Web Application Using User Session Based State Testing Anuja Arora1, Madhavi Sinha2 1

Jaypee institute of information technology, Noida, India [email protected] 2 Birla Institute of Technology, Mesra, India [email protected]

sharing and proposal review, and medical activities such as expert-system based diagnoses [5].

ABSTRACT Dynamic Content of a Web Application gives acclivity to whole set of new challenges in the field of web application testing. After canvassing several approaches on how to effectively test Dynamic Web Applications, We found that an effective way to counter the web application dynamic content testing exceptions is using the combined approaches of state-based testing and user session based testing. In this research work, we projected a novel approach User Session based State Testing to test the Dynamic Content of a Web Application that can walk through different states of a highly dynamic web application, create a model of the active user session navigational paths and illustrate the dynamic content by means of State Machine. The proposed model captures precisely the distinctive features of the dynamic content of a web application of changing DOM manipulation. User session based state testing technique makes it possible to test and detect faults like asynchronous communication fault, interaction faults, response faults, navigation faults and functionality faults.

Modern web applications are sophisticated, interactive programs with complex GUIs and numerous backend software components that are integrated in novel and interesting ways. Web applications have been deployed at a fast pace and helped in fast adoption but decreased in quality; therefore, all entities of web application must be tested. In order to make web based application to be widely and successfully adopted, testing methodologies must be flexible, automatic, and be able to handle their dynamic nature [3]. Web applications are much more complicated than simple HTML Web pages, and consist of more than just the front-end graphical user interfaces that users see. HTML is only used to build GUIs as frontends to arbitrarily complicated back-end software applications. The back-end software has been growing in size and complexity in relation to the user interfaces, and is continuing to do so. Technology used to design this kind of application is ‘AJAX’. AJAX designed dynamic applications are based on asynchronous requests, which leave the user interface active and responsive, combined with the possibility to update a page dynamically through the DOM (Document Object Model). In fact, reloading the web page after each user event is not adaptable access, Ajax offers the advantage to perform server calls and document upgrades in the background, without reloading. Ajax applications are usually composed of Java script code and Document object model which splits the web document in to hierarchical tree of objects Interoperability is ensured by the XML serialization of message passing through the network [16].

KEYWORDS Web application testing, state based testing, user session based testing. 1. INTRODUCTION Web testing is the name given to software testing that focuses on web applications. Complete web application testing before going live can help in addressing web feature error issues before the system is revealed to the public. Web application testing tools are used to test web applications and web related interface. These tools are used for performance, load and stress testing of web applications, web sites, web servers and other web interfaces. Web testing is useful for checking bottlenecks and performance leakage in the website or web application being tested. There is a growing need for web testing because web applications are among the fastest growing classes of software systems in use today. These applications are being used to support a wide range of important activities: business functions such as product sale and distribution, scientific activities such as information

Indeed, Web testing has long been recognized as a hard task. With the advent of Ajax which involves extreme dynamism, novel problems add to those already known in the Web testing area. The dynamic page updates through the DOM may also introduce page elements (e.g., forms and submit buttons) which turn out to be sources of faults. A web page containing dynamic content can change in response to user interactions or asynchronous messages received from the server. Due to these freezing testing points of web technology, Ajax application requires especially an intense testing technique. Existing web

Ƈ 22 Ƈ

reveal faults otherwise unnoticed or very hard to detect using existing techniques.

testing technologies are not designed to address the specific testing features of dynamic web applications. Although testing itself is a tough task, Ajax testing poses new challenges, mainly use of DOM, of serialization using XML, and of application allocation on both server and client side.

2. RELATED WORK Different Kinds of approaches are developed for testing of Ajax application. As mentioned in above section, Ajax testing raises several issues which are addressed by researchers. Some Ajax testing work has been done by Marchetto[10,11], Mesbah[7, 9] and Sébastien [16].

Mesbah [15] proposed an “Invariant based Automatic testing of AJAX user interface”. In his work, first task was crawling of the AJAX application using CRAWLJAX tool [13], simulating real user events on the user interface and infer the abstract model from state flow graph .This CRAWLJAX tool design state flow graph of all(client side) user interface states. Mesbah identified AJAX specific faults that can occur in such states. In this work automatically generating test cases from the path discovered during crawling process. Mesbah testing AJAX states through invariants. He suggested further AJAX research topic in his paper research issues in the automated testing of Ajax applications [16]. Out of all research issues one issue is to automatic invariant detection [9]. His invariant based testing was dependent on CRWLAJAX and in current research issues described in his paper best path seeding practice in web application is capture and replay which was not used in his work [9]. He also proposed in his latest work that invariant based testing is a weak form of an oracle, which can be used to conduct basic sanity check on the DOM-tree or transition in the derived GUI state machine [16].For dynamic extraction of states best approach is using any capture and replay tool like Selenium [4] otherwise AJAX is too dynamic that not able to test that correctly. Sebastian’s [16] work introduces a method and architecture for Automatic Ajax application testing. Sebestian has used STS automata for describing the application and for generating test cases. This technique is not able to generate test cases of several simultaneous server calls for that capture replay tool has been used here.

In Marchetto’s work[10], Ajax applications are modeled by state based machine where transition represent callbacks modifying the web page. Marchetto’s work was mainly concerned to identify sets of “semantically interacting” events sequence, used to generate test suite of test cases [8]. His intuition was that longer interaction sequences have higher faults. The Conducted experiments showing that longer interaction sequence have higher fault exposing capability.This technique generates high number of test cases involving unrelated events, for minimizing test cases using notion of semantically interacting events. Marchetto’s main contribution was for analysis of ‘semantically interacting’ events sequence and result proves that more faults at the time of long interacting sequence analysis [12]. Sequences of semantically interacting events in the model are used to generate test cases once the model is refined by the tester. Marchetto proposed state based testing technique is based on analysis of all the states that can be reached by client side pages of the application during its execution. State based technique results indicate that state based testing is powerful and can

Our approach is similar to Marchetto’s approach, we are illustrating web application using state machine model to generate test cases. Marchetto used traces of the application to construct a finite state machine. His state based test case generation technique was based on the dynamic extraction of finite state machine for a given AJAX application. Whereas in Marchetto’s work, dynamic analysis was partial, using manual validation or refinement steps for model extraction. He accepted in his work that FSM recovery needs an improvement and is an unexplored area. This same problem identified by Mesbah also and he also discussed in his research that one open issue in AJAX testing is automatic invariant detection. Dynamic extraction of states is quite tough to explore and needs constant attention in AJAX testing. In Marchetto’s work, dynamic extraction of states was manual and needs a proper approach. There is a need for Automatic Dynamic analysis for model construction. Therefore, in this research work attempted research problem is mainly how to automatically extract dynamic states of an Ajax web application and generate test cases from extracted state machine model.

In this paper, main concern will be to test web application functionality implemented using AJAX web application. One way to access the AJAX challenges is crawling of the web application and modeling its various DOM mutation event using a SM (Finite State Machine) that can automatically walk through different states of a highly dynamic site, create a model of the navigational paths and states, and generate a traditional linked page-based static version [1,2,5]. This technique is based on the dynamic generation of a finite state machine for a given Web application and its analysis used to generate suites of test cases. User session based state testing identify faults effectively, this has been validated with the help of test case execution and detection of faults injected on various head rush book examples and able to reveal faults related to incorrect DOM manipulation and asynchronous communication. In this research paper primarily tries to detect faults associated with incorrect DOM manipulation and partial asynchronous communication faults.

Ƈ 23 Ƈ

In this Research work we are linking selenium generated user session log file with dynamically extracted data fetched using Document object model tree and finally GV Edit tool is used to show generated state machine by loading tool supported state machine text file. Combination of Selenium and DOM brings the advantage to handle the specification with different point of view.

3. FSM MODELING OF A WEB APPLICATION Different testing techniques may be developed for Ajax web application testing. In this research work, initial experiment to model DOM tree invariants in finite state machine has been performed. Model DOM invariants in form of finite state machine is in fairly weak form of oracle and as found in researchers work that for dynamic extraction of state based approach best path seeding practice is using capture and replay tool, In our work we are using Selenium, Capture Replay tool for dynamic extraction of states. Modeling these Dom invariants and dynamic extraction of states was a troublesome task. Prime focus of this research work is to give a sanity check to the finite state machine construction work with the help of extracted DOM invariants and dynamic states. Steps for constructing Finite state machine are as follows:

3.2 Infer State Machine This section is all about efficient user session based state machine generation of chosen AJAX web application under test. The underlying idea has been implemented in the tool called USSMG (User Session based State Machine Generator). USSMG Tool containing various subparts like: User Session Recorder, DOM tree generator, State machine Generator. We have performed many experiment on AJAX web application to check overall performance of USSMG tool, evaluated the efficiency in retrieving all states, events, dynamic elements and their relationships. In the remainder of this section, we discuss the framework’s major components: User session recorder, Dynamic Object Model tree generator, and state machine generator. Finally, the focus will be on the test-case generation, replay test suite and fault detection in the web application. The steps to model finite state machine of dynamic behavior of the web application are as follows:

3.1 Model Extraction A multipart architecture has been developed, to build a formal and a comprehensive state machine of a dynamic web application as shown in figure1. This testing process tests message passing between both the client and the server. Ajax applications are composed of both client and server applications. The client side calls the server once events has been triggered and then modify the document as per response. In particular, the focus and prime concern is on the server calls those are linked with client side trigger means response is linked with the request.

3.2.1 Choose Target Web Application to Test The sample web applications selected are Ajax powered applications from head Rush Ajax book. This website supports various Asynchronous programming applications that make web site a smooth, slick, responsive application.

This extends from web application to modeling its various DOM mutation event in state machine. During test case generation, we divided user session in various parts and each part is considered in isolation. To conventionally test Ajax web application, we are using state machine. State machine entirely can represent and define user session performed on a web application. Generated test cases through progressively generated state machine are able to reveal faults in web application under test (WAUT).

Various applications of this web site has been used for generating state machine of chosen web application and for generating test cases for extreme dynamism of specified web application. As a sample dynamic web application selected program are Head Rush Ajax [15] book sample codes. Here shown state machine generation experiment is on an AJAX powered coffee maker application.

In this research work, proposed architecture is used to test certain area of any web application that progressively can test dynamic content of that chosen web application. This architecture generates a state machine of user triggered events on a web application and test server response of clicked client request. For this, we configured Selenium tool for user session log file and GV Edit tool for showing Finite State Machine. To execute test cases, we used Selenium tool. Selenium tool is a capture-reply tool and to simulate web application to state machine generator, we used set of command available in selenium tool. Selenium can be applied to test AJAX, since it provides a set of specific commands—e.g., waitForText, waitForCondition, and waitForSelection.

Ƈ 24 Ƈ

3.2.2 Create DOM Tree Inspector The Document Object Model is a platform- and languageneutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents. The client side is usually composed of HTML, CSS, Java script and DOM (Document Object Model). HTML and CSS codes are used to display web content in a navigator. DOM and Java script code is used to send and receive message and to handle dynamic changes of document as a per change in hierarchical structure of objects (form, input , div). Usually code is gathered in javascript function and this function performed when an event is trigged like

The document can be further processed and the results of that processing can be incorporated back into the presented page. The Dynamic objects are extracted from the required web application file and the DOM tree is constructed. Designed DOM Tree of coffee maker example is shown in figure2. Here Validating DOM is also possible. Malformed HTML code can induce many errors, faults and browser portability issues also. To prevent Faults, we checked and tested effectively that generated DOM tree is a valid DOM of chosen web application.

onMouse(), onclick () etc. Data located on an initial DOM object are used to construct the request sent to the server. Dynamic web application depends on asynchronous requests, which leave the user interface active and responsive, combined with the possibility to update a page dynamically through the DOM (Document Object Model). When client receives a response, it updates the web document by modifying one or more DOM objects.

Target web page

Web browser to open Web application on Mozilla Firefox

Page Content

Selenium IDE DOM Tree Inspector (Hierarchical form of Dom viewer)

Extract all elements change state as input

that

can

User session

Collect all application execution traces. Extract dynamic content and complete path of those dynamic content from DOM

GV Edit tool

Finite state machine of web application

Record user session of web page, create user session log file

Link user session log files with dynamic extracted data and generate FSM txt file

Dynamic content with complete path is input for next stage

Fig. 1. Flow diagram of state machine generation process application, data is stored in log file and these log files are used as input in extracting dynamic content from the DOM tree. The application execution is traced and the execution is recorded in a log file. Execution traces can be traced using log files generated by real user interaction. Here using selenium tool generated log files, Execution traces exist in log file contains information about DOM states and call back. One problem exist in this system is state explosion problem. As we know no of possible concrete states are huge and unbounded so can cause state explosion problem. State space reduction problem has been solved by generating state machine only of user session traces of chosen web application. This is automated process for extracting dynamic states for model construction using user session tool selenium and generated Dom tree. In AJAX applications, the state of user interface is extracted dynamically, So with the help of Selenium tool user triggered event driven changes in the Selenium generated XML files are visible after executing the linked Java Script code. Dynamically generated Dom state does not link automatically with the browser’s history. Here in generated Tool, collected all application execution traces using selenium generated XML file as input and then matching user session events with DOM viewer. Finally extract dynamic events, other dynamic tags and complete DOM path of those dynamic events and tags from DOM viewer

Fig. 2. Tool implemented Dom Tree of Coffee maker application example of head rush Ajax book 3.2.3 Generating user session log files using Selenium Selenium Tool is used to record user semantically interacting user events carried out on the sample web

Ƈ 25 Ƈ

3.2.4 Extract Dynamic Content of Chosen Application The designed DOM viewer is collection of all DOM inspector elements of a HTML page like table, form, input etc. All these variables represents states for chosen web application state. These inspector elements are automatically selected on the basis of user session based log files generated using Selenium tool. These inspectors will be the DOM element that will be used to measure and assess the states of the application. The extracted DOM changing element and corresponding event are displayed in Figure3. With the aim of selecting the set of inspectors, an enriched DOM-viewer is implemented. The viewer is a JTree in which the complete list of HTML elements of the current page and ordered list of HTML tag related to the element of the DOM structure of the target page is displayed. The graphical user interface event selection, all those events that can change states of selected mutator elements. These elements are selected with the help of DOM viewer and after effect of events has been fetched using selenium tool user session log file.

Fig. 4. Finite State Machine of user triggered events on coffee maker application 4. TEST CASE GENERATION In proposed approach, the focus is on automating the process of capturing user session traces using Selenium, and dynamically changing behavior using DOM inspector tool, model state machine and then generate test cases using modeled state machine. In this section, we explain how to derive test cases from generated state machine and how implemented state machine structure is useful in driving test cases for dynamic paths of a highly dynamic web application. Here for traversing state machine using all pair shortest path algorithm. Each time a shorter path from intermediate node to target node is found and the middle nodes that provided the minimum is saved. To print the intermediate nodes on the shortest path a recursive procedure that prints the shortest paths from index and kth node and from kth node to target node can be used. For test cases of a particular user session, we have saved middle paths using capture/ replay tool selenium. Using all pair shortest path algorithm, we can easily cover all transition.

Fig. 3. Extracted dynamic events and all other dynamic tags and complete paths of state change.

Further, Selenium captures the sequence of user session traces i.e. sequence of events from the initial state to target state of node. Our proposed state machine model, each state include state id, event status of that particular state, event fired on a particular state and finally the content that event carrying at the time of reaching to the target state. The state of event access the DOM and fetch event type and event information also of resulting state after each event fired and content of that particular event. After each event invocation the resulting state in the browser is compared with the expected state stored in the database. The comparison can take place at different levels of abstraction ranging from textual to schema-based similarity [15]. Here this approach is applied on three web applications: Board ‘R’ Us, Ajax powered coffee maker, Break Neck pizza.

3.2.5 Generate FSM Generated FSM test file based on the execution trace of user session data. By using the collected execution traces of the user session log files, the Finite State Machine of the sample Web Application is constructed whose states are the states of which represent Document Object Model (DOM) instances and the transitions of which represent the effects of callback executions. The generated FSM text files are visualize using GVEdit for graphviz graph viewer[16].The state machine generated for coffee maker case study is shown in Figure 4. Finally test cases are to be generated from the sequential flow of user events from user session log files, the test case scenario traced over the generated FSMs to conclude whether a test is passed or failed.

Ƈ 26 Ƈ

4.1 Injected Faults To validate efficiency of constructed finite state machine that how effectively constructed user session based state machine can reveal faults, we injected faults in various AJAX web applications. In order to inject real faults, we have seen many bug reports retrieved from many bug tracking software and on the basis of these bug reports identified and later injected some real type of faults into the chosen Ajax web applications manually. Injected faults varies in various fault categories like form construction faults, asynchronous communication faults, interaction faults, response faults, static and dynamic link validation faults, operational transition faults (back, forward button, URL rewriting) . Here considering different category of faults those are changing states means state based faults. These kinds of faults injected on three Ajax based web applications.

Break Neck Pizza

In these three Ajax web applications injected 5 different categories of faults. We detailed the injected faults list of 19 injected faults of 5 different categories in three Ajax web applications in table 1. Mainly injected faults are of incorrect Dom manipulation. Indeed, User session state machine is able to reveal faults associated to state navigation and transition navigation. Table 1 shows the number of fault injected on various chosen AJAX web applications. Table 1. Injected fault list Fault Category Browser Fault

Board ‘R’Us Coffee Maker

Injected fault description Browser caching the request causing problem in Board’R’U application. Asynchronous Server not responding causing communication problem in asynchronous communication Interaction fault Not setting most recent value of board sold on different machines and even on different browsers. Response Fault Response on one machines are not compatible with response coming to another machine Functionality getBoardSold() returning garbage or wrong figure for the latest snowboard sale figure. Browser Browser is not able to get server response because java script setting is disabled in browser’s setting. Asynchronous If coffee is ready showing ready communication message but if not clicking on ok of a particular coffee maker

coffee ready message. Response of second coffee maker will delay. Interaction fault Both coffee makers are busy but not reflecting changed busy state message when order third coffee, If Coffee is ready in Coffee maker1 not reflecting idle state of that. Response Fault After coffee is prepared not showing ready coffee response message Functionality If ordering coffee for both coffee maker, later ordered coffeemaker request overwriting first coffee maker request. Browser Caching the request causing problem in Break neck application and because of this problem picking wrong delivery address. Asynchronous Order delivery address is not communication correct according to entered phone number because of semantically interacting events Interaction fault Call back function not updating the web page with new values based on server response. Response Fault Not able to get correct server response because of wrong semantically interacting event sequence. Functionality Wrong address picked of wrongly entered phone number because of no of client request.

5. RESULTS Table2 shows the faults exposed by our user session based state testing. In table, ‘Y’ shows that the proposed approach is able to reveal the associated injected faults and ‘N’ shows that approach is not able to retrieve injected fault. Table 2. Faults revealed using proposed approach Ajax web Appl. Faults Categories Browser Asynchronous Communication Interaction faults Response Faults Navigation Functionality

Ƈ 27 Ƈ

Board ‘R’ Us

Coffee Maker

N Y

Y Y

Break neck Pizza N Y

Y Y Y Y

Y, Y Y Y Y

Y Y Y Y

6. CONCLUSION In this paper, we proposed dynamic content testing on the basis of user session based state testing. These web applications are handled by dynamic DOM manipulation of an Ajax code. We have proposed that reflected DOM manipulation because of user triggered events has been retrieved at the time of test cases generation. This technique proposed a test case generation technique to detect dynamic Dom manipulation faults associated with various kinds of fault categories. Here in this research work, we first focused on to drive Finite State machine of user session events and how to show sequence of semantically interacting events of Ajax application. For culmination of this, we designed Dom tree inspector and user session traces accessed through Selenium tool and mapping between these two has been able to generate Finite state machine of dynamic web application. Here in this work, Maximum efforts involved in Finite state machine generation and test case generation. All steps are automated and no need of any manual selection. 7. [1]

[2]

[3]

[4] [5]

[6]

REFERENCES Mesbah, E. Bozdag, and A. van Deursen. Crawling Ajax by inferring user interface state changes. In Proc. 8th Int. Conference on Web Engineering (ICWE’08), pages 122–134. IEEE Computer Society, 2008. Andrews, A., Offutt, J., Alexander, R.: Testing web applications by modeling with FSMs. Softw. Syst. Model. 4(3) (2005) G. A. Di Lucca and A. R. Fasolino. Testing webbased applications: The state of the art and future trends. Inf. Softw. Technol., 48(12):1172–1186, 2006. J. Larson. Testing ajax applications with selenium. InfoQ magazine, 2006. S. Elbaum, G. Rothermel, S. Karre, M. Fisher, Leveraging user-session data to support Web application testing, IEEE Transactions on Software Engineering 31 (3) (2005) 187–202. Anuja Arora, Madhavi Sinha. “Web Application Testing : A Review on Technique, Tools and State of Art” in International Journal of Scientific and Engineering Research(IJSER), Volume 3 Issue, Feb 2012.

[7]

[8]

[9]

[10]

[11]

[12]

[13]

[14] [15]

[16] [17]

Ƈ 28 Ƈ

Mesbah, Ali, and Arie van Deursen. "Migrating multipage web applications to single-page Ajax interfaces." Software Maintenance and Reengineering, 2007. CSMR'07. 11th European Conference on. IEEE, 2007. Marchetto A, Tonella P (2009) Search-based testing of ajax web applications. In: Proc. of IEEE international symposium on search based software engineering (SSBSE). IEEE Computer Society,Windsor, pp 3–13 Arie van Deursen,Ali Mesbah : Research Issues in the Automated Testing of Ajax Application: SOFSEM 2010 :16-28 Marchetto A, Tonella P, Ricca F (2008a) A case studybased comparison of web testing techniques applied to ajax web applications. Int J Softw Tools Technol Transf (STTT) 10(6):477–492 Marchetto A, Tonella P, Ricca F (2008b) State-based testing of ajax web applications. In: Proc. Of IEEE international conference on software testing (ICST), Lillehammer, Norway, pp 121–131 Marchetto, A., & Tonella, P. (2011). Using searchbased algorithms for Ajax event sequence generation during testing. Empirical Software Engineering,16(1), 103-140. A.Mesbah, E. Bozdag, and A. van Deursen. Crawling Ajax by inferring user interface state changes. In Proceedings of the 8th International Conference on Web Engineering (ICWE’08), pages 122–134. IEEE Computer Society, 2008. Sebestien Salva, Patrice Laurencot: Automatic Ajax Application Testing. ICIW 2009:229-234 A.Mesbah and A. van Deursen. Invariant-based automatic testing of Ajax user interfaces. In Proceedings of the 31st International Conference on Software Engineering (ICSE’09), Research Papers, pages 210–220. IEEE Computer Society, 2009. McLaghlin, Brett. Head Rush Ajax. O'Reilly Japan, 2006. Ellson, John, et al. "Graphviz—open source graph drawing tools." Graph Drawing. Springer Berlin Heidelberg, 2002.

Suggest Documents