WO2020085129A1 - テストデータ生成装置、テストデータ生成方法及びプログラム - Google Patents

テストデータ生成装置、テストデータ生成方法及びプログラム Download PDF

Info

Publication number
WO2020085129A1
WO2020085129A1 PCT/JP2019/040308 JP2019040308W WO2020085129A1 WO 2020085129 A1 WO2020085129 A1 WO 2020085129A1 JP 2019040308 W JP2019040308 W JP 2019040308W WO 2020085129 A1 WO2020085129 A1 WO 2020085129A1
Authority
WO
WIPO (PCT)
Prior art keywords
constraint
test data
test
input
screen
Prior art date
Application number
PCT/JP2019/040308
Other languages
English (en)
French (fr)
Inventor
弘之 切貫
利行 倉林
治門 丹野
Original Assignee
日本電信電話株式会社
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 日本電信電話株式会社 filed Critical 日本電信電話株式会社
Priority to US17/288,352 priority Critical patent/US20210382810A1/en
Publication of WO2020085129A1 publication Critical patent/WO2020085129A1/ja

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Definitions

  • the present invention relates to a test data generation device, a test data generation method, and a program.
  • test case that is, an input value used for the test
  • symbolic execution Symbolic Execution
  • dynamic symbolic execution Dynamic Symbolic Execution
  • Symbolic execution is a method of deriving a condition of an input value for passing an arbitrary path by symbolizing an input and executing a program in a pseudo manner.
  • the dynamic symbolic execution is a method that combines the execution of a program using a specific value and the symbolic execution. In symbolic execution and dynamic symbolic execution, it is possible to generate test input values that cover paths.
  • Non-Patent Document 2 a method is known in which the behavior of an application is modeled and test input values are exhaustively generated from the model.
  • the constraint is a condition that an input value should be satisfied alone, a condition that should be satisfied between a plurality of input values, or the like.
  • the present invention has been made in view of the above points, and it is an object of the present invention to reduce the number of web application test steps.
  • the embodiment of the present invention is a test data generation device that generates test data for a test related to screen transition provided by a Web application, and includes one or more screen transitions among the screen transitions.
  • a variation that is, an input value to be tested by executing the test script
  • a test script for testing the equivalence partitioning and the boundary value analysis which are important test viewpoints in the testing of the Web application.
  • a method for automatically generating a variation will be described.
  • the test script is a script that tests a certain test case. For example, an operation command to the screen and an input value input or set in the input form included in this screen are described. It is data.
  • a screen transition test for testing the transition between screens provided by the Web application is assumed.
  • the test involving screen operation is automated.
  • the input value in the embodiment of the present invention is data used as input in the test of the Web application, and thus may be referred to as test data or the like.
  • test cases for equivalence division and boundary value analysis were often designed by a user who grasped the specifications of the Web application, taking time.
  • FIG. 1 is a diagram showing an example of the overall configuration of a system according to an embodiment of the present invention.
  • the system includes a client device 10 and a server device 20.
  • the client device 10 and the server device 20 are communicably connected via a network N such as a LAN (Local Area Network) or the Internet.
  • a network N such as a LAN (Local Area Network) or the Internet.
  • the server device 20 is a computer or a computer system that provides a Web application.
  • the Web application provided by the server device 20 is software (application) to be tested.
  • the client device 10 is a device that supports the test of the Web application provided by the server device 20. That is, the client device 10 is a device that generates a variation of a test script that tests equivalence division and boundary value analysis.
  • a PC personal computer
  • the present invention is not limited to this, and a smartphone, a tablet terminal, or the like may be used, for example.
  • the overall configuration of the system shown in FIG. 1 is an example, and other configurations may be used.
  • the system according to the embodiment of the present invention may include a plurality of client devices 10 and a plurality of server devices 20.
  • FIG. 2 is a diagram for explaining an outline of generation of a test script variation.
  • the client device 10 performs a static analysis and a dynamic analysis by inputting the source code of the Web application, and thereby a screen transition diagram showing a transition relationship between screens and a test script corresponding to each screen transition. And a test script group that is a set of.
  • the screen transition diagram and the test script group can be generated, for example, by the technique described in Japanese Unexamined Patent Application Publication No. 2018-116496.
  • the embodiment of the present invention will be described on the assumption that the screen transition diagram and the test script group described above are generated by the technique described in Japanese Patent Laid-Open No. 2018-116496.
  • the user of the client device 10 selects or specifies the screen transition (hereinafter also referred to as “target transition”) for which a variation of the test script is to be generated, from the screen transitions on the screen transition diagram.
  • target transition the screen transition
  • the test script corresponding to the target transition (hereinafter, also referred to as “target test script”) is specified from the test script group, and the input form group corresponding to the target transition is specified.
  • the input form group corresponding to the target transition is a set of input forms included in the transition source screen.
  • the client device 10 extracts the constraint regarding the input value from the source code of the Web application and creates the constraint information.
  • the client device 10 uses the constraint information and the input value candidates to generate an input value set group which is a set of input value sets for the input form group.
  • the input value candidate is a set of input values prepared in advance.
  • the information of requesting the user of the client device 10 to assist in the generation of the input value is output.
  • the input value set is complemented by the user inputting input values.
  • target test script group a test script group composed of these target test scripts.
  • FIG. 3 is a diagram showing an example of a hardware configuration of the client device 10 according to the embodiment of the present invention.
  • the client device 10 includes, as hardware, an input device 11, a display device 12, a RAM (Random Access Memory) 13, and a ROM (Read Only Memory) 14. It has a processor 15, an external I / F 16, a communication I / F 17, and an auxiliary storage device 18. Each of these pieces of hardware is communicatively connected via a bus 19.
  • the input device 11 is, for example, a keyboard, a mouse, a touch panel, etc., and is used by the user to input various operations.
  • the display device 12 is, for example, a display or the like, and is used to display various processing results and the like to the user.
  • RAM 13 is a volatile semiconductor memory that temporarily holds programs and data.
  • the ROM 14 is a non-volatile semiconductor memory that can retain programs and data even when the power is turned off.
  • the processor 15 is, for example, a CPU (Central Processing Unit) or the like, and is an arithmetic device that reads a program or data from the ROM 14, the auxiliary storage device 18, or the like onto the RAM 13 and executes processing.
  • CPU Central Processing Unit
  • the external I / F 16 is an interface with an external device.
  • the external device includes the recording medium 16a and the like.
  • Examples of the recording medium 16a include a CD (Compact Disc), a DVD (Digital Versatile Disk), an SD memory card (Secure Digital memory card), and a USB (Universal Serial Bus) memory card.
  • the recording medium 16a may have recorded therein one or more programs or the like that realize the respective functions of the client device 10.
  • the communication I / F 17 is an interface for connecting the client device 10 to the network N.
  • the client device 10 can perform data communication with the server device 20 via the communication I / F 17.
  • the auxiliary storage device 18 is a non-volatile storage device such as an HDD (Hard Disk Drive) or an SSD (Solid State Drive).
  • the auxiliary storage device 18 stores one or more programs and the like that realize the respective functions of the client device 10.
  • the client device 10 according to the embodiment of the present invention can realize various processes described later by having the hardware configuration shown in FIG.
  • FIG. 3 shows the case where the client device 10 according to the embodiment of the present invention is realized by one information processing device (computer), the present invention is not limited to this.
  • the client device 10 according to the embodiment of the present invention may be realized by a plurality of information processing devices (computers).
  • FIG. 4 is a diagram showing an example of a functional configuration of the client device 10 according to the embodiment of the present invention.
  • the client device 10 has, as functional units, a target transition selection unit 101, a constraint extraction unit 102, an input value generation unit 103, and a target test script group generation unit 104. Have and. Each of these functional units is realized by a process that causes the processor 15 to execute one or more programs installed in the client device 10.
  • the target transition selection unit 101 receives selection or designation of a target transition from screen transitions on the screen transition diagram. When a plurality of target transitions are selected or designated, the target transition selection unit 101 accepts selection or designation of these plurality of target transitions. In addition, when the target transition is selected or designated, the input form group included in the transition source screen (that is, the input form group in the form tag including the button or link that becomes a trigger to transit to the transition destination screen) ) Is specified.
  • the constraint extraction unit 102 extracts constraints from the source code of the Web application, and creates constraint information including these extracted constraints. Note that the constraints are roughly classified into single item constraints and correlated item constraints.
  • the single item constraint is a constraint that represents a condition that one input value should satisfy alone
  • the correlated item constraint is a constraint that represents a condition that should be satisfied between a plurality of input values.
  • the single item restriction for example, "only full-width katakana must be entered in the reading input field” can be cited.
  • the plural item restriction for example, "the date in the start date input field must be earlier than the date in the end date input field” and the like.
  • the constraint extraction unit 102 parses (analyzes) the source code and extracts a description for using the above-mentioned mechanism or function (validator) as a constraint.
  • constraints are defined by adding annotations. Specifically, for example, the constraint that "the minimum length of the character string name is 1, the maximum length is 20 and it does not become an empty character" is defined as follows.
  • the constraint extraction unit 102 parses (analyzes) the source code and extracts the constraints from the description specifications defined or defined by the validator provided by the framework of the Web application. That is, the constraint extraction unit 102 functions as a parser that extracts or acquires constraints from the source code. Therefore, when the framework of the Web application provides the validator, the constraint extraction unit 102, if implemented as a parser corresponding to this framework, can be used as a source developed using any framework. You can also extract constraints from code.
  • the constraint extraction unit 102 cannot basically extract the originally implemented constraint, but, for example, by additionally introducing a module or a plug-in that can also analyze the originally implemented constraint, It will be possible to extract such constraints that are implemented independently.
  • the input value generation unit 103 uses the constraint information and the input value candidates to generate an input value set group which is a set of input value sets for the input form group.
  • the input value candidates are given in advance by the user or the like.
  • the input value generation unit 103 generates each input value included in the input value set based on the viewpoint of equivalence division and the viewpoint of boundary value analysis.
  • Equivalence division means that a group of input values whose output results are the same is treated as one equivalence class. If one representative value is tested as an input value from that equivalence class, all input values in that equivalence class are tested. Is a test method that is regarded as tested.
  • the equivalence division the infinite input value space can be limited and the number of test cases can be reduced.
  • the validator provided by the framework of the Web application can be divided into two classes, “satisfies the constraint” or “does not satisfy the constraint”. At this time, a value that satisfies the constraint is called an “IN point” (or “valid equivalence”), and a value that does not satisfy the constraint is called an “OUT point” (or “invalid equivalence”).
  • Boundary value analysis is a test method that tests using input values near the boundary between equivalence classes. This is a method based on the empirical rule that bugs are likely to lie near the boundary value. A value on the boundary value is called an “ON point”, and a value near the boundary value is called an “OFF point”.
  • an input value is generated such that all equivalence classes are tested and then ON points and OFF points (near before and after the boundary value) of all boundary values are also tested.
  • the table below shows the above 6 values arranged from the viewpoint of equivalence division and the analysis of boundary values.
  • the input value generation unit 103 refers to the constraint corresponding to the input form among the constraints included in the constraint information, and refers to the input value that satisfies the viewpoint of equivalence division and the boundary value analysis (that is, all input values). After the equivalence class is tested, input values for testing ON points and OFF points of all boundary values are generated.
  • the constraint is not limited to a linear constraint such as the above-mentioned “1 ⁇ x and x ⁇ 10” (that is, a relation of magnitude of linear numerical values), but also a constraint using a nonlinear constraint or a regular expression ( In other words, there are restrictions) that are difficult to solve mechanically.
  • the constraint corresponding to the input form is a non-linear constraint or a constraint using a regular expression, it is difficult to mechanically generate an input value as described above. Therefore, in the embodiment of the present invention, the input value generation unit 103 generates the input value in the following three stages.
  • the input value generation unit 103 determines whether or not to perform equivalence division. Generate input values that satisfy the viewpoint of boundary value analysis. Ie. The input value generation unit 103 generates, for example, one input value included in each equivalence class and also generates ON points and OFF points of the boundary values of each equivalence class.
  • the input value generation unit 103 determines, among the input values included in the input value candidates, the viewpoint of equivalence division and An input value that satisfies at least one of the viewpoints of boundary value analysis is specified, and this input value is acquired (extracted).
  • the input value generating unit 103 acquires (extracts) these input values from the input value candidates.
  • the input value generation unit 103 When there is a viewpoint for which an input value was not obtained in (2) above (that is, for a certain constraint, an input value was obtained from at least one of the equivalence division viewpoint and the boundary value analysis viewpoint). If not), the input value generation unit 103 outputs information asking the user for assistance regarding the constraint and the viewpoint that the input value was not obtained by the constraint.
  • the IN point cannot be obtained with a certain constraint B
  • information regarding the IN point of the constraint B that asks the user for assistance is output. Accordingly, the user directly inputs or specifies the input value with respect to the viewpoint of the constraint.
  • the target test script group generation unit 104 sets each input value set included in the input value set group for the target test script (that is, for the corresponding description of the target test script, included in the input value set). By setting (or embedding) the input value, the target test script corresponding to each input value set is generated. As a result, the target test script group is generated.
  • the client device 10 inputs the source code of the Web application and performs static analysis and dynamic analysis to generate a screen transition diagram and a test script group. It also has a functional part. However, the client device 10 may not have the functional unit. In this case, the client device 10 may acquire and input the screen transition diagram and the test script group generated by another device (for example, a device connected to the client device 10 via a network).
  • another device for example, a device connected to the client device 10 via a network.
  • FIG. 5 is a flowchart showing an example of variation generation processing of a test script corresponding to a target transition.
  • the target transition selection unit 101 receives selection or designation of a target transition from screen transitions on the screen transition diagram (step S101).
  • the screen transition diagram is a diagram showing a transition relationship between screens.
  • the screen transition diagram shown in FIG. 6 shows the transition relationship among the screen A, the screen B, and the screen C.
  • the screen transition from screen A to screen B is “screen transition AB”
  • the screen transition from screen A to screen C is “screen transition AC”
  • the screen transition from screen C to screen B is “screen transition AB”.
  • Screen transition CB Screen transition CB ”.
  • the user selects or specifies one or more desired screen transitions (that is, target transitions) from the screen transitions on the screen transition.
  • target transitions that is, target transitions
  • step S102 the constraint extraction unit 102 extracts constraints from the source code of the Web application and creates constraint information including these extracted constraints.
  • the details of the process of step S102 (constraint extraction process) will be described later.
  • the input value generation unit 103 generates an input value set group, which is a set of input value sets for the input form group, using the constraint information and the input value candidates (step S103). The details of the processing of this step S103 (input value generation processing) will be described later.
  • the target test script group generation unit 104 generates the target test script group by setting each input value set included in the input value set group for the target test script (step S104). Details of the process of step S104 (process of generating a test script group corresponding to the target transition) will be described later.
  • the target test script group in which multiple input value sets are set can be obtained. Therefore, by using the target test script group, the user can carry out various variations of tests satisfying the viewpoint of equivalence division and the viewpoint of boundary value analysis.
  • FIG. 7 is a flowchart showing an example of the constraint extraction processing.
  • the constraint extraction unit 102 reads the source code of the Web application (step S201). Next, the constraint extraction unit 102 determines whether the framework of the Web application is the target framework (step S202).
  • the target framework is a framework in which the constraint extraction unit 102 that functions as a parser can extract constraints. Whether or not the framework is the target framework can be determined, for example, from the description (for example, “package statement”) in the source code.
  • the constraint extraction unit 102 parses (analyzes) the source code and restricts the target transition (that is, the constraint to be determined or verified when performing the target transition). ), The server-side constraint is extracted (step S203). Note that the server-side constraint is a constraint that determines (or verifies) whether or not the condition is satisfied on the server side.
  • the constraint extraction unit 102 reads the rendered HTML (HyperText Markup Language) (step S204).
  • the rendered HTML includes, for example, JSP (Java (registered trademark) Server Pages), PHP, and the like, and is a source code described in HTML tags, HTML output from a servlet, and the like.
  • the constraint extraction unit 102 parses (analyzes) the source code and extracts client-side constraints from the constraints regarding the target transition (step S205).
  • the constraint extracting unit 102 creates constraint information including the constraints extracted in the above steps S203 and S205 (step S206).
  • the client device 10 ends the variation generation process of the test script corresponding to the target transition (step S207). This is because the constraint cannot be automatically extracted from the source code in this case.
  • FIG. 8 is a flowchart showing an example of input value generation processing.
  • the input value generation unit 103 performs steps S301 to S308 for each input form (that is, each input form included in the input form group) in the form tag defined in the HTML rendered in step S204 described above. Execute the process.
  • the HTML (that is, the screen) rendered in step S204 is as shown in FIG. 9, the input form in the form tag is "input form 1", “input form 2", " Input form 3 "is displayed. Therefore, in this case, the processes of steps S301 to S308 are executed for the "input form 1", “input form 2", and “input form 3", respectively.
  • a certain one input form is fixed and the processing of steps S301 to S308 will be described.
  • the input value generation unit 103 refers to the constraint of the corresponding input form among the constraints included in the constraint information (step S302), and determines whether or not the constraint has a linear magnitude relationship (step S303). ).
  • the input value generation unit 103 When the constraint has a linear magnitude relationship (YES in step S303), the input value generation unit 103 generates an input value that satisfies the viewpoint of equivalence division and the boundary value analysis (step S304). Thereby, with respect to the constraint of the input form, a plurality of input values satisfying the viewpoint of equivalence division and the viewpoint of boundary value analysis are generated.
  • the input value generation unit 103 inputs one or more input values that satisfy at least one of the viewpoint of equivalence division and the viewpoint of boundary value analysis.
  • the value candidates are specified (step S305).
  • the constraint is, for example, a non-linear constraint or a constraint using a regular expression.
  • the input value generation unit 103 determines whether or not the input value is specified in the above step S305 (step S306).
  • step S305 When the input value is specified in step S305 (YES in step S306), the input value generation unit 103 acquires (extracts) the specified one or more input values from the input value candidates (step S307). As a result, regarding the constraint of the input form, the one or more input values become the input value of the viewpoint specified as satisfying in step S305.
  • step S305 if the input value is not specified in step S305 (NO in step S306), the client device 10 proceeds to step S308.
  • the input value is obtained only by being input or designated by the user.
  • the input value generation unit 103 outputs information requesting assistance to the user regarding the viewpoint that the input value was not obtained (step S309).
  • the information may be, for example, information including an input form in which a viewpoint for which an input value was not obtained exists and its constraint, and the viewpoint.
  • the output destination of the information may be, for example, the display device 12 or the like.
  • the input value generation unit 103 receives input of one or more input values input by the user according to the information output in step S309 (step S310).
  • the input value is complemented by the user input even for the constraint for which the input value cannot be obtained for some or all of the viewpoints. That is, as a result, an input value set is generated for each input form included in the input form group, and an input value set group that is a set of these input value sets is obtained.
  • the input value set is a set of input values for each of the input forms included in the input form group. Therefore, the input value set group is a variation of the input value set.
  • steps S301 to S308 described above if input values are obtained from all viewpoints of equivalence division and boundary value analysis for all input form restrictions, the processing of steps S309 to S310 described above is performed. It does not have to be executed.
  • FIG. 10 is a flowchart showing an example of the generation process of the test script group corresponding to the target transition.
  • the target test script group generation unit 104 acquires the test script (that is, the target test script) corresponding to the target transition from the test script group (step S401).
  • the test script that is, the target test script
  • each screen transition on the screen transition diagram and each test script included in the test script group Since and correspond to each other, by selecting or designating the target transition, the test script (that is, the target test script) corresponding to the target transition can be specified and acquired.
  • the target test script group generation unit 104 executes the processing of steps S402 to S406 for each input value set included in the input value set group generated by the input value generation processing of FIG.
  • steps S402 to S405 will be described.
  • the target test script group generation unit 104 identifies the input form in the form tag related to the target transition among the input forms in the HTML form tag rendered in step S204 of FIG. 7 (step S403).
  • the target test script group generation unit 104 sets the target test script in which the input value for each of the input forms identified in step S403 is the corresponding input value among the input values included in the input value set group. It is generated (step S404). As a result, one target test script is generated. Therefore, the target test script group is generated by executing the processing of steps S402 to S405 for all the input value sets.
  • the client device 10 automatically generates variations of input values that satisfy the respective viewpoints of equivalence division and boundary value analysis, which are important test viewpoints in the testing of Web applications.
  • the client device 10 according to the embodiment of the present invention automatically generates an input value when the constraint of the input form is a linear constraint, and the non-linear constraint or the constraint using the regular expression is used. If there is, it tries to acquire the input value from the input value candidates. Then, when there is a viewpoint that an input value is not obtained for a certain input form, the user is requested to input the input value for the input form.
  • it is possible to obtain a variation of the input value that satisfies the viewpoints of the equivalence division and the boundary value analysis, while significantly reducing the number of steps for the user to create the input value.
  • the variation of the test script is created using the variation of the input value obtained as described above.
  • the variation test of the Web application can be easily performed by executing the test script obtained as the variation.
  • Client Device 20 Server Device 101 Target Transition Selection Unit 102 Constraint Extraction Unit 103 Input Value Generation Unit 104 Target Test Script Group Generation Unit

Abstract

Webアプリケーションが提供する画面遷移に関するテストのテストデータを生成するテストデータ生成装置であって、前記画面遷移のうち、1以上の画面遷移の選択を受け付ける選択受付手段と、前記Webアプリケーションのフレームワークで規定又は定義されている制約の記述仕様を用いて、前記Webアプリケーションのソースコードを解析し、該ソースコードから制約を抽出する抽出手段と、前記選択された画面遷移の遷移元の画面に含まれる入力フォームの前記制約を用いて、同値分割及び境界値分析のテスト観点を満たす複数のテストデータを生成する生成手段と、を有することを特徴とする。

Description

テストデータ生成装置、テストデータ生成方法及びプログラム
 本発明は、テストデータ生成装置、テストデータ生成方法及びプログラムに関する。
 Webアプリケーション等のソフトウェアテストを支援する手法として、テストケース(つまり、テストに用いる入力値)を自動的に生成する手法が従来から知られている。
 例えば、テストケースを自動的に生成する手法として、シンボリック実行(Symbolic Execution)や動的シンボリック実行(Dynamic Symbolic Execution)が知られている(非特許文献1)。シンボリック実行とは、入力を記号化してプログラムを疑似的に実行することで、任意のパスを通るための入力値の条件を導出する手法である。一方で、動的シンボリック実行とは、具体的な値を用いたプログラムの実行と、シンボリック実行とを組み合わせた手法である。シンボリック実行や動的シンボリック実行では、パスを網羅するようなテストの入力値を生成することができる。
 また、例えば、アプリケーションの振る舞いをモデル化し、モデルからテストの入力値を網羅的に生成する手法も知られている(非特許文献2)。この手法では、モデルを人手で記述する必要があるものの、アプリケーションがモデルに従っているか否かを正確にテストすることができる。
Koushik Sen, Darko Marinov, and Gul Agha. 2005. CUTE: a concolic unit testing engine for C. In Proceedings of the 10th European software engineering conference held jointly with 13th ACM SIGSOFT international symposium on Foundations of software engineering (ESEC/FSE-13). ACM, New York, NY, USA, 263-272. DOI=http://dx.doi.org/10.1145/1081706.1081750 丹野 治門, 張 暁晶: "ドメインテスト技法に基づく網羅的なテストデータ自動生成手法の提案", 情報処理学会 研究報告ソフトウェア工学 , vol. 2014-SE-186, no. 6, pp.1-8, 2014年11月
 しかしながら、上記の非特許文献1や非特許文献2に記載されている手法では、一般的な入力値に関する制約を自動的に取得することが困難であった。なお、制約とは、入力値が単独で満たすべき条件や複数の入力値間で満たすべき条件等のことである。
 例えば、シンボリック実行や動的シンボリック実行では、Webアプリケーションではデータのやり取りが複数のプログラミング言語やDB(データベース)に跨って行われることが一般的であるため、アプリケーション全体にわたる解析が困難である。また、例えば、GUIテスト等ではユーザのユースケースに沿ったテストが行われることが一般的であるが、シンボリック実行や動的シンボリック実行では入力値がパスを網羅するように生成されるため、テスト観点として不適切なテストケースが生成されてしまう場合がある。
 また、例えば、アプリケーションの振る舞いをモデル化する手法では、制約を人手でモデルに記述する必要があるため、手間が掛かかると共に、制約の数が多い場合に記述自体が困難になる。
 このため、制約を解いて、テストケースとして与えるべき入力値を生成することが困難であった。これに対して、自動的に制約を取得し、これらの制約から、テストケースとして与えるべき入力値を生成することができれば、テスト工数を削減することができると考えられる。
 本発明は、上記の点に鑑みてなされたもので、Webアプリケーションのテスト工数を削減することを目的とする。
 上記目的を達成するため、本発明の実施の形態は、Webアプリケーションが提供する画面遷移に関するテストのテストデータを生成するテストデータ生成装置であって、前記画面遷移のうち、1以上の画面遷移の選択を受け付ける選択受付手段と、前記Webアプリケーションのフレームワークで規定又は定義されている制約の記述仕様を用いて、前記Webアプリケーションのソースコードを解析し、該ソースコードから制約を抽出する抽出手段と、前記選択された画面遷移の遷移元の画面に含まれる入力フォームの前記制約を用いて、同値分割及び境界値分析のテスト観点を満たす複数のテストデータを生成する生成手段と、を有することを特徴とする。
 Webアプリケーションのテスト工数を削減することができる。
本発明の実施の形態におけるシステムの全体構成の一例を示す図である。 テストスクリプトのバリエーション生成の概略を説明するための図である。 本発明の実施の形態におけるクライアント装置のハードウェア構成の一例を示す図である。 本発明の実施の形態におけるクライアント装置の機能構成の一例を示す図である。 対象遷移に対応するテストスクリプトのバリエーション生成処理の一例を示すフローチャートである。 画面遷移の一例を示す図である。 制約の抽出処理の一例を示すフローチャートである。 入力値の生成処理の一例を示すフローチャートである。 入力フォームの一例を示す図である。 対象遷移に対応するテストスクリプト群の生成処理の一例を示すフローチャートである。
 以下、本発明の実施の形態について、図面を参照しながら詳細に説明する。本発明の実施の形態では、一般に、Webアプリケーションのテストにおける重要なテスト観点である同値分割及び境界値分析をテストするテストスクリプトについて、そのバリエーション(つまり、テストスクリプトの実行によってテストされる入力値のバリエーション)を自動的に生成する手法について説明する。ここで、テストスクリプトとは、或るテストケースをテストするスクリプトのことであり、例えば、画面への操作命令と、この画面に含まれる入力フォームに入力又は設定される入力値とが記述されたデータのことである。なお、本発明の実施の形態では、Webアプリケーションが提供する画面間の遷移をテストする画面遷移テストを想定する。
 テストスクリプトに記述された操作命令が自動実行されることで、画面操作を伴うテストが自動化される。なお、本発明の実施の形態における入力値は、Webアプリケーションのテストにおいて、入力として用いられるデータのことであるから、テストデータ等と称されても良い。
 従来では、同値分割及び境界値分析のテストケースは、例えば、Webアプリケーションの仕様を把握したユーザが時間を掛けて設計する場合が多かった。本発明の実施の形態で説明する手法を用いることで、同値分割や境界値分析をテストするテストスクリプトのバリエーションを生成することができるため、テスト(例えば、回帰テスト等)に要する工数を削減することができる。
 <全体構成>
 まず、本発明の実施の形態におけるシステムの全体構成について、図1を参照しながら説明する。図1は、本発明の実施の形態におけるシステムの全体構成の一例を示す図である。
 図1に示すように、本発明の実施の形態におけるシステムには、クライアント装置10と、サーバ装置20とが含まれる。また、クライアント装置10とサーバ装置20とは、例えば、LAN(Local Area Network)やインターネット等のネットワークNを介して通信可能に接続される。
 サーバ装置20は、Webアプリケーションを提供するコンピュータ又はコンピュータシステムである。サーバ装置20が提供するWebアプリケーションが、テスト対象となるソフトウェア(アプリケーション)である。
 クライアント装置10は、サーバ装置20が提供するWebアプリケーションのテストを支援する装置である。すなわち、クライアント装置10は、同値分割及び境界値分析をテストするテストスクリプトのバリエーションを生成する装置である。なお、クライアント装置10としてはPC(パーソナルコンピュータ)等が用いられるが、これに限られず、例えば、スマートフォンやタブレット端末等が用いられても良い。
 なお、図1に示すシステムの全体構成は一例であって、他の構成であっても良い。例えば、本発明の実施の形態におけるシステムには、複数台のクライアント装置10や複数台のサーバ装置20が含まれていても良い。
 <テストスクリプトのバリエーション生成の概略>
 次に、クライアント装置10がテストスクリプトのバリエーションを生成する場合の概略について、図2を参照しながら説明する。図2は、テストスクリプトのバリエーション生成の概略を説明するための図である。
 まず、クライアント装置10は、Webアプリケーションのソースコードを入力として、静的解析及び動的解析を行うことで、各画面間の遷移関係を表す画面遷移図と、各画面遷移にそれぞれ対応するテストスクリプトの集合であるテストスクリプト群とを生成する。これらの画面遷移図及びテストスクリプト群は、例えば、特開2018-116496号公報に記載されている技術により生成することができる。本発明の実施の形態では、特開2018-116496号公報に記載されている技術により、上記の画面遷移図及びテストスクリプト群が生成されていることを前提として説明する。
 クライアント装置10のユーザは、テストスクリプトのバリエーションを生成したい画面遷移(以降、「対象遷移」とも表す。)を、画面遷移図上の画面遷移の中から選択又は指定する。これにより、テストスクリプト群の中から、対象遷移に対応するテストスクリプト(以降、「対象テストスクリプト」とも表す。)が特定されると共に、対象遷移に対応する入力フォーム群が特定される。なお、対象遷移に対応する入力フォーム群とは、遷移元の画面に含まれる入力フォームの集合のことである。また、クライアント装置10は、Webアプリケーションのソースコードから、入力値に関する制約を抽出して制約情報を作成する。
 次に、クライアント装置10は、制約情報や入力値候補を用いて、入力フォーム群に対する入力値セットの集合である入力値セット群を生成する。ここで、入力値候補とは、予め準備された入力値の集合のことである。
 このとき、入力値を生成することができなかった制約については、クライアント装置10のユーザに対して、入力値の生成に関して補助を求める情報を出力する。これに対して、ユーザが入力値の入力等を行うことで、入力値セットを補完する。
 そして、対象テストスクリプトに対して、入力値セット群に含まれる各入力値セットを設定することで、各入力値セットにそれぞれ対応する対象テストスクリプトを生成する。これにより、対象テストスクリプトのバリエーションとして、これらの対象テストスクリプトで構成されるテストスクリプト群(以降、「対象テストスクリプト群」とも表す。)が生成される。
 <クライアント装置10のハードウェア構成>
 次に、本発明の実施の形態におけるクライアント装置10のハードウェア構成について、図3を参照しながら説明する。図3は、本発明の実施の形態におけるクライアント装置10のハードウェア構成の一例を示す図である。
 図3に示すように、本発明の実施の形態におけるクライアント装置10は、ハードウェアとして、入力装置11と、表示装置12と、RAM(Random Access Memory)13と、ROM(Read Only Memory)14と、プロセッサ15と、外部I/F16と、通信I/F17と、補助記憶装置18とを有する。これら各ハードウェアは、それぞれがバス19を介して通信可能に接続されている。
 入力装置11は、例えばキーボードやマウス、タッチパネル等であり、ユーザが各種操作を入力するのに用いられる。表示装置12は、例えばディスプレイ等であり、ユーザに対して各種処理結果等を表示するのに用いられる。
 RAM13は、プログラムやデータを一時保持する揮発性の半導体メモリである。ROM14は、電源を切ってもプログラムやデータを保持することができる不揮発性の半導体メモリである。プロセッサ15は、例えばCPU(Central Processing Unit)等であり、ROM14や補助記憶装置18等からプログラムやデータをRAM13上に読み出して処理を実行する演算装置である。
 外部I/F16は、外部装置とのインタフェースである。外部装置には、記録媒体16a等がある。記録媒体16aとしては、例えば、CD(Compact Disc)、DVD(Digital Versatile Disk)、SDメモリカード(Secure Digital memory card)、USB(Universal Serial Bus)メモリカード等が挙げられる。記録媒体16aには、クライアント装置10が有する各機能を実現する1以上のプログラム等が記録されていても良い。
 通信I/F17は、クライアント装置10をネットワークNに接続するためのインタフェースである。クライアント装置10は、通信I/F17を介して、サーバ装置20との間でデータ通信を行うことができる。
 補助記憶装置18は、例えばHDD(Hard Disk Drive)やSSD(Solid State Drive)等の不揮発性の記憶装置である。補助記憶装置18には、クライアント装置10が有する各機能を実現する1以上のプログラム等が記憶されている。
 本発明の実施の形態におけるクライアント装置10は、図3に示すハードウェア構成を有することにより、後述する各種処理を実現することができる。なお、図3では、本発明の実施の形態におけるクライアント装置10が1台の情報処理装置(コンピュータ)で実現されている場合を示したが、これに限られない。本発明の実施の形態におけるクライアント装置10は、複数台の情報処理装置(コンピュータ)で実現されていても良い。
 <クライアント装置10の機能構成>
 次に、本発明の実施の形態におけるクライアント装置10の機能構成について、図4を参照しながら説明する。図4は、本発明の実施の形態におけるクライアント装置10の機能構成の一例を示す図である。
 図4に示すように、本発明の実施の形態におけるクライアント装置10は、機能部として、対象遷移選択部101と、制約抽出部102と、入力値生成部103と、対象テストスクリプト群生成部104とを有する。これら各機能部は、クライアント装置10にインストールされた1以上のプログラムがプロセッサ15に実行させる処理により実現される。
 対象遷移選択部101は、画面遷移図上の画面遷移の中から対象遷移の選択又は指定を受け付ける。なお、対象遷移選択部101は、複数の対象遷移が選択又は指定された場合には、これら複数の対象遷移の選択又は指定を受け付ける。また、対象遷移が選択又は指定されることで、遷移元の画面に含まれる入力フォーム群(つまり、遷移先の画面に遷移するトリガーとなるボタンやリンク等が含まれるformタグ中の入力フォーム群)が特定される。
 制約抽出部102は、Webアプリケーションのソースコードから制約を抽出して、これら抽出した制約が含まれる制約情報を作成する。なお、制約には、大きく分けて、単項目制約と相関項目制約とが存在する。単項目制約とは1つの入力値が単独で満たすべき条件を表す制約であり、相関項目制約とは複数の入力値間で満たすべき条件を表す制約のことである。単項目制約としては、例えば、「フリガナ入力欄には全角カタカナのみを入力しなければならない」といったもの等が挙げられる。また、複数項目制約としては、例えば、「開始日入力欄の日付は、終了日入力欄の日付よりも前でなければならない」といったもの等が挙げられる。
 ここで、制約はソースコード中に自由に記述することができるため、一般的な入力値に関する制約を自動的に取得(抽出)すること困難である。このため、本発明の実施の形態では、Webアプリケーション開発に用いられるフレームワーク(例えば、Spring Framework、Apache Struts等)に着目する。Webアプリケーションのフレームワークでは、推奨される制約の書き方を想定し、仕組み又は機能(バリデータ(validator))として提供している場合が多い。例えば、Spring FrameworkではBean Validation APIが提供されており、Apache Strutsではvalidation.xmlが提供されている。
 そこで、制約抽出部102は、ソースコードをパース(解析)して、上記の仕組み又は機能(バリデータ)を利用するための記述を制約として抽出する。
 例えば、Bean Validation APIでは、制約はアノテーションを付与することで定義される。具体的には、例えば、「文字列nameの最小の長さが1で最大の長さが20、かつ、空文字にならない」との制約は、以下のように定義される。
 @NotNull
 @Size(min = 1, max = 20)
 Private String name;
 上記の例では、「@NotNull」と「@Size(min = 1, max = 20)」とがアノテーションであり、これらのアノテーションが「name」に付与されることで上記の制約が定義されている。
 このように、制約抽出部102は、ソースコードをパース(解析)して、Webアプリケーションのフレームワークが提供するバリデータで規定又は定義されている記述仕様から制約を抽出する。すなわち、制約抽出部102は、ソースコードから制約を抽出又は取得するパーサとして機能する。したがって、Webアプリケーションのフレームワークがバリデータを提供している場合には、制約抽出部102は、このフレームワークに対応するパーサとして実装すれば、どのようなフレームワークを用いて開発等されたソースコードからでも制約を抽出することができる。
 なお、フレームワークがバリデータを提供していない場合等には、開発者が独自に制約を実装することがある。この場合、制約抽出部102は、基本的に、独自に実装した制約を抽出することはできないが、例えば、独自に実装した制約も解析可能なモジュール又はプラグイン等を追加導入することで、このような独自に実装した制約も抽出することができるようになる。
 入力値生成部103は、制約情報や入力値候補を用いて、入力フォーム群に対する入力値セットの集合である入力値セット群を生成する。なお、入力値候補は、ユーザ等によって予め与えられる。
 ここで、入力値生成部103は、同値分割の観点及び境界値分析の観点に基づいて、入力値セットに含まれる各入力値を生成する。
 同値分割とは、出力結果が同一となる入力値群を1つの同値クラスとすることで、その同値クラス内から1つの代表値を入力値としてテストすれば、その同値クラス内の全ての入力値はテストしたものと見做すテスト手法である。同値分割を用いることで、無限の入力値空間を有限にし、テストケース数を削減することができる。一般的にWebアプリケーションのフレームワークが提供するバリデータでは、「制約を満たす」又は「制約を満たさない」の2つのクラスに分割することができる。このとき、制約を満たす値を「INポイント」(又は、「有効同値」)、制約を満たさない値を「OUTポイント」(又は、「無効同値」)と呼ぶ。
 境界値分析とは、同値クラス間の境界付近の入力値を用いてテストするテスト手法である。これは境界値付近にバグが潜んでいる可能性が高いという経験則に基づいて手法である。境界値上の値を「ONポイント」、境界値の近傍の値を「OFFポイント」と呼ぶ。
 そこで、本発明の実施の形態では、全ての同値クラスをテストした上で、全ての境界値のONポイント及びOFFポイント(境界値の前後の近傍)のテストも行うような入力値を生成するものとする。
 例えば、「1<xかつx≦10」という制約Aがあり、xが制約Aを満たす場合は画面Pに遷移し、xが制約Aを満たさない場合は画面Qに遷移するものとする。この場合、同値クラスは、画面Pに遷移するクラスと画面Qに遷移するクラスとの2つである。また、境界値は{0,1,2,9,10,11}となる。ここでは、これら6つの値を全てテストすればテスト観点として十分である。
 なお、上記の6つの値を同値分割の観点及び境界値分析の観点で整理した表を以下に示す。
Figure JPOXMLDOC01-appb-T000001
 このように、入力値生成部103は、制約情報に含まれる各制約うち、入力フォームに対応する制約を参照して、同値分割の観点及び境界値分析の観点を満たす入力値(つまり、全ての同値クラスをテストした上で、全ての境界値のONポイント及びOFFポイントもテストするための入力値)を生成する。
 ここで、制約には、上記の「1<xかつx≦10」(つまり、線形な数値の大小関係)等のような線形な制約だけでなく、非線形な制約や正規表現を用いた制約(つまり、機械的に解くことが困難な制約)等も存在する。入力フォームに対応する制約が非線形な制約や正規表現を用いた制約である場合には、上述のように機械的に入力値を生成することは困難である。そこで、本発明の実施の形態では、入力値生成部103は、以下の3段階に分けて、入力値を生成する。
 (1)機械的に入力値を生成できる制約(例えば、上記の「1<xかつx≦10」等のような線形な制約)である場合、入力値生成部103は、同値分割の観点及び境界値分析の観点を満たす入力値を生成する。すなわち。入力値生成部103は、例えば、各同値クラスにそれぞれ含まれる入力値を1つずつ生成すると共に、これら各同値クラスの境界値のONポイント及びOFFポイントとを生成する。
 (2)上記の(1)のように機械的に入力値を生成することができない制約である場合、入力値生成部103は、入力値候補に含まれる入力値のうち、同値分割の観点及び境界値分析の観点の少なくとも一方を満たす入力値を特定し、この入力値を取得(抽出)する。
 例えば、或る入力フォームの制約が「E-mail形式、かつ、max=30」である場合、同値分割及び境界値分析の観点を満たす入力としては、「E-mail形式、かつ、29文字」、「E-mail形式、かつ、30文字」、「E-mail形式、かつ、31文字」の3つの入力値(文字列)が必要である。そこで、入力値生成部103は、これらの入力値が入力値候補に存在する場合は、これらの入力値を入力値候補から取得(抽出)する。
 (3)上記の(2)で入力値が得られなかった観点が存在する場合(すなわち、或る制約について、同値分割の観点及び境界値分析の観点の少なくとも一方の観点で入力値が得られなかった場合)、入力値生成部103は、当該制約と、当該制約で入力値が得られなかった観点とに関してユーザに補助を求める情報を出力する。
 例えば、或る制約Bで、INポイントが得られなかった場合、制約BのINポイントについてユーザに補助を求める情報を出力する。これにより、当該制約の当該観点について、ユーザによって直接入力値が入力又は指定等される。
 以上の(1)~(3)により、あらゆる制約について入力値を用意することが可能となる。すなわち、入力フォーム群に含まれる各入力フォームに対して入力値セットが生成され、入力値セット群が得られる。
 対象テストスクリプト群生成部104は、対象テストスクリプトに対して、入力値セット群に含まれる各入力値セットを設定する(つまり、対象テストスクリプトの該当の記述に対して、入力値セットに含まれる入力値を設定する(又は埋め込む))ことで、各入力値セットにそれぞれ対応する対象テストスクリプトを生成する。これにより、対象テストスクリプト群が生成される。
 なお、図4では図示を省略しているが、クライアント装置10は、Webアプリケーションのソースコードを入力して、静的解析及び動的解析を行うことで、画面遷移図及びテストスクリプト群を生成する機能部も有している。ただし、クライアント装置10は、当該機能部を有していなくても良い。この場合、クライアント装置10は、他の装置(例えば、クライアント装置10とネットワークを介して接続された装置)で生成された画面遷移図及びテストスクリプト群を取得及び入力すれば良い。
 <対象遷移に対応するテストスクリプトのバリエーション生成処理>
 以降では、対象遷移に対応するテストスクリプトのバリエーション(つまり、対象テストスクリプト群)を生成する処理について、図5を参照しながら説明する。図5は、対象遷移に対応するテストスクリプトのバリエーション生成処理の一例を示すフローチャートである。
 まず、対象遷移選択部101は、画面遷移図上の画面遷移の中から対象遷移の選択又は指定を受け付ける(ステップS101)。ここで、画面遷移図とは、各画面間の遷移関係を表す図である。例えば、図6に示す画面遷移図は、画面Aと、画面Bと、画面Cとの間の遷移関係を表している。図6に示す例では、画面Aから画面Bへの画面遷移を「画面遷移AB」、画面Aから画面Cへの画面遷移を「画面遷移AC」、画面Cから画面Bへの画面遷移を「画面遷移CB」で表している。
 ユーザは、画面遷移上の画面遷移の中から1以上の所望の画面遷移(つまり、対象遷移)を選択又は指定する。これにより、ユーザにより選択又は指定された対象遷移が対象遷移選択部101により受け付けられる。
 次に、制約抽出部102は、Webアプリケーションのソースコードから制約を抽出して、これら抽出した制約が含まれる制約情報を作成する(ステップS102)。このステップS102の処理(制約の抽出処理)の詳細については後述する。
 次に、入力値生成部103は、制約情報や入力値候補を用いて、入力フォーム群に対する入力値セットの集合である入力値セット群を生成する(ステップS103)。このステップS103の処理(入力値の生成処理)の詳細については後述する。
 次に、対象テストスクリプト群生成部104は、対象テストスクリプトに対して、入力値セット群に含まれる各入力値セットを設定することで、対象テストスクリプト群を生成する(ステップS104)。このステップS104の処理(対象遷移に対応するテストスクリプト群の生成処理)の詳細については後述する。
 以上により、ユーザが選択した画面遷移に対応するテストスクリプトについて、複数の入力値セットをそれぞれ設定した対象テストスクリプト群が得られる。したがって、ユーザは、対象テストスクリプト群を用いることで、同値分割の観点及び境界値分析の観点を満たす様々なバリエーションのテストを実施することができるようになる。
 <制約の抽出処理>
 以降では、図5のステップS102の処理(制約の抽出処理)の詳細について、図7を参照しながら説明する。図7は、制約の抽出処理の一例を示すフローチャートである。
 制約抽出部102は、Webアプリケーションのソースコードを読み込む(ステップS201)。次に、制約抽出部102は、Webアプリケーションのフレームワークが対象フレームワークであるか否かを判定する(ステップS202)。ここで、対象フレームワークとは、パーサとして機能する制約抽出部102で制約を抽出可能なフレームワークのことである。なお、対象フレームワークであるか否かは、例えば、ソースコード中の記述(例えば、「package文」等)から判定することができる。
 対象フレームワークと判定された場合(ステップS202でYES)、制約抽出部102は、ソースコードをパース(解析)して、対象遷移に関する制約(つまり、対象遷移を行う際の判定又は検証される制約)のうち、サーバサイドの制約を抽出する(ステップS203)。なお、サーバサイドの制約とは、サーバサイドで条件を満たしているか否かが判定(又は検証)される制約のことである。
 次に、制約抽出部102は、レンダリングされたHTML(HyperText Markup Language)を読み込む(ステップS204)。なお、レンダリングされるHTMLは、例えば、JSP(Java(登録商標) Server Pages)やPHP等が含まれ、HTMLタグで記述されたソースコードや、サーブレットから出力されたHTML等である。
 次に、制約抽出部102は、ソースコードをパース(解析)して、対象遷移に関する制約のうち、クライアントサイドの制約を抽出する(ステップS205)。
 そして、制約抽出部102は、上記のステップS203及びステップS205で抽出された制約が含まれる制約情報を作成する(ステップS206)。
 一方で、対象フレームワークと判定されなかった場合(ステップS202でNO)、クライアント装置10は、対象遷移に対応するテストスクリプトのバリエーション生成処理を終了する(ステップS207)。この場合、ソースコードから自動的に制約を抽出することができないためである。
 <入力値の生成処理>
 以降では、図5のステップS103の処理(入力値の生成処理)の詳細について、図8を参照しながら説明する。図8は、入力値の生成処理の一例を示すフローチャートである。
 入力値生成部103は、上記のステップS204でレンダリングされたHTMLに定義されたformタグ中の各入力フォーム(つまり、入力フォーム群に含まれる各入力フォーム)に対して、ステップS301~ステップS308の処理を実行する。ここで、上記のステップS204でレンダリングされたHTML(つまり、画面)が図9に示すようなものである場合、formタグ中の入力フォームは、「入力フォーム1」、「入力フォーム2」、「入力フォーム3」となる。したがって、この場合、「入力フォーム1」、「入力フォーム2」及び「入力フォーム3」に対して、ステップS301~ステップS308の処理がそれぞれ実行される。以降では、簡単のため、或る1つの入力フォームを固定して、ステップS301~ステップS308の処理を説明する。
 入力値生成部103は、制約情報に含まれる制約のうち、該当の入力フォームの制約を参照し(ステップS302)、当該制約が線形な数値の大小関係であるか否かを判定する(ステップS303)。
 当該制約が線形な数値の大小関係である場合(ステップS303でYES)、入力値生成部103は、同値分割の観点及び境界値分析の観点を満たす入力値を生成する(ステップS304)。これにより、当該入力フォームの制約について、同値分割の観点及び境界値分析の観点を満たす複数の入力値が生成される。
 一方で、当該制約が線形な数値の大小関係でない場合(ステップS303でNO)、入力値生成部103は、同値分割の観点及び境界値分析の観点の少なくとも一方を満たす1以上の入力値を入力値候補から特定する(ステップS305)。なお、この場合、当該制約は、例えば、非線形な制約や正規表現を用いた制約である。
 次に、入力値生成部103は、上記のステップS305で入力値が特定されたか否かを判定する(ステップS306)。
 上記のステップS305で入力値が特定された場合(ステップS306でYES)、入力値生成部103は、特定された1以上の入力値を入力値候補から取得(抽出)する(ステップS307)。これにより、当該入力フォームの制約について、当該1以上の入力値が、上記のステップS305で満たすと特定された観点の入力値となる。
 一方で、上記のステップS305で入力値が特定されなかった場合(ステップS306でNO)、クライアント装置10は、ステップS308に進む。この場合、当該入力フォームの制約については、ユーザによって入力又は指定等されることによってのみ入力値が得られる。
 入力値生成部103は、入力値が得られなかった観点に関して補助を求める情報をユーザに対して出力する(ステップS309)。ここで、当該情報としては、例えば、入力値が得られなかった観点が存在する入力フォーム及びその制約と、当該観点とが含まれる情報とすれば良い。なお、当該情報の出力先としては、例えば、表示装置12等とすれば良い。
 次に、入力値生成部103は、上記のステップS309で出力した情報に応じて当該ユーザが入力等された1以上の入力値の入力を受け付ける(ステップS310)。これにより、一部又は全ての観点について入力値が得られなかった制約についてもユーザ入力により入力値が補完される。すなわち、これにより、入力フォーム群に含まれる各入力フォームに対して入力値セットが生成され、これらの入力値セットの集合である入力値セット群が得られる。ここで、入力値セットは、入力フォーム群に含まれる各入力フォームのそれぞれに対する入力値の集合である。したがって、入力値セット群は、入力値セットのバリエーションである。
 なお、上記のステップS301~ステップS308の処理において、全ての入力フォームの制約について、同値分割及び境界値分析の全ての観点で入力値が得られた場合、上記のステップS309~ステップS310の処理は実行されなくても良い。
 <対象遷移に対応するテストスクリプト群の生成処理>
 以降では、図5のステップS104の処理(対象遷移に対応するテストスクリプト群の生成処理)の詳細について、図10を参照しながら説明する。図10は、対象遷移に対応するテストスクリプト群の生成処理の一例を示すフローチャートである。
 対象テストスクリプト群生成部104は、テストスクリプト群のうち、対象遷移に対応するテストスクリプト(つまり、対象テストスクリプト)を取得する(ステップS401)。なお、上述したように、特開2018-116496号公報に記載されている技術により生成された画面遷移図及びテストスクリプト群では画面遷移図上の各画面遷移とテストスクリプト群に含まれる各テストスクリプトとが対応しているため、対象遷移が選択又は指定されることで、当該対象遷移に対応するテストスクリプト(つまり、対象テストスクリプト)を特定及び取得することができる。
 対象テストスクリプト群生成部104は、図8の入力値の生成処理で生成された入力値セット群に含まれる各入力値セットに対して、ステップS402~ステップS406の処理を実行する。以降では、簡単のため、或る1つの入力値セットを固定して、ステップS402~ステップS405の処理を説明する。
 対象テストスクリプト群生成部104は、図7のステップS204でレンダリングされたHTMLのformタグ中の入力フォームのうち、対象遷移に関わるformタグ中の入力フォームを特定する(ステップS403)。
 次に、対象テストスクリプト群生成部104は、上記のステップS403で特定した入力フォームのそれぞれに対する入力値を、入力値セット群に含まれる入力値のうちの該当の入力値とした対象テストスクリプトを生成する(ステップS404)。これにより、1つの対象テストスクリプトが生成される。したがって、全ての入力値セットに対してステップS402~ステップS405の処理が実行されることで、対象テストスクリプト群が生成される。
 <まとめ>
 以上のように、本発明の実施の形態におけるクライアント装置10では、Webアプリケーションのテストにおける重要なテスト観点である同値分割及び境界値分析それぞれの観点を満たす入力値のバリエーションを自動的に生成する。また、このとき、本発明の実施の形態におけるクライアント装置10は、入力フォームの制約が線形な制約である場合には自動的に入力値を生成し、非線形な制約や正規表現を用いた制約である場合には入力値候補からの入力値の取得を試みる。そして、或る入力フォームについて入力値が得られなかった観点が存在する場合に、ユーザに対して、当該入力フォームに対する入力値の入力を依頼する。これにより、本発明の実施の形態によれば、ユーザが入力値を作成等する工数を大幅に削減させつつ、同値分割及び境界値分析の観点を満たす入力値のバリエーションを得ることができる。
 また、本発明の実施の形態におけるクライアント装置10では、上記のように得られた入力値のバリエーションを用いて、テストスクリプトのバリエーションを作成する。これにより、バリエーションとして得られたテストスクリプトを実行することで、Webアプリケーションのバリエーションテストを容易に実行することができるようになる。
 本発明は、具体的に開示された上記の実施形態に限定されるものではなく、特許請求の範囲から逸脱することなく、種々の変形や変更が可能である。
 10    クライアント装置
 20    サーバ装置
 101   対象遷移選択部
 102   制約抽出部
 103   入力値生成部
 104   対象テストスクリプト群生成部

Claims (6)

  1.  Webアプリケーションが提供する画面遷移に関するテストのテストデータを生成するテストデータ生成装置であって、
     前記画面遷移のうち、1以上の画面遷移の選択を受け付ける選択受付手段と、
     前記Webアプリケーションのフレームワークで規定又は定義されている制約の記述仕様を用いて、前記Webアプリケーションのソースコードを解析し、該ソースコードから制約を抽出する抽出手段と、
     前記選択された画面遷移の遷移元の画面に含まれる入力フォームの前記制約を用いて、同値分割及び境界値分析のテスト観点を満たす複数のテストデータを生成する生成手段と、
     を有することを特徴とするテストデータ生成装置。
  2.  前記制約は、線形な制約、非線形な制約又は正規表現を用いた制約のいずれかであり、
     前記生成手段は、
     前記制約が線形な制約である場合、前記同値分割及び境界値分析のテスト観点を満たす複数のテストデータを生成し、
     前記制約が非線形な制約又は正規表現を用いた制約である場合、予め与えられたテストデータ候補集合の中から前記同値分割及び境界値分析のテスト観点を満たす1以上のテストデータを取得し、
     前記同値分割及び境界値分析のテスト観点を満たす1以上のテストデータが取得できなかった場合、ユーザに対してテストデータの入力又は指定を依頼するための情報を出力する、ことを特徴とする請求項1に記載のテストデータ生成装置。
  3.  前記画面遷移に関するテストを実行するテストスクリプトに対して、前記生成手段により生成された複数のテストデータをそれぞれ設定して、該複数のテストデータのそれぞれが設定された複数のテストスクリプトを生成するスクリプト生成手段を有することを特徴とする請求項1又は2に記載のテストデータ生成装置。
  4.  前記抽出手段は、
     前記Webアプリケーションの開発元が独自に規定又は定義した制約の記述仕様を用いて、前記Webアプリケーションのソースコードを解析し、該ソースコードから制約を抽出する、ことを特徴とする請求項1乃至3の何れか一項に記載のテストデータ生成装置。
  5.  Webアプリケーションが提供する画面遷移に関するテストのテストデータを生成するテストデータ生成装置が、
     前記画面遷移のうち、1以上の画面遷移の選択を受け付ける選択受付手順と、
     前記Webアプリケーションのフレームワークで規定又は定義されている制約の記述仕様を用いて、前記Webアプリケーションのソースコードを解析し、該ソースコードから制約を抽出する抽出手順と、
     前記選択された画面遷移の遷移元の画面に含まれる入力フォームの前記制約を用いて、同値分割及び境界値分析のテスト観点を満たす複数のテストデータを生成する生成手順と、
     を実行することを特徴とするテストデータ生成方法。
  6.  コンピュータを、請求項1乃至4の何れか一項に記載のテストデータ生成装置における各手段として機能させるためのプログラム。
PCT/JP2019/040308 2018-10-25 2019-10-11 テストデータ生成装置、テストデータ生成方法及びプログラム WO2020085129A1 (ja)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US17/288,352 US20210382810A1 (en) 2018-10-25 2019-10-11 Test data generation apparatus, test data generation method and program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
JP2018-200642 2018-10-25
JP2018200642A JP7070328B2 (ja) 2018-10-25 2018-10-25 テストデータ生成装置、テストデータ生成方法及びプログラム

Publications (1)

Publication Number Publication Date
WO2020085129A1 true WO2020085129A1 (ja) 2020-04-30

Family

ID=70331165

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2019/040308 WO2020085129A1 (ja) 2018-10-25 2019-10-11 テストデータ生成装置、テストデータ生成方法及びプログラム

Country Status (3)

Country Link
US (1) US20210382810A1 (ja)
JP (1) JP7070328B2 (ja)
WO (1) WO2020085129A1 (ja)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2023000907A (ja) 2021-06-18 2023-01-04 株式会社日立製作所 ソースコード修正支援装置及びソースコード修正支援方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003044318A (ja) * 2001-08-02 2003-02-14 Fujitsu Ltd テスト支援プログラムおよびテスト支援方法
JP2012133721A (ja) * 2010-12-24 2012-07-12 Internatl Business Mach Corp <Ibm> テストの網羅性を評価する装置及び方法
WO2017145300A1 (ja) * 2016-02-24 2017-08-31 三菱電機株式会社 テストケース生成装置及びテストケース生成プログラム
JP2018116497A (ja) * 2017-01-18 2018-07-26 日本電信電話株式会社 画面判定装置及びプログラム

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPWO2004104824A1 (ja) * 2003-05-26 2006-07-20 富士通株式会社 ユーザインタフェースアプリケーション開発装置および開発方法
US7370296B2 (en) * 2004-05-25 2008-05-06 International Business Machines Corporation Modeling language and method for address translation design mechanisms in test generation
JP4148527B2 (ja) * 2006-06-05 2008-09-10 インターナショナル・ビジネス・マシーンズ・コーポレーション 機能テスト・スクリプト生成装置
US7530036B2 (en) * 2007-02-08 2009-05-05 International Business Machines Corporation Random test generation using an optimization solver
US8302080B2 (en) * 2007-11-08 2012-10-30 Ntt Docomo, Inc. Automated test input generation for web applications
US9118713B2 (en) * 2011-09-26 2015-08-25 The Board Of Trustees Of The University Of Illinois System and a method for automatically detecting security vulnerabilities in client-server applications
US9323650B2 (en) * 2012-07-23 2016-04-26 Infosys Limited Methods for generating software test input data and devices thereof
JP2017145300A (ja) 2016-02-16 2017-08-24 三菱ケミカル株式会社 変性ポリエチレン組成物、成形体及びシラン架橋ポリエチレン

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003044318A (ja) * 2001-08-02 2003-02-14 Fujitsu Ltd テスト支援プログラムおよびテスト支援方法
JP2012133721A (ja) * 2010-12-24 2012-07-12 Internatl Business Mach Corp <Ibm> テストの網羅性を評価する装置及び方法
WO2017145300A1 (ja) * 2016-02-24 2017-08-31 三菱電機株式会社 テストケース生成装置及びテストケース生成プログラム
JP2018116497A (ja) * 2017-01-18 2018-07-26 日本電信電話株式会社 画面判定装置及びプログラム

Also Published As

Publication number Publication date
US20210382810A1 (en) 2021-12-09
JP7070328B2 (ja) 2022-05-18
JP2020067859A (ja) 2020-04-30

Similar Documents

Publication Publication Date Title
Lawson Web scraping with Python
CN104391786B (zh) 网页自动化测试系统及其方法
WO2013188540A1 (en) Practical natural-language human-machine interfaces
JP2006244195A (ja) プログラムテスト支援装置およびその方法
CN114328276B (zh) 测试用例生成方法和装置,显示测试用例的方法和装置
JP6440895B2 (ja) ソフトウェア分析装置及びソフトウェア分析方法
CN112231197A (zh) 一种页面测试的方法、装置和存储介质
WO2020085129A1 (ja) テストデータ生成装置、テストデータ生成方法及びプログラム
US20220214963A1 (en) Analysis apparatus, analysis method and program
JP6873868B2 (ja) データ分析処理支援装置、及びデータ分析処理支援方法
Bertolini et al. A framework for GUI testing based on use case design
US20160292067A1 (en) System and method for keyword based testing of custom components
JP5815856B2 (ja) スクリプト依存関係をインライン化するためのシステムおよび方法
US20220159032A1 (en) Scanning unexposed web applications for vulnerabilities
JP7260150B2 (ja) Webサイト設計支援装置、Webサイト設計支援方法、及びプログラム
JP7268759B2 (ja) テストデータ生成装置、テストデータ生成方法、及びプログラム
CN115033436A (zh) 页面测试方法及装置、电子设备、存储介质
WO2021166271A1 (ja) 解析装置、解析方法及び解析プログラム
JP2018147106A (ja) プログラム分析装置、プログラム分析方法及びプログラム分析プログラム
JP6111150B2 (ja) ソースコード解析装置、ソースコード解析方法、及びプログラム
JP6426535B2 (ja) テスト支援装置、及びテスト支援方法
JP7417068B2 (ja) 表示方法及び表示プログラム、並びに情報処理装置
JP7127601B2 (ja) 類似遷移特定装置、類似遷移特定方法及びプログラム
JP7322964B2 (ja) テスト情報抽出装置、テスト情報抽出方法及びプログラム
JP5683209B2 (ja) ドキュメント類自動生成機能付クライアントコンピュータ

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19875410

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19875410

Country of ref document: EP

Kind code of ref document: A1