scieee AI-readable full text Open interactive document viewer

Engenharia reversa de padrões de interação

Clara Raquel da Costa e Silva Sacramento

Abstract

As interfaces gráficas estão populadas de comportamentos recorrentes que variam apenas ligeiramente. Por exemplo, a autenticação (login/password) é um comportamento comum a muitas aplicações de software. No entanto, há comportamentos diferentes entre diferentes implementações desse padrão. Por vezes, aparece uma mensagem quando o utilizador não introduz os dados correctos, outras vezes, a aplicação de software apenas apaga os dados introduzidos e não apresenta indicação nenhuma ao utilizador. Estes comportamentos recorrentes (padrões de interface) estão bem identificados na literatura. O objetivo deste trabalho é dar continuidade ao trabalho já realizado numa ferramenta existente chamada PARADIGM-RE, uma abordagem de engenharia reversa dinâmica para extrair padrões de interface de aplicações Web existentes. Como tal, vamos desenvolver um módulo de análise de dados, cujo objetivo é melhorar e fundamentar as heurísticas de identificação existentes definidas, e vamos ampliar o atual conjunto de padrões identificáveis.

Full text

For Jury Evaluation FACULDADE DE ENGENHARIA DA UNIVERSIDADE DO PORTO Reverse Engineering of Interaction Patterns Clara Sacramento Mestrado Integrado em Engenharia Informática e Computação Supervisor: Ana Paiva (PhD) July 18, 2014 Reverse Engineering of Interaction Patterns Clara Sacramento Mestrado Integrado em Engenharia Informática e Computação Approved in oral examination by the committee: Chair: José Manuel de Magalhães Cruz External Examiner: José Creissac Campos Supervisor: Ana Cristina Ramada Paiva July 18, 2014 This work is financed by the ERDF - European Regional Development Fund through the COMPETE Programme (operational programme for competitiveness) and by National Funds through the FCT - Fundação para a Ciência e a Tecnologia (Portuguese Foundation for Science and Technology) within project FCOMP-01-0124-FEDER-020554. i ii Abstract A great deal of effort in model-based testing is related to the creation of the model. In addition, the model itself, while a powerful tool of abstraction, can have conceptual errors, introduced by the tester. These problems can be reduced by generating those models automatically. This dissertation presents a dynamic reverse engineering approach that aims to extract part of the model of an existing Web application through the identification of User Interface (UI) patterns. This reverse engineering approach explores automatically any Web application, records information related to the interaction, analyzes the gathered information, tokenizes it, and infers the existing UI patterns via syntactical analyzing. After complemented with additional information and validated, the model extracted is the input for the Pattern-Based Graphical User Interface Testing (PBGT) approach for testing existing web application under analysis. First the theme developed during the course of the dissertation is introduced, starting by defining the context and issue at hand and describing the goals of this dissertation. Afterwards we present a literary review on reverse engineering approaches, approaches that infer patterns from Web applications, and approaches that extract models from applications. We explain the approach in detail, present a case study, and lastly, we present the conclusions taken from the work. iii iv Resumo Grande parte do esforço despendido em testes baseados num modelo está relacionado com a criação do modelo. Além disso, o modelo, mesmo sendo uma ferramenta poderosa de abstração, pode ter erros conceptuais introduzidos pelo testador. Esses problemas podem ser reduzidos ao gerar esses modelos automaticamente. Esta dissertação apresenta uma abordagem de engenharia reversa dinâmica que pretende extrair parte do modelo de uma aplicação Web a testar, diretamente da sua interface gráfica, através da identificação de padrões de interface de utilizador (UI Patterns). Esta abordagem de engenharia reversa explora automaticamente qualquer aplicação Web, guarda informação relacionada com a interação, analisa a informação guardada, analisa-a lexicalmente, e infere padrões através de análise sintáctica. Após ser complementado com informação adicional e validado, o modelo resultante serve de entrada para a abordagem de Teste de GUIs baseado em Padrões (PBGT), para testar a aplicação Web sobre análise. Primeiro o tema desenvolvido no decorrer da dissertação é introduzido, começando por definir o seu contexto, motivação e objectivos. Depois é apresentada uma revisão bibliográfica de abordagens que usam engenharia reversa, abordagens que inferem padrões de aplicações Web, e abordagens que extraem modelos de aplicações. A abordagem desenvolvida é apresentada em detalhe, é apresentado um caso de estudo, e finalmente são apresentadas as conclusões do trabalho realizado. v CONTENTS 5 Conclusions 35 5.1 GoalSatisfaction .................................. 35 5.2 FutureWork..................................... 36 References 37 A Appendix 43 xii List of Figures 2.1 An explanation of the model-based testing process. . . . . . . . . . . . . . . . . 6 3.1 An overview of the PBGT project. . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.2 PARADIGM DSL Meta-model. . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3.3 PARADIGMsyntax. ................................ 16 3.4 Structure of the PARADIGM-RE tool . . . . . . . . . . . . . . . . . . . . . . . 18 3.5 The architecture of the approach. . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.6 The inferrer’s reasoning algorithm, expressed in a finite state machine. . . . . . . 28 3.7 A simplified example of a generated model. . . . . . . . . . . . . . . . . . . . . 29 xiii LIST OF FIGURES xiv List of Tables 3.1 An example of execution traces produced on the Amazon.com website, extracted usingSeleniumIDE. ................................ 19 3.2 Abbreviated example of an execution trace file. . . . . . . . . . . . . . . . . . . 20 3.3 Example of an execution trace file, and of processed lines. . . . . . . . . . . . . 25 3.4 Default grammar used by LogProcessor to tokenize the execution trace file (ε indicatesanemptystring). ............................. 27 3.5 Execution trace example from which a Login pattern can be inferred. . . . . . . . 29 4.1 Evaluation set results from the previous and current tool, given the same input. . 32 4.2 Evaluation set results from the previous tool, taken from [NPF14]. ........ 33 A.1 Afullhistoryfileexample.............................. 44 xv LIST OF TABLES xvi List of Algorithms 1 Pseudo-code algorithm to explore a page. . . . . . . . . . . . . . . . . . . . . . . 22 xvii LIST OF ALGORITHMS xviii Abbreviations API Application Programming Interface AST Abstract Syntax Tree AUA Application Under Analysis CIO Concrete Interaction Objects DSL Domain Specific Language EFG Event Flow Graph FEUP Faculdade de Engenharia da Universidade do Porto FSM Finite State Machine HTML HyperText Markup Language GUI Graphical User Interface MBT Model-Based Testing PBGT Pattern-based GUI Testing RIA Rich Internet Applications SUT System Under Testing TDD Test-Driven Development UI User Interface UML Unified Modeling Language XML eXtensible Markup Language xix Chapter 1 Introduction2 1.1 Context4 Web applications are getting more and more important. Due to their stability and security against losing data, there is a growing trend to move applications towards the Web, with the most notorious6 examples being Google’s mail and office software applications. Web applications can now handle tasks that before could only be performed by desktop applications [G+05], like editing images or8 creating spreadsheet documents. Despite the relevance that Web applications have in the community, they still suffer from a lack10 of standards and conventions [CL02], unlike desktop and mobile applications. This means that the same task can be implemented in many different ways, which makes automated testing difficult to12 accomplish and inhibits reuse of testing code. For instance, authentication (login) failure usually triggers the appearance of an error message, but some implementations simply erase the inserted14 data, with no error message visible. GUIs (Graphical User Interfaces) of all kinds are populated with recurring behaviors that vary16 slightly; examples being authentication via login/password pair and content search. These behaviors (patterns) are called User Interface (UI) patterns [VWVDVE01] and are recurring solutions18 to common design problems. Due to their widespread use, UI patterns allow users a sense of familiarity and comfort when using applications.20 However, while UI patterns are familiar to users, their implementation may vary significantly. Despite this, it is possible to define generic and reusable test strategies (User Interface Test Patterns22 - UITP) to test those patterns. This requires a configuration process, in order to adapt the tests to different applications [DJK+99].24 Testing is an increasingly important part of any development process as it is essential to improve the trust in the quality of software. Thus, there is an ever increasing need to develop new26 techniques in this field. This necessity is increased by the constant improvement of development techniques.28 1 State-of-the-Art Java program executions. ReGUI [CMPPF11,CMPPF12] is a dynamic reverse engineering tool made to reduce the effort of modeling the structure and behavior of a software application GUI. 2 Fischer et al. developed a methodology that analyzes and compares execution traces of different versions of a software system to provide insights into its evolution, named EvoTrace [FOGG05]. 4 Amalfitano’s approach [AFT10] generates test cases from execution traces to help testing from Rich Internet Applications (RIAs), with the execution traces being obtained from user sessions 6 and crawling the application. 2.3.2 Extraction of Information from Applications 8 The following approaches extract information from Web, desktop and mobile applications for analysis, processing and testing. 10 Ricca and Tonella’s ReWeb [RT01] dynamically extracts information from a Web application’s server logs to analyze its structure and evolution, and so aims to find inconsistencies and connec- 12 tivity problems. Benedikt et al. introduced a framework called VeriWeb [BFG02] that discovers and explores automatically Web-site execution paths that can be followed by a user in a Web ap- 14 plication. Di Lucca et al.’s approach [DLDP05] integrates WARE [DLFT04], a static analysis tool that generates UML diagrams from a Web application’s source code, and WANDA [ADPZ04], a 16 Web application dynamic analysis tool, to identify groups of equivalent built client pages and to enable a better understanding of the application under study. Bernardi et al. [BDLD08] presents 18 an approach for the semi-automatic recovery of user-centered conceptual models from existing web aplications, where the models represents the application’s contents, their organization and 20 associations, from a user-centered perspective. Marchetto et al. proposed a state-based Web testing approach [MTR08] that abstracts the Document Object Model (DOM) into a state model, and 22 from the model derives test cases. Crawljax [Roe10] is a tool that obtains graphical site maps by automatically crawling through a Web application. WebDiff [CVO10] is a tool that searches for 24 cross-browser inconsistencies by analyzing a website’s DOM and comparing screenshots obtained in different browsers. Memon presented an end-to-end model-based Web application automated 26 testing approach [Mem07] by consolidating previous model development work into one general event-flow model, and employs three ESESs (event space exploration strategies) for model check- 28 ing, test-case generation, and test-oracle creation. Mesbah et al. proposed an automated technique for generating test cases with invariants from models inferred through dynamic crawling 30 [MvDR12]. Another approach by Mesbah et al., named FeedEx [FM13] is a feedback-directed Web application exploration technique to derive test models. It uses a greedy algorithm to partially 32 crawl a RIA’s GUI, and the goal is that the derived test model capture different aspects of the given Web application’s client-side functionality. Artzi et al. developed a tool called Artemis [ADJ+11]34 which performs feedback-directed random test case generation for Javascript Web applications. Artemis triggers events at random, but the events are prioritized by less covered branch coverage 36 in previous sequences. Amalfitano et al. developed a semi-automatic approach [AFT11] that uses dynamic analysis of a Web application to generate end user documentation, compliant with known 38 standards and guidelines for software user documentation. Dincturk et al. [DCvB+12] proposed a 8 State-of-the-Art RIA crawling strategy using a statistical model based on the model-based crawling approach introduced in [BVBD+11] to crawl RIAs efficiently. Dallmeier et al.’s Webmate [DBOZ12,DBOZ13]2 is a tool that analyzes the Web application under test, identifies all functionally different states, and is then able to navigate to each of these states at the user’s request. Amalfitano et al.’s approach,4 AndroidRipper [AFT+12], uses ripping to automatically and systematically traverse the app’s user interface, generating and executing test cases as new events are encountered.6 2.3.3 Model Extraction from Applications via Reverse Engineering There are plenty of approaches that extract models from desktop and Web applications, even if the8 extracted models may be different from the models extracted by this application. Memon’s GUI Ripping [MBN03] is an approach that reverse engineers a model represented as structures called10 a GUI forest, event-flowgraphs and an integration tree directly from the executable GUI. Paiva et al.’s approach [PFV07,PFM08] reverse engineers structural and behavioural formal models of12 a GUI application by a dynamic technique, mixing manual and automatic exploration with the goal of diminishing the effort required to construct the model required in a model-based GUI test-14 ing process. Sanchez et al.’s approach [SRSCGM10] is a model-driven engineering process that performs reverse engineering of the layout of RAD-built GUIs, and produces a GUI model in or-16 der to perform actions like adapt the GUI for mobile device screens. Gimblett and Thimbleby’s approach [GT10] discovers automatically a model of an interactive system by exploring the sys-18 tem’s state space, and uses the produced models for structural usability analysis. Scheetz et al. have used a class diagram representation of the system’s architecture to generate test cases using20 an AI planning system [SvMF99]. Moore [Moo96] describes experiences with manual reverse engineering of legacy applications to build a model of the user interface functionality. Silva et22 al.’s GUISurfer [SSG+10] is a framework that extracts behavioural models from the source code of GUI-based applications, in order to test their implementation. Lutteroth’s approach [Lut08]24 is able to recover a higher-level layout representation of a hardcoded GUI using the Auckland Layout Model [ZLSW13]. Belluci et al.’s approach [BGPP12] performs reverse engineering of26 interactive dynamic Web applications into a model-based framework able to describe them at various abstraction levels, with the goal of facilitating the adaptation of the analysed Web applications28 to other types of interactive devices. Stojanovic et al.’s approach [SSV02] is a semi-automated reverse engineering approach to generate shared-understandable metadata of Web applications, in30 order to migrate the applications to the Semantic Web. 2.3.4 Inferring Patterns from Web applications32 Despite the fact that there are plenty of approaches to mine patterns from Web applications, no approaches have been found that infer UI patterns from Web applications beside the work this34 dissertation means to extend [NPCF13,MPFC12]. The approaches found deal mostly with Web mining, with the goal of finding relationships between different data or finding the same data in36 different formats. Brin [Bri99] presented an approach to extract relations and patterns for the same 9 State-of-the-Art data spread through many different formats. Chang [CHL03] proposes a similar method to discover patterns, by extracting structured data from semi-structured Web documents. Freitag [Fre98]2 proposed a general-purpose relational learner for information extraction from Web applications. 2.4 UI Patterns 4 User Interaction (UI) patterns are well-documented in a various number of sources [Tid10,VWVDVE01, Nei,SGR+05]. The patterns already supported (like the Search and Master/Detail patterns) enter 6 the list of most popular patterns, according to the sources found, and if the selection of supported patterns were to be broadened, the pick of the next one(s) would be heavily influenced by the 8 literature. Lin and Landay’s approach [LL08] uses UI patterns for Web applications that run on PCs and mobile phones, and prompt-and-response style voice interfaces. Pontico et al.’s approach 10 [PWL08] presents UI patterns common in eGovernment applications. In [ant] are presented the four best user interface pattern libraries, chosen by the UX Movement community. 12 2.4.1 Capture-Replay Tools The execution traces of a Web application, on the client side, are usually captured via a capture- 14 replay tool. Here we present the most popular capture-replay tools used nowadays. Selenium 1is an open-source capture/replay tool that captures an user’s interaction with a Web 16 application in HTML files. It has multi browser, OS and language support, can be installed serverside and as a Mozilla Firefox add-on, has its own IDE (Integrated Development Environment), and 18 allows recording and playback of tests. Watir Webdriver 2is is an open-source (BSD) family of Ruby libraries for automating Web 20 browsers and Web application testing. It has multi browser and OS support, a rich API, and has a functionality for non-tech users: the ‘Simple’ class. There also exist ports for other programming 22 languages, such as Watij (for Java) and Watin (.NET). IBM Rational Functional Tester (RFT) 3is an automated functional testing and regression 24 testing tool. This software provides automated testing capabilities for functional, regression, GUI, and data-driven testing. Rational Function Tester supports a range of applications, such as .Net, 26 Java, Siebel, SAP, terminal emulator-based applications, PowerBuilder, Ajax, Adobe Flex, and others. It permits storyboard testing, automated testing, data-driven testing, and test scripting. 28 Sahi 4is an open-source automation and testing tool for web applications. It allows recording and replaying across browsers, provides different language drivers for writing test scripts, and 30 supports Ajax and highly dynamic web applications. 1Selenium: http://docs.seleniumhq.org/ 2Watir: http://watirwebdriver.com/ 3IBM RFT: http://www-03.ibm.com/software/products/en/functional 4Sahi: http://sahi.co.in/ 10 State-of-the-Art 2.5 Chapter Conclusions In this chapter we gave a brief introduction of the concepts that serve as base to the thesis. We also2 presented related works on the areas of reverse engineering approaches that extract information from applications in general and Web applications in specific, approaches that extract models4 automatically from applications, and approaches that infer patterns from applications. Lastly, we presented documentation on UI patterns, and presented various capture/replay applications.6 Most of the presented approaches that extract information from execution traces consume execution traces with different content than the ones the developed tool uses; the execution traces8 range from server logs, to sequences of actions enriched with context information like system state, to sequences of executed code instructions in a run path. Similarly, the presented approaches that10 extract general information from applications do so for many purposes: for testing (and in this category we test generation, model checking, and use case derivation), analysis, to search for12 inconsistencies, to better understand a Web application, to generate documentation, and others. The applications that more closely ressemble the developed approach are the ones that extract14 models from Web applications, and in that category, the extracted models vary in content. Some extract the layout of the Web application; others extract a directed finite graph, which represents16 the states of the applications and the actions necessary to switch between states; and some use logical database models. Few model extraction approaches extract models from the GUI of the18 Web application, and those that do, do so for user interface reengineering (typically of legacy systems).20 Finally, there have not been found approaches that extract UI patterns from applications. There are approaches that infer patterns, but the inferrable patterns are other types of patterns: design22 patterns, textual patterns from databases (related to the field of knowledge and text mining), or Web mining. Additionally, there are few, if none, approaches that mine patterns from GUIs. The closest24 we’ve found was an approach that mined usage patterns (common action sequences executed by users) from Web applications, which relates more to Web mining than model extraction.26 11 State-of-the-Art 12 Chapter 3 RE-TOOL2 In this chapter, we begin by giving a brief overview of PBGT, the research project the devel-4 oped work is inserted in. Afterwards, the previous approach and current tool are broken down in components and explained in detail.6 3.1 PBGT Overview As mentioned before, the focus of this dissertation is the reverse engineering component of a re-8 search project named PBGT (Pattern-based GUI Testing) [MPM13]. The goal of this project is to develop a model-based GUI testing approach and supporting tool, that can be used in industrial10 contexts. 12 3.1.1 Architecture The PBGT supporting tool has main five components:14 1. PARADIGM, a DSL (Domain Specific Language) to define GUI testing models based on UI Test Patterns [MP14];16 2. PARADIGM-RE, a Web application reverse engineering tool whose purpose is to extract UI patterns from Web pages without access to their source code, and use that information to18 generate a test model written in PARADIGM; 3. PARADIGM-ME, a modeling and testing environment, built to support the creation of test20 models [MP13]; 4. PARADIGM-TG, an automatic test case generation tool that generates test cases from test22 models defined in PARADIGM according to coverage criteria selected by the tester; 13 RE-TOOL 5. and finally, a test case execution tool, named PARADIGM-TE, which executes test cases, analyzes their coverage with a coverage analysis tool named PARADIGM-COV[LV14], 2 and returns detailed execution reports. The architecture and workflow of the project is shown in Fig. 3.1.4 Figure 3.1: An overview of the PBGT project. 6 3.1.2 PARADIGM DSL PARADIGM is a DSL to be used in the domain of PBGT. The goal of the language is to gather 8 applicable domain abstractions (e.g., UI test patterns), allow specifying relations between them and also provide a way to structure the models in different levels of abstraction to cope with com- 10 plexity. PARADIGM’s meta-model is illustrated in Figure 3.2. 12 The PARADIGM language is comprised by elements and connectors [MPM13]. There are 14 four types of elements: Init (to mark the beginning of a model), End (to mark the termination of a 14 RE-TOOL Figure 3.2: PARADIGM DSL Meta-model. model), Structural (to structure the models in different levels of abstraction), and Behavioral (UI Test Patterns describing the testing goals).2 As models become larger, coping with their growing complexity forces the use of structuring4 techniques such as different hierarchical levels that allow use one entire model Ainside another model Babstracting the details of Awhen within B. Structuring techniques are common in pro-6 gramming languages like C and Java, with constructs such as modules and classes. Form is a structural element that may be used for that purpose. A Form is a model (or sub-model) with an8 Init and an End elements. Group is also a structural element but it does not have Init and End and, moreover, all elements inside the Group are executed in an arbitrary order.10 15 RE-TOOL Figure 3.3: PARADIGM syntax. PARADIGM elements and connectors are described by: (i) an icon/figure to represent the el- 2 ement graphically and (ii) a short label to name the element. The overall syntax of the DSL is illustrated in Figure 3.3. Additionally, elements within a model have a number to identify them, 4 and optional elements have a “op" label next to its icon/figure. 6 This language has three connectors: Sequence,SequenceWithDataPassing, and SequenceWith- MovedData.Sequence indicates that the testing strategy related to the target element cannot start 8 until the testing strategy of the source element has completed. SequenceWithDataPassing has the same meaning as Sequence, and additionally indicates that the target element receives data from 10 the source element. SequenceWithMovedData has a similar meaning to SequenceWithDataPassing, but the source element moves data to the target instead of transferring a copy. In addition, 12 there is another kind of relation among elements – Dependency – indicating that the target element depends on the properties of a set of source elements, for instance, when it is the result of a calcu- 14 lation. 16 3.1.2.1 UITP (User Interface Test Patterns) A UI Test Pattern defines a test strategy to test a specific UI pattern, which is formally defined by 18 a set of test goals (for later configuration)[MPM13] with the form: <Goal;V;A;C;P>(3.1) 20 Goal is the ID of the test. Vis a set of pairs [variable,inputData] relating test input data with the variables involved in the test. Ais the sequence of actions to perform during test case execu- 22 tion. Cis the set of possible checks to perform during test case execution, for example, “check if it remains in the same page”. Pis a Boolean expression (precondition) defining the set of states in 24 which it is possible to execute the test. The language also defines language constraints to guarantee the building of well-formed models, such as “A Connector cannot connect an element to itself ”26 16 RE-TOOL and “A Connector cannot have Init as destination, or End as source”, to cite a few examples. 2 The UI Patterns defined in the PARADIGM language are: Login: This pattern is commonly found in Web applications, especially in the ones that4 restrict access to functionalities or data. Usually consists of two input fields (a normal input box for email or username, and a cyphered text for the password) and a submit button,6 with optionally a “remember me” checkbox. The authentication process has two possible outcomes: valid and invalid. Upon authentication failure a message may be shown.8 Find: This pattern consists of one or more input fields, where the user inserts keywords to search, and a submit button to start the search. The search may be submitted via a submit10 button, or dynamically upon text insertion. When the search is successful, the website shows a list of results; upon failure, an error message may be shown.12 Sort: This pattern sorts a list of data by a common attribute (e.g., price, name, relevance, etc.) according to a defined criteria (ascending or descending, alphabetically, etc.).14 Master Detail: This pattern is present in a web page when selecting an element from a set (called master) results in filtering/updating another related set (called detail) accordingly.16 For example, clicking on a checkbox associated to a brand may include (or exclude) products of that brand in a product search result list. Generally the only elements changed are18 the elements belonging to the detail set. Call: This pattern is any kind of element where a click triggers some procedure that may20 result in a change of page. Input: This pattern is any kind of element in which text can be inserted.22 3.1.3 Produced Models The models produced by the reverse engineering tool PARADIGM-RE consist of a XML file in the24 format required by the PARADIGM-ME which contains information about the UI Test Patterns needed to test the UI Patterns found: their name, the input values for their variables, i.e., the26 values used during the exploration process, and blank pre-conditions and checks for the tester to fill in. The UI Test Patterns within the model are connected in a linear path according to the28 exploration order. The testing configuration information needs to be complemented and validated by the tester afterwards in order to generate test cases and execute them over the web application30 under analysis. 17 RE-TOOL 3.2.2.2 Configuration To improve results, almost all components used in the website interaction and pattern identifying 2 processes can be loaded to the application via a XML configuration file, the only exception being the PatternInferrer grammar. This is done to allow the maximum flexibility to the tester to adjust 4 the tool to the web application to test. 6 The components and values that can be loaded via configuration file are: actions: number of actions the crawler will execute before stopping; 8 redirections: number of redirects to the home page the crawler will do before stopping; politenessDelay: time to wait (in milliseconds) after each action; 10 typedKeywords: list of words to insert in text input elements; searchKeywords: regex with keywords that identify search elements; 12 sortKeywords: regex with keywords that identify sort elements; loginKeywords: regex with keywords that identify login elements; 14 generalWordsToExclude: regex with keywords that mark elements that should not be accessed; 16 menuIdentifiers: list of ids/classes/names that identify menu elements; masterIdentifiers: list of ids/classes/names that identify master elements; 18 detailIdentifiers: list of ids/classes/names that identify detail elements; historyFilepath: specify absolute file path for history file; 20 processedHistoryFilepath: specify absolute file path for processed history file; patternsFilepath: specify absolute file path for PARADIGM model file; 22 patternsToFind: list of patterns that the explorer can search for - if "all" occurs, there will be no restriction; 24 loginConfiguration: credentials for a correct login in the web app; tokenizerPatterns: patterns for LogProcessor; 26 includeChildrenNodesOnInteraction: boolean; on interaction with an input or select element, if children elements should be included in the history file, but not interacted with; 28 24 RE-TOOL 3.2.2.3 Action File Processing (LogProcessor) This component is a lexical analyzer, whose role is to examine the execution trace file line by line2 and identify the type of each action written therein. It has a data structure (which serves as its lexical grammar) containing the rules it is going to search for, and each has the following attributes:4 pattern_name, the identifier for the rule; identifying_regex, and a regex (Regular Expression5) that identifies an action of that type.6 For every line, not all rules are tested; if a rule matches the line, first a camel-case token (com-8 posed by the sum of the action type and the rule’s name) is produced, added to the processed trace file, and then the program moves on to the next line. If no rules match, only the action is written10 on the file. An example of file processing may be seen in Table 3.2. 12 Action Target Value Processing Return type id=input_username user1 typeUsername type id=input_password 123pass typePassword clickAndWait css=input EMPTY clickFormSubmit [type=“submit"] PageChange type id=searchInput coffee typeSearch clickAndWait id=mw-searchButton EMPTY clickSearch PageChange select id=sort label=Price: selectSort Low to High click id=collapseButton1 EMPTY clickCollapse click link=Next EMPTY clickNextLink typeAndWait id=freeSearch ministry typeSearch PageChange type id=authcode T75Y5 typeAuth type name=firstName james typeFirstName type name=lastName bond typeLastName click //ul[@id=’ref_679781011’]/li[5]/a/span EMPTY click Table 3.3: Example of an execution trace file, and of processed lines. The identifiable tokens by default are: login, username, email, password, verifyPassword, submit, captcha, auth, search, sort, link, option, checkbox, radio, homeLink, imageLink, nextLink, pre-14 vLink, firstLink, lastLink, languageLink, buttonLink, searchResultLink, link, collapse, firstNameInput, lastNameInput, numberInput, input, button, and clear. However, the identifiable patterns can16 also be overridden and added to via a configuration file (see Section 3.2.2.2). 18 The tokens produced by the LogProcessor affect the pattern inferring done by PatternInferrer. For example, the patterns involved in the inferring of the Login pattern are username, email, login20 (these identify username and email inputs, and login inputs or actions, depending on which action the token is appended to), password (which identifies a password input), and submit, which are22 5Regex: http://www.regular-expressions.info/ 25 RE-TOOL used to indicate the closing of a classical form submit action (when matchSubmit(line) is true), and thus, the end of a standard pattern. Some patterns are identified to distinguish between proper 2 patterns and other types of action non relevant to the inferring process, such as verifyPassword, which can be used to distinguish between a Login form and a Register form, and searchResultLink,4 which prevents search result links from being marked as part of a Find pattern. Some exist simply to give better context to the action, like nextLink or lastName. An example of a processed exe- 6 cution trace file (resulting of running LogProcessor on the contents of Table A.1) can be seen in Listing A.2.8 3.2.2.4 UI Pattern Inferring (PatternInferrer) 10 This component is a syntactical analyzer, that takes as input the extended execution trace file returned by the LogProcessor, runs it against a predefined grammar, and returns the patterns found. 12 The processing rules are formalized in Table 3.4. If during the process the tool detects the same UI Pattern instance several times, the tool is 14 capable of ignoring the repetitions. Its reasoning is explained in Figure 3.6. 16 For simplicity’s sake, only the valid paths are shown in the figure (Fig. 3.6). All patterns 18 except Login can be valid even in the absence of a form submit action; this is done to account for dynamic submission via Javascript. In the case of the Login pattern, there can only be one 20 password and one username or email record; this is done to distinguish login forms from register forms and password/email change forms. 22 The previous figure (Fig. 3.6) does not account for the Menu and Master Detail patterns; as 24 mentioned before, these patterns are identified through HTML analysis and passed directly from the WebsiteExplorer to the PatternInferrer to write. This grammar only deals with the patterns 26 identifiable through the execution trace file. 28 After the file is processed, an XMI file is produced containing all the pattern occurrences found, and the values assigned to each variable, as per Formula 3.1.2.1. As mentioned before, the 30 checks to perform within each test strategy and any preconditions must be specified by the tester later on in the PARADIGM-ME tool. 32 An example of a execution trace file extract from which a Login pattern can be inferred can be 34 seen in Table 3.5, and full example of a PARADIGM file (with inputs being the contents of Table A.1 and Listing A.2) can be seen on Listing A.4.36 26 RE-TOOL hpatterni |=hlogini | hfindi | hsorti | hinputi | hcalli hfindi |=hmatch-findi hopt-submiti hsorti |=hmatch-sorti hopt-submiti hinputi |=hmatch-inputi hopt-submiti hcalli |=hmatch-linkiPageChange hlogini |=hopt-login-reci hmatch-user-passi hmatch-submiti hmatch-user-passi |=hmatch-useri hmatch-passi | hmatch-passi hmatch-useri hopt-submiti |=hmatch-submiti | ε hmatch-submiti |=clickFormSubmit |clickButton hmatch-findi |=hopt-find-reci hsearch-itemi hopt-find-reci hmatch-sorti |=clickSort |selectSort hmatch-inputi |=clickInput |typeInput |typeNumberInput |typeFirstNameInput |typeLastNameInput hmatch-useri |=hopt-login-reci huseri hopt-login-reci hmatch-passi |=hopt-login-reci hpassi hopt-login-reci huseri |=typeUsername |typeEmail |typeLogin hpassi |=typePassword hmatch-opt-logini |=clickLogin PageChange |typeAuth |typeCaptcha |clickOption |clickRadio hmatch-linki |=clickLink |clickHomeLink |clickImageLink |clickNextLink |clickPrevLink |clickFirstLink |clickLastLink |clickLanguageLink |clickButtonLink |clickSearchResultLink hopt-find-reci |=hopt-find-reci | hopt-searchi | hsearch-itemi | ε hopt-searchi |=clickSearch hsearch-itemi |=typeSearch |selectSearch hopt-login-reci |=hopt-login-reci | hmatch-opt-logini | ε Table 3.4: Default grammar used by LogProcessor to tokenize the execution trace file (εindicates an empty string). 27 RE-TOOL Figure 3.6: The inferrer’s reasoning algorithm, expressed in a finite state machine. 3.2.2.5 PARADIGM files produced by PatternInferrer The final PARADIGM files produced contain instances of UI Test Patterns, that correspond to 2 all of the patterns discovered during the exploration made by the WebsiteExplorer and contain blank test configurations meant for the tester to fill in. The files are XMI files which follow the 4 PARADIGM DSL (see Section 3.1.2). Each pattern is stored in a <nodes>tag, which has the following attributes: type (the type 6 of pattern), name (a unique string identifier), number (a unique integer identifier), incomingLinks (the incoming sequence connector) and outgoingLinks (the outgoing sequence connector). 8 28 RE-TOOL Action Target Value Processing Return //a[@class=active clickAndWait and @href=... EMPTY clickLogin pageChange and contains(text(),’Login’)] //input[@id=email type and @name=email [email protected] typeEmail and @type=text] //input[@id=password type and @type=password pass typePassword and @name=password] //input[@id=save_login click and @name=save_login EMPTY clickLogin and @type=checkbox] //input[@class=btn_small grey clickAndWait and @name=commit EMPTY clickSubmit pageChange and @type=submit] Table 3.5: Execution trace example from which a Login pattern can be inferred. Each <nodes>tag has two types of children: <configurations>tags, which contain testing configurations, and <fields>tags, which identify web elements involved in the testing configu-2 rations. Configurations are defined by attributes, and the specification of the test (such as data to insert or element to choose) are defined in <fields>child nodes. Some of the attributes that a4 configuration may have are: validity (whether the inserted data is supposed to be valid or not); check (the type of check to apply to the result of the operation); result (the number of results ex-6 pected - for testing Find patterns); master (identifies the master in a MasterDetail pattern); and mappingURL (the URL in which the testing elements are).8 A simplified example of a generated model can be seen in Listing A.1, in the Appendix chapter (Section A), and the corresponding graphic model, generated via PARADIGM-ME, can be seen10 in Figure 3.7. Figure 3.7: A simplified example of a generated model. 12 3.3 Chapter Conclusions In this chapter we gave a brief overview of PGBT, explained in detail the previous and current14 tool, to better highlight their differences and explain their functioning. The previous tool requires 29 RE-TOOL user interaction to explore a Web application, analyzes the execution trace file, HTML source and URLs of all pages visited, and infers patterns through a set of heuristic rules; the current tool 2 is fully automatic, requires only the execution trace file, and infers patterns through syntactical analysis of a previously tokenized execution trace file. 4 30 Chapter 4 Case Study2 In this chapter we introduce a case study, done to validate the developed work and assess its efficacy and compliance of the dissertation goals.4 4.1 Evaluation 4.1.1 Research Questions6 In order to evaluate the developed reverse engineering approach, some experiments were performed. They aimed to answer the following research questions:8 R1) Is it possible to infer automatically UI Patterns from a Web application? 10 R2) Is it possible to improve the results provided by the previous RE tool? 12 4.1.2 Evaluation Results The RE tool was initially tested iteratively over a set of Web applications, with the goal of fine-14 tuning the inferring grammars used to discover UI Patterns. Afterwards, the RE tool was used to detect UI Patterns in several widely used Web appli-16 cations. This time, the purpose was to evaluate the RE tool, i.e., to determine which UI pattern occurrences the tool was able to detect in each application execution trace (ET), and compare them18 to the list of known to exist patterns. Five applications were chosen from the most popular websites 1: Amazon, Wikipedia, Ebay,20 Youtube, Facebook and Yahoo. The results of the experiments are presented in table 4.1. This table shows the number of22 instances of each UI pattern that exist in the execution traces, the ones that the tools correctly 1according to: http://en.wikipedia.org/wiki/List_of_most_popular_websites 31 Case Study found and the ones that the tools mistakenly found (false positives). In the case of the previous tool, the Menu and Call patterns weren’t included because the tool doesn’t identify those patterns. 2 Previous Tool Pattern Present True False False in ET Positive Negative Positive Find 15 9 6 0 Login 4 3 1 0 Sort 1 1 1 306 Input 29 29 0 6 MasterDetail 58 58 0 22 Total 107 (100%) 100 (93.46%) 7 (6.54%) 334 (312.15%) Current Tool Pattern Present True False False in ET Positive Negative Positive Find 15 13 2 0 Login 4 4 0 0 Sort 1 1 0 0 Input 29 28 1 0 Call 249 235 14 0 Menu 212 212 0 4 MasterDetail 58 46 12 0 Total 568 (100%) 539 (94.89%) 29 (5.11%) 4 (0.7%) Table 4.1: Evaluation set results from the previous and current tool, given the same input. As we can see in Table 4.1, the current reverse engineering tool found few false positives, most related to the Menu UI Pattern. In addition it is worth to mention that the tool found 95.59% of the 4 patterns present in the automatically explored execution traces. Given the same input, the current tool improved all of the statistics, and specially the rate of false positives. 6 However, the case study does not mention how many patterns were present in the web applications that were not visited, which we have not verified. Only one path produced by the application 8 was considered for each Web application, and all the paths were traversed using the standard configuration, excluding any login credentials included (the contents of the standard configuration can 10 be seen in Listing A.3, in Section A). When comparing the evaluation set results with those proposed in [NPF14] (which can be 12 seen in Table 4.2) we see that the current tool finds less patterns than the previous tool. This can be explained: the previous tool had its exploration guided by a human user, specifically a tester, 14 which knew how to guide the exploration; the current tool is guided by an algorithm, that picks a random element for each successive action. When taking this into account, it is natural that an 16 automatic tool finds less patterns than one which it is being guided by an expert. Even so, what the current tool lacks in terms of discovered patterns, it makes up in its percentage of correctly found 18 patterns, which is better than its predecessor’s. 32 Case Study Pattern Present Correctly False in ET Found Positives Login 9 6 0 Find 24 21 0 Sort 11 4 0 Input 28 26 3 MasterDetail 24 9 9 Total 99 67 (67.7%) 12 Table 4.2: Evaluation set results from the previous tool, taken from [NPF14]. 4.2 Chapter Conclusions In this chapter we presented a case study that showcased the results the developed approach pro-2 duces. In comparison to the previous tool, we can see that the inferring precision has improved (the true positive and false positive percentages have increased and lowered, respectively), and the4 number of discovered patterns has lowered slightly for the majority of the identifiable patterns, with a possible reason being detailed.6 33 REFERENCES [LV14] Ana C. R. Paiva Liliana Vilela. Paradigm-cov - a multimensional test coverage analysis tool. 2014. 2 [MBN03] Atif M Memon, Ishan Banerjee, and Adithya Nagarajan. Gui ripping: Reverse engineering of graphical user interfaces for testing. In WCRE, volume 3, page 4 260, 2003. [Mem02] Atif M Memon. Gui testing: Pitfalls and process. Computer, 35(8):87–88, 2002. 6 [Mem07] Atif M Memon. An event-flow model of gui-based applications for testing. Software Testing, Verification and Reliability, 17(3):137–157, 2007. 8 [Moo96] Melody M Moore. Rule-based detection for reverse engineering user interfaces. In Reverse Engineering, 1996., Proceedings of the Third Working Conference on,10 pages 42–48. IEEE, 1996. [MP13] Tiago Monteiro and Ana C. R. Paiva. Pattern based gui testing modeling environ- 12 ment. In ICST Workshops, pages 140–143. IEEE, 2013. [MP14] Rodrigo M. L. M. Moreira and Ana C. R. Paiva. A gui modeling dsl for pattern- 14 based gui testing - paradigm. In 9th International Conference on Evaluation of Novel Approaches to Software Engineering (ENASE 2014), pages 126 – 135, 16 2014. [MPFC12] Inês Coimbra Morgado, Ana CR Paiva, Joao Pascoal Faria, and Rui Camacho. Gui 18 reverse engineering with machine learning. In Realizing Artificial Intelligence Synergies in Software Engineering (RAISE), 2012 First International Workshop 20 on, pages 27–31. IEEE, 2012. [MPM13] Rodrigo MLM Moreira, Ana CR Paiva, and Atif Memon. A pattern-based ap- 22 proach for gui modeling and testing. In Software Reliability Engineering (ISSRE), 2013 IEEE 24th International Symposium on, pages 288–297. IEEE, 2013. 24 [MTR08] Alessandro Marchetto, Paolo Tonella, and Filippo Ricca. State-based testing of ajax web applications. In Software Testing, Verification, and Validation, 2008 1st 26 International Conference on, pages 121–130. IEEE, 2008. [MvDR12] Ali Mesbah, Arie van Deursen, and Danny Roest. Invariant-based automatic test- 28 ing of modern web applications. Software Engineering, IEEE Transactions on, 38(1):35–53, 2012. 30 [Nei] T. Neil. 12 standard screen patterns. http://designingWebinterfaces. com/designingWeb-interfaces-12-screen-patterns. Accessed: 32 2014-01-22. [NPCF13] Miguel Nabuco, Ana CR Paiva, Rui Camacho, and Joao Pascoal Faria. Infer- 34 ring ui patterns with inductive logic programming. In Information Systems and Technologies (CISTI), 2013 8th Iberian Conference on, pages 1–5. IEEE, 2013. 36 [NPF14] Miguel Nabuco, Ana CR Paiva, and Joao Pascoal Faria. Inferring user interface patterns from execution traces of web applications. Manuscript submitted for 38 publication, 2014. 40 REFERENCES [PFM08] Ana CR Paiva, João CP Faria, and Pedro MC Mendes. Reverse engineered formal models for gui testing. In Formal Methods for Industrial Critical Systems, pages2 218–233. Springer, 2008. [PFV07] Ana CR Paiva, João CP Faria, and Raul FAM Vidal. Towards the integration of vi-4 sual and formal models for gui testing. Electronic Notes in Theoretical Computer Science, 190(2):99–111, 2007.6 [PRW03] Michael J Pacione, Marc Roper, and Murray Wood. A comparative evaluation of dynamic visualisation tools. In 10th Working Conference on Reverse Engineering,8 pages 80–89, 2003. [PWL08] Florence Pontico, Marco Winckler, and Quentin Limbourg. Organizing user inter-10 face patterns for e-government applications. In Engineering Interactive Systems, pages 601–619. Springer, 2008.12 [Roe10] Danny Roest. Automated regression testing of ajax web applications. Master’s thesis, Delft University of Technology, February 2010.14 [RT01] Filippo Ricca and Paolo Tonella. Understanding and restructuring web sites with reweb. Multimedia, IEEE, 8(2):40–51, 2001.16 [SCFP00] John Steven, Pravir Chandra, Bob Fleck, and Andy Podgurski. jRapture: A capture/replay tool for observation-based testing, volume 25. ACM, 2000.18 [SGR+05] Daniel Sinnig, Ashraf Gaffar, Daniel Reichart, Peter Forbrig, and Ahmed Seffah. Patterns in model-based engineering. In Computer-Aided Design of User20 Interfaces IV, pages 197–210. Springer, 2005. [SRSCGM10] Óscar Sánchez Ramón, Jesús Sánchez Cuadrado, and Jesús García Molina.22 Model-driven reverse engineering of legacy graphical user interfaces. In Proceedings of the IEEE/ACM international conference on Automated software engi-24 neering, pages 147–150. ACM, 2010. [SSG+07] Sreedevi Sampath, Sara Sprenkle, Emily Gibson, Lori Pollock, and Amie Souter26 Greenwald. Applying concept analysis to user-session-based testing of web applications. Software Engineering, IEEE Transactions on, 33(10):643–658, 2007.28 [SSG+10] João Carlos Silva, Carlos Silva, Rui D. Gonçalo, João Saraiva, and José Creissac Campos. The guisurfer tool: Towards a language independent approach to re-30 verse engineering gui code. In Proceedings of the 2Nd ACM SIGCHI Symposium on Engineering Interactive Computing Systems, EICS ’10, pages 181–186, New32 York, NY, USA, 2010. ACM. [SSV02] Nenad Stojanovic, Ljiljana Stojanovic, and Raphael Volz. A reverse engineering34 approach for migrating data-intensive web sites to the semantic web. In Intelligent Information Processing, pages 141–154. Springer, 2002.36 [ST00] Tarja Systä and Universitatis Tamperensis. Static and dynamic reverse engineering techniques for java software systems. 2000.38 41 REFERENCES [SvMF99] Michael Scheetz, Anneliese von Mayrhauser, and Robert France. Generating test cases from an oo model with an ai planning system. In Software Reliability En- 2 gineering, 1999. Proceedings. 10th International Symposium on, pages 250–259. IEEE, 1999. 4 [Sys99] Tarja Systä. Dynamic reverse engineering of java software. In ECOOP Workshops, pages 174–175, 1999. 6 [TB+09] Alexandru Telea, Heorhiy Byelas, et al. Querying large c and c++ code bases: the open approach. 2009. 8 [Tid10] Jenifer Tidwell. Designing interfaces. O’Reilly, 2010. [TV08] Alexandru Telea and Lucian Voinea. An interactive reverse engineering environ- 10 ment for large-scale c++ code. In Proceedings of the 4th ACM symposium on Software visualization, pages 67–76. ACM, 2008. 12 [VWVDVE01] Martijn Van Welie, Gerrit C Van Der Veer, and Anton Eliëns. Patterns as tools for user interface design. In Tools for Working with Guidelines, pages 313–324. 14 Springer, 2001. [ZLSW13] Clemens Zeidler, Christof Lutteroth, Wolfgang Sturzlinger, and Gerald Weber. 16 The auckland layout editor: An improved gui layout specification process. In Proceedings of the 26th Annual ACM Symposium on User Interface Software and 18 Technology, UIST ’13, pages 343–352, New York, NY, USA, 2013. ACM. 42 Appendix A Appendix2 1<?xml version="1.0" encoding="UTF-8"?>4 2<Paradigm:Model xmi:version="2.0" 3xmlns:xmi="http://www.omg.org/XMI"6 4xmlns:Paradigm="http://www.example.org/Paradigm" 5title="http://www.mcgame.com/" >8 6<nodes xsi:type="Paradigm:Init" name="Init" number="0" 7outgoingLinks="//@relations.0"/>10 8 9<nodes xsi:type="Paradigm:Login" name="Login" number="1"12 10 incomingLinks="//@relations.0" outgoingLinks="//@relations.1"> 11 <configurations validity="Invalid" check="StayOnSamePage" >14 12 <inputs field="username" value="login"/> 13 <inputs field="password" value="123abc"/>16 14 </configurations> 15 <fields name="username" id="//input[@id=email and @name=email18 16 and @type=text]"/> 17 <fields name="password" id="//input[@id=password and @name=password20 18 and @type=password]"/> 19 </nodes>22 20 21 <nodes xsi:type="Paradigm:Call" name="Call" number="1"24 22 incomingLinks="//@relations.1" outgoingLinks="//@relations.2"> 23 <configurations />26 24 <field name="call_0" id="//a[@class=active 25 and @href=http://www.mcgame.com/de/account/login28 26 and contains(text(),’Login’)]"/> 27 </nodes>30 28 29 <nodes xsi:type="Paradigm:Find" name="Search" number="2"32 30 incomingLinks="//@relations.2" outgoingLinks="//@relations.3"> 31 <configurations check="NumberOfResults_more_than"34 32 result="10" > 33 <inputs field="find_0" value="computer"/>36 43 Appendix open http://www.mcgame.com/ EMPTY type //input[@id=query and @name=query and @type=text] computer clickAndWait //input[@type=submit] EMPTY clickAndWait //a[@class=active and @href=http://www.mcgame.com/de/account/login and contains(text(),’Login’)] EMPTY type //input[@id=email and @name=email and @type=text] banana type //input[@id=password and @name=password and @type=password] apple click //input[@id=save_login and @name=save_login and @type=checkbox] EMPTY clickAndWait //input[@class=btn_small grey and @name=commit and @type=submit] EMPTY open http://www.mcgame.com/ EMPTY type //input[@class=alarm_amount and @name=alarm_amount and @type=text] dress clickAndWait //a[@href=http://www.mcgame.com/de/store/game/10210253-watch-dogs- season-pass and contains(text(),’Watch Dogs Season Pass’)] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de/store/publishers and contains(text(),’Kataloge von Publishern’)] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de/store/publishers/1104-rokapublish] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de and contains(text(),’Mac Spiele’)] EMPTY type //input[@id=searchtextbox and @name=field-keywords and @title=Searchen and @type=text] banana clickAndWait //input[@class=nav-submit-input and @title=Go and @type=submit] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de/pages/about and contains(text(),’Uber McGame’)] EMPTY select //select[@id=sort and @class=sort] label=Price: Low to High clickAndWait //a[@href=http://www.mcgame.com/de/store/publishers/1045-activision and contains(text(),’Activision’)] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de/help and contains(text(),’Hilfe & Support’)] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de/store/publishers/1041-bethesda- softworks and contains(text(),’Bethesda Softworks’)] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de/store/publishers/1055-capcom and contains(text(),’Capcom’)] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de/store/mac/core and contains(text(),’Core Games’)] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de/store/offers and contains(text(),’Angebote’)] EMPTY clickAndWait //a[@href=http://www.mcgame.com/de/store/game/10470030-hitman- absolution-professional-edition and contains(text(),’Hitman Absolution: Professional Edition’)] EMPTY select //select[@id=searchDropbox and @class=twotab and @onchange=this.parentForm.submit();] label=Strategie clickAndWait //a[@class=active and @href=https://www.mcgame.com/de/account/login and contains(text(),’Login’)] EMPTY clickAndWait //a[@id=forgot_password and @href=https://www.mcgame.com/reset/password and contains(text(),’Passwort vergessen?’)] EMPTY Table A.1: A full history file example. 44 Appendix 34 </configurations> 35 <fields name="find_0" id="//input[@id=query and @name=query2 36 and @type=text]"/> 37 </nodes>4 38 39 <nodes xsi:type="Paradigm:Sort" name="Sort" number="3"6 40 incomingLinks="//@relations.3" outgoingLinks="//@relations.4"> 41 <configurations check="alphabetically" position="">8 42 <inputs field="Price" value="100"/> 43 </configurations>10 44 <fields name="Price" id="//select[@id=price]"/> 45 </nodes>12 46 47 <nodes xsi:type="Paradigm:End" name="End" number="4" 214 48 incomingLinks="//@relations.4"/> 4916 50 <relations xsi:type="Paradigm:Sequence" label=">>" 51 source="//@nodes.0" destination="//@nodes.1"/> 618 52 <relations xsi:type="Paradigm:Sequence" label=">>" 53 source="//@nodes.1" destination="//@nodes.2"/> 820 54 <relations xsi:type="Paradigm:Sequence" label=">>" 55 source="//@nodes.2" destination="//@nodes.3"/> 1022 56 <relations xsi:type="Paradigm:Sequence" label=">>" 57 source="//@nodes.3" destination="//@nodes.4"/> 1224 58 </Paradigm:Model> 26 Listing A.1: An example of a .paradigm file with identified patterns 1open28 2typeSearch 3clickSubmit pageChange30 4clickLogin pageChange 5typeEmail32 6typePassword 7clickLogin34 8clickSubmit pageChange 9open36 10 type 11 clickLink pageChange38 12 clickLink pageChange 13 clickLink pageChange40 14 clickLink pageChange 15 typeSearch42 16 clickSubmit pageChange 17 clickLink pageChange44 18 selectSort 19 clickLink pageChange46 20 clickLink pageChange 45 Appendix 21 clickLink pageChange 22 clickLink pageChange 2 23 clickLink pageChange 24 clickLink pageChange 4 25 clickLink pageChange 26 selectSubmit 6 27 clickLogin pageChange 28 clickLink pageChange 8 Listing A.2: The result of LogProcessor executing with the content of Table A.1 as input. 10 1<?xml version="1.0" encoding="UTF-8"?> 2<conf> 12 3<!-- 4actions: number of actions the crawler will execute before stopping 14 5redirections: number of redirects to the home page the crawler will do 6before stopping 16 7politenessDelay: time to wait (in milliseconds) after each action 8typedKeywords: list of words to insert in text input elements 18 9searchKeywords: regex with keywords that identify search elements 10 sortKeywords: regex with keywords that identify sort elements 20 11 loginKeywords: regex with keywords that identify login elements 12 generalWordsToExclude: regex with keywords that mark elements that should not 22 be 13 accessed 24 14 menuIdentifiers: list of ids/classes/names that identify menu elements 15 masterIdentifiers: list of ids/classes/names that identify master elements 26 16 detailIdentifiers: list of ids/classes/names that identify detail elements 17 historyFilepath: specify absolute filepath for history file 28 18 processedHistoryFilepath: specify absolute filepath for processed history file 19 patternsFilepath: specify absolute filepath for PARADIGM model file 30 20 patternsToFind: list of patterns that the explorer can search for. If "all" 21 occurs, there will be no restriction. 32 22 loginConfiguration: credentials for a correct login in the web app. 23 tokenizerPatterns: patterns for LogProcessor 34 24 includeChildrenNodesOnInteraction: boolean; on interaction with an input or 25 select element, if children elements should be included in the history file, 36 26 but not interacted with. 27 -->38 28 <actions>50</actions> 29 <redirections>5</redirections> 40 30 <politenessDelay>500</politenessDelay> 31 <includeChildrenNodesOnInteraction>false</includeChildrenNodesOnInteraction> 42 32 <searchKeywords>(input|select|textarea)(.*(=q|q(ue)?ry|s(ea)?rch|pesq(uisa)?| procura(r)?|busca(dor)?).*)</searchKeywords> 44 33 <sortKeywords>((input|select|textarea).*sort)</sortKeywords> 34 <loginKeywords>(user(name)?|pass(word)?|e?mail|(sign(ed)?(\\s|_)?(in|out)|log(ged 46 )?(\\s|_)?(in|out)))</loginKeywords> 46 Appendix 35 <generalWordsToExclude>(buy|sell|mailto|add(\\s|_)?to(\\s|_)?cart|checkout)</ generalWordsToExclude>2 36 <typedKeywords> 37 <item>curtains</item>4 38 <item>coffee</item> 39 <item>phone</item>6 40 <item>shirt</item> 41 <item>computer</item>8 42 <item>dress</item> 43 <item>banana</item>10 44 <item>sandals</item> 45 </typedKeywords>12 46 <menuIdentifiers> 47 <item>nav</item>14 48 <item>head</item> 49 <item>menu</item>16 50 <item>top</item> 51 <item>head</item>18 52 <item>foot</item> 53 </menuIdentifiers>20 54 <masterIdentifiers> 55 <item>refine</item>22 56 <item>relatedSearches</item> 57 <item>spell</item>24 58 <item>category</item> 59 <item>categories</item>26 60 </masterIdentifiers> 61 <detailIdentifiers>28 62 <item>results</item> 63 <item>searchResults</item>30 64 <item>entry</item> 65 </detailIdentifiers>32 66 <historyFilepath>history.csv</historyFilepath> 67 <processedHistoryFilepath>history.csv.processed</processedHistoryFilepath>34 68 <patternsFilepath>patterns.paradigm</patternsFilepath> 69 <patternsToFind>36 70 <!-- item>All</item--> 71 <item>Search</item>38 72 <item>Sort</item> 73 <item>MasterDetail</item>40 74 <item>Call</item> 75 <item>Input</item>42 76 <item>Login</item> 77 <item>Menu</item>44 78 </patternsToFind> 79 <!-- loginConfiguration>46 80 <username>user-name</username> 81 <password>password</password>48 82 </loginConfiguration--> 47 Appendix 83 <tokenizerPatterns> 84 <patternEntry> 2 85 <name>login</name> 86 <regex>sign(ed)?(\\s|_)?(in|out)|log(ged)?(\\s|_)?(in|out)</regex> 4 87 </patternEntry> 88 <patternEntry> 6 89 <name>submit</name> 90 <regex>submit</regex> 8 91 </patternEntry> 92 <patternEntry> 10 93 <name>homeLink</name> 94 <regex>(home|main(\\s|_)?page|index|logo)</regex> 12 95 </patternEntry> 96 <patternEntry> 14 97 <name>imageLink</name> 98 <regex>link(.*)img|img(.*)link</regex> 16 99 </patternEntry> 100 <patternEntry> 18 101 <name>nextLink</name> 102 <regex>(link(.*)next|next(.*)link)</regex> 20 103 </patternEntry> 104 <patternEntry> 22 105 <name>prevLink</name> 106 <regex>(prev(ious)?(.*)link|link(.*)prev(ious)?)</regex> 24 107 </patternEntry> 108 <patternEntry> 26 109 <name>firstLink</name> 110 <regex>(first(.*)link)</regex> 28 111 </patternEntry> 112 <patternEntry> 30 113 <name>lastLink</name> 114 <regex>(link(.*)last)</regex> 32 115 </patternEntry> 116 <patternEntry> 34 117 <name>languageLink</name> 118 <regex>lang</regex> 36 119 </patternEntry> 120 <patternEntry> 38 121 <name>buttonLink</name> 122 <regex>href.*(button|btn)</regex> 40 123 </patternEntry> 124 <patternEntry> 42 125 <name>searchResultLink</name> 126 <regex>search.*result(.*row)?</regex> 44 127 </patternEntry> 128 <patternEntry> 46 129 <name>link</name> 130 <regex>link|href</regex> 48 131 </patternEntry> 48 Appendix 132 <patternEntry> 133 <name>option</name>2 134 <regex>option</regex> 135 </patternEntry>4 136 <patternEntry> 137 <name>username</name>6 138 <regex>user(\\s|_)?(name|id)?</regex> 139 </patternEntry>8 140 <patternEntry> 141 <name>verifyPassword</name>10 142 <regex>verify(\\s|_)?pass(word)?|pass(word)?(\\s|_)?confirm(ation)?</regex> 143 </patternEntry>12 144 <patternEntry> 145 <name>password</name>14 146 <regex>pass(word)?</regex> 147 </patternEntry>16 148 <patternEntry> 149 <name>email</name>18 150 <regex>e?mail</regex> 151 </patternEntry>20 152 <patternEntry> 153 <name>checkbox</name>22 154 <regex>checkbox</regex> 155 </patternEntry>24 156 <patternEntry> 157 <name>collapse</name>26 158 <regex>collapse</regex> 159 </patternEntry>28 160 <patternEntry> 161 <name>firstNameInput</name>30 162 <regex>(input|textarea).*first(\\s|_)?name</regex> 163 </patternEntry>32 164 <patternEntry> 165 <name>lastNameInput</name>34 166 <regex>(input|textarea).*last(\\s|_)?name</regex> 167 </patternEntry>36 168 <patternEntry> 169 <name>sort</name>38 170 <regex>((input|textarea|select).*sort)</regex> 171 </patternEntry>40 172 <patternEntry> 173 <name>search</name>42 174 <regex>(input|select|textarea)(.*(=q\\s|q(ue)?ry|s(ea)?rch|pesq(uisa)?| procura(r)?|busca(dor)?).*)</regex>44 175 </patternEntry> 176 <patternEntry>46 177 <name>captcha</name> 178 <regex>captcha</regex>48 179 </patternEntry> 49