Generating test case from user interface and mining requirements
University of Engineering and Technology, VNU Faculty of Computer Science Generating test case from user interface and mining requirements Student: Nguyen Le Hoang ID: 08020165 Supervisor: Truong Ninh Thuan Contents 2 Acknowledgements The special thank goes to my helpful supervisor, PhD Trương Ninh Thuận, lecturer at Faculty of Information Technology, University of Engineering and Technology. The supervision that he gave truly helps the progression during my research work. Also, the support that he gave about progression of report and information which faculty provided about submitting report assist me in planning the report completion. My grateful thanks also go to lectures that taught enthusiastically during my research and study at University of Engineering and Technology and brought me the basic knowledge in Computer Science. Thus I could easily study in the research without hesitation. Last but not least I would like to thank my friends and my family who gave a huge contribution during my whole progress of research. 3 Abstract In recent years, the development of computer hardware and software has more important steps. The development of producing software has now become a real industry. As other industries, the function of the software has been produced increasingly complex, and the requirement of managing the quality of software has been concerned increasingly. Therefore, software testing must be done regularly throughout the life cycle of software development to ensure the quality of the software. As we know Graphic User Interface (GUI) is one of the most popular ways for users to interact with software system. At the end of the system testing phase, the tester continued to test the functions of the software provided by GUI and the requirement of software. GUI makes testing the software system more difficult because of the nature of GUI control events, the undesirable events or the infinite domain input/output which programmer unforeseen. Through the GUI, the tester can perform black box testing to find the errors of the software. One of the most important reasons for software testing is to design and create the effective test cases. The cost of software testing often accounts for 40% of the development of a software project. Therefore, reducing costs for creating Test Case (time, effort) is one of the most important problems in software testing. Generating test cases automatically do not only help reducing costs in creating Test Case, but also consistent the quality of test case. Therefore, we research the methods of creating test case from the graphic user interface and the requirement of software to support tester for testing software. This research report includes 4 parts: generating test case from software requirements, generating test case from GUI, applying the method of generating test case from GUI and software requirements for specific examples, and support tool. After researching and testing, in Conclusion, we give some comments and summarize on automatically test case generation tool, and set out directions for further research. 4 Value Domain Modelling Value Domain Modelling Value Idenfy Value Idenfy Requirement Requirement GUI GUI Parameter Modelling Parameter Modelling Testcase Generator Testcase Generator Output Parameter Idenfy Output Parameter Idenfy Chapter 1 Overview of the approach The figure below demonstrates how to generate test case from Graphic User Interface (GUI) and requirement of a software program. As you see, from GUI of the program, we will identify output parameters of the program (such as for a dialog box of a Log in modules, we will have two parameters: username and password of user). Besides, with the requirements of the program, we will also identify output value of each parameter which we have when analyzing GUI (example with Log in modules, the requirement of the system is that the length of the string which user type is less than 20 characters). After that, we will model parameters and values to parameter domain and value domain. Since then, we will generate test cases. How to generate test case will be represented in the detail method bellows. 5 Funcon requirements Requirement Chart Requirement Tesng Speci'caon Tesng Script Tesng Chapter 2 Algorithm and Implementation 2.1 Generating test case from mining requirements Software requirements play an important role in testing software. First, the requirements provide information to check the input / output of the program correct or not. Second, the requirements provide information to choose test case and assess the relevance of testing. Testing based requirements take the information of testing from the requirements of software. In software testing, the requirements-based testing has many advantages: it is simpler than other testing; besides it also increases the quality of software because the development of testing phase along with the implement and design allows the use of testing which standardize the quality of the requirements. General progress is shown in the figure below, or simply here are the steps of the process test case generated from software requirements. Process test case generated from requirements includes the following steps: Step 1: Develop the transition conditions. With a specification language, the transition conditions are encoded directly in the specification (functional specification).With other languages, the conditions may have a metabolic manipulation. 6 Step 2: Develop the specification graph. You can get directly from the graph specification sheet specification. Step 3: Develop the testing requirements. The testing requirements derived from the transfer characteristics and are generated from the transition conditions in step 1. Step 4: Develop the testing requirements of completeness. Build the truth tables for all properties in the specification graph to build the partial expression trees. We can rely on the partial expression trees or based directly on the test specification to edit the properties. Step 5: Develop testing state-transition pair. Identify all pairs of transition by: Listing all the transitions in (M), all the output transitions (N), then create pairs of M * N transition. The forward pair will be replaced by the graph properties from the specification. Step 6: Develop complete testing requirements. Determine the complete list of states by: from specification chart, select the order of the state (this work performed by the tester). Then, build the sequence of attributes. Step 7: Build the testing specification. For each testing requirements generated prefix value, the value of Test Case, confirm the conditions, release conditions, and the desired result. Step 8: Develop test scripts. Each test specification used to build a script. 2.2 Generating test case from GUI Graphic User Interface (GUI) is one of the most popular ways for users to interact with software system. At the end of the system testing phase, the tester continued to test the functions of the software provided by GUI and the requirement of software. GUI makes testing the software system more difficult because of the nature of GUI control events, the undesirable events or the infinite domain input/output which programmer unforeseen. Through the GUI, the tester can perform black box testing to find the errors of the software. The problems is that how to create test case to test, find the error with the highest performance and the minimal cost. 7 Nowadays, there are many methods of generating test case automatically, in which combination testing methods can reduce the costs and increase the efficiency of testing various software applications. We researched this method and apply to generating test case automatically from GUI. Combination testing Combination testing is a combination of the used level parameter to generate one or more test case. With each test case, the order of execution of the input should be identified by the tester. In this method, the tester first determines which parameters through the specification. Since then, they designed using combination testing method to generate test case. Combination testing method will be described in detail below 2.2.1 Parameter and level P has n inputs with the corresponding values are X1, X2, …Xn. Each input is called a parameter. Suppose that each parameter has any value as ci, 1 ≤ i ≤ n. For each value of the parameter is called the level. | F | is the number of levels of the parameter F. Set of values, with each parameter, called the set of parameters. 2.2.2 Combination parameters Example 2.1: Suppose that program P has two input variables are X and Y. In implementing P, suppose X and Y get the corresponding value set: {a, b, c} and {d, e, f}. So we have 2 parameters and each parameter has three levels. So we have 3 * 3 = 9 combinations of parameters: (a, d), (a, e), (a, f), (b, d), (b, e), (b, f), (c, d), (c, e), and (c, f). In general, k parameter and each parameter can take the n value from the set value; the number of possible combinations is n*k. Assuming each parameter combination is a Test Case, with many programs, the test case creation is huge. For example, if a program has 15 parameters, each parameter can get 4 values, the total number of Test Case is 4 ^ 15 ~ 10 ^ 9. To perform a billion times t testing is not practical for many software applications. 8 Example 2.2: User interface GUI of a program has 3 menus: File, Edit and View as the figure Parameter Domain Value File New Open Save Close Edit Select Undo Redo View Hide Zoom in Zoom out Full screen We have 4.3.4 = 48 combination. 2.2.3 Process to design test case The steps to design combination testing: Step 1: Model domain of input values. The model includes a set of parameters and corresponding values (levels) of the parameter. Step 2: This model is input to the design of combinatorial procedures. Combinatorial design procedure allows creating combinatorial objects. Combinatorial object here is simply an array parameter and the corresponding value of the parameter. Step 3: Using the combinatorial object has been created to set up testing. A combinatorial object is an array of parameter combinations. Each parameter can be combined to create one or more Test Case; Test Case includes each value of the inputs and expected outputs. However, all combinations are created is not feasible. Here, step 2 and step 3 can be automated. The combination of the level parameter is used to generate one or more Test Case. For each Test Case, the order of execution of tester input should be identified. 2.3.4 Pairwise testing The purpose of the Pairwise algorithm is to reduce the amount of test case generated based on the input parameters that can still detect the errors of the program or system. The details of this algorithm will be presented in detail in the examples below. Example 4.1: 9 Let's assume a simple program which we have only two checkboxes. A checkbox can be in one of two states—checked or unchecked. Imagine that our defect depends upon checkbox A being unchecked and checkbox B being checked. If we try all of the possible settings in combination with one another, we'll find the defect. We'll set up a table, with a row for each variable. Within each cell, we'll put one of the variable's possible states—set or cleared. In the leftmost column, we'll put an index number so that we can refer to each combination by number. Combination Number Box A Box B 1 Checked Checked 2 Unchecked Checked 3 Checked Unchecked 4 Unchecked Unchecked Combinations 1, 3, and 4 work all right; but Combination 2 exhibits the problem. We'd require four tests to make sure that we had covered all of the combinations in which A and B could be found. Two variables and two settings for each have four combinations. Examples 4.2: Check airplane A little more complex example: a black-box test of a dialog with three sets of radio buttons on it, representing travel needs in North America. The first set of radio buttons specifies a destination, by country; the second notes the choice of an aisle or window seat; and the third affords the choice of coach, business, or economy class. When the user makes her selections and presses "OK" to close the dialog, the application will take on a different path of execution for each combination of given options in given states. As usual, the simplest kind of problem to detect is one that is triggered by a single variable in a single state. This is called a single-mode fault (Phadke1997). For example, consider an application that contains a defect causes it to behave bizarrely when the "destination" option is set to "Canada". Naturally, the way to find such a defect would be to ensure that we run at least one test with "destination" set to "Canada". Assume now that there is a defect that depends upon two conditions—for example, the destination field being set to "Mexico" and the service class being set to "Business" at the same time. This is known as a double-mode fault. It should be clear if we run at least one 10 [...]... the popular methods of generating test case automatically, thereby building a method of generating automatically test case from the interface and mining requirements Application of the method of generating automatically Test Case from the interface, we have built successful Test Case generation tools automatically Through the implementation of this report, we found that automated testing allows reducing... Conclusion Through understanding the theory of testing, automated testing and the Test Case generation method as well as automatically apply theory to the construction of Test Case generation tools automatically Thesis has achieved the following results: First of all, we have learned and presented an overview of testing, the role and benefits of automated testing and classification of test automation tools... development company, most of the work of testers is done manually by hand One of the important works in the testing process is the creation of test case To solve this problem, we will build a tool from the method of generating test case from GUI and requirement that were introduced in previous chapters 4.1 Design features 4.1.1 Design Overview Automatic test case generation tools will open a file that... specification and design will increase the time to solve the problem in testing Automatically create and test the right test cases overlap or not effective 4.3.2 Disadvantages The program only processed the interface file of C # and restrict the automatically analysis for the interface components as a button, textbox, checkbox and combo box Tester must ask who has the ability to analyze and design systems Tester... Advantages and disadvantages of the tool 4.3.1 Advantages The process of creating test case is automatically, the time to produce software is shortened, and there is the better quality of the software The process of generating test case is automatically to generate more test cases and found many errors Tester will not be boring when they perform a task repeatedly 30 Early detection of errors and uncertainties... coverage reduces the tests to 6 18 Chapter 3 Applying the method for specific examples 3.1 Testing Login form Login dialog for an application: The purpose of this dialog box to authenticate users and allow users to log or block users logged into the system Suppose that there are management and user and password processing components for each user We have the GUI of the software as follows: From GUI of the... see that test case set which we will generate includes 3 parameters: username, password and button Besides, the software requirements of this dialog are: A text box allows you to type user name: allows the user to enter registered user name Each user corresponds to a string has the limit length: 20 characters If users click the OK button, the program will check the entered password or not; and if the... makes sure that Canada is tested at least once with each of Coach, Business Class, and First Class, and with the checkbox in the Aisle state and the Window state Similarly, every option is tested with every other option We capture the double-mode fault exposed in combination number 3; we need not test combination 12 Using pairwise testing, we reduce 18 test cases to 9 test cases The easiest thing to... unwanted combination In order to reduce test case, first of all, good testers need to open the interface file of a project, the program will automatically search for the interface elements and then will automatically generate the parameters and the value of the parameter, and is to appear on the screen test After receiving the parameters and values of each parameter, testers will check to see which one... dictionary • If not, report that the formula does not exist 4.2.5 Test case generated form After entering the parameters, return results, performance conditions, the tool will automatically generate test case through Test case generated form When you click on the Optimize: test case is generated list will appear in the table below 28 Export Test Case files the forms: • • • • Export to Excel file Export data