Test script generation system, test script generation method, and test script generation program
The system automates the generation of test scripts by identifying operation targets and operable elements, optimizing the testing process through a generative model to enhance efficiency and accuracy in screen testing.
Patent Information
- Application Number
- JP2024020038
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-02-14
- Publication Date
- 2025-08-26
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Screen testing requires verifying multiple operations for each screen element, which is time-consuming and inefficient due to the need for extensive manual scripting and verification.
A system and method that utilizes an extraction unit to identify operation targets and operable elements, a step generation unit to create test steps, and a script generation unit to generate test scripts, leveraging a generative model to automate and optimize the process.
This approach allows for efficient generation of test scripts by eliminating unnecessary steps and focusing on necessary ones, improving accuracy and reducing the time required for comprehensive screen testing.
Smart Images

Figure 2025124166000001_ABST
Abstract
Description
[Technical Field]
[0001] The present invention relates to a system, method, and program for generating a test script. [Background technology]
[0002] Screens such as web pages and web apps are composed of operable elements such as links to other pages and input forms. These screens are written using scripts in source code such as HTML, and each element is laid out on the screen. When the screen is implemented, tests are conducted to verify that the layout is displayed as designed under various conditions.
[0003] This test is performed by executing a test script that specifies various conditions and verifying the execution results. The test script requires a wide range of conditions to be written in code, which is costly. Therefore, various technologies are known to support the generation of test scripts.
[0004] Patent Document 1 discloses a technology for efficiently generating test scripts using commands that define operations for screen elements that make up a screen. Patent Document 1 discloses that an element information acquisition means acquires element information about the screen elements, a display processing means displays a list of operations that can be performed on the screen elements to be operated based on the classification of the element information, an operation content input means accepts a selection of an arbitrary operation content from the operation contents displayed in the list by the display processing means, and a command generation means generates an operation content part of the command based on the operation content selected and accepted by the operation content input means.
[0005] Patent Document 2 discloses a technology for shortening the time required to restore the specifications of screen transitions in a web application, which includes a generation unit that generates, for a test script for the web application, operation patterns relating to combinations of operation elements that cause transitions on the web application screen and input data candidates for input elements into which data is input on the screen, and for input elements for which default values for input data are set in advance, the generation unit combines only the default values with the operation elements.
[0006] Patent Document 3 discloses a technology for outputting an execution script for testing an application based on screen information of the application to be tested and test information of the application. Patent Document 3 discloses that by inputting the screen information into a learning model, correspondence information regarding the display positions of the operation target objects and element names included in the screen information is output. [Prior art documents] [Patent documents]
[0007] [Patent Document 1] Japanese Patent Publication No. 2021-174096 [Patent Document 2] International Publication No. 2021 / 090427 [Patent Document 3] Japanese Patent Publication No. 2023-075780 Summary of the Invention [Problem to be solved by the invention]
[0008] Screen testing requires verifying one or more operations for each of the multiple operation elements contained within the screen. However, comprehensive verification of screen operations can be problematic because it takes a huge amount of time to run the test.
[0009] In view of the above-mentioned problems, an object of the present invention is to provide a technique for efficiently generating test scripts using test steps. Another object of the present invention is to provide a technique for efficiently generating test scripts by reducing unnecessary test steps and adjusting necessary test steps. [Means for solving the problem]
[0010] [1] An extraction unit that extracts operation target information including operation targets and operable elements for each screen element included in the screen; a step generation unit that generates a test step including an operation content corresponding to an operational element included in the operation target information; a script generation unit that generates a test script by specifying one or more of the test steps. [2] The test script generation system described in [1], wherein the step generation unit inputs test step generation instructions into a generation model using input data including an operation target and an operable element, and obtains output of one or more test steps from the generation model. [3] The test script generation system described in [2], wherein the step generation unit inputs a test step generation instruction including the input data and generation rules into the generation model, and generates one or more test steps based on output data obtained from the generation model, and the structure of the output data is defined by the generation rules so that it includes an operation target and an operation type. [4] The test script generation system according to any one of [1] to [3], wherein the test step includes a description of the test step written in natural language. [5] The test script generation system described in [4], wherein the step generation unit generates variables to be included in the description of the test step using at least one selected from the label name, value, string in tag, and identification information included in the operation target information. [6] A test script generation system according to any one of [1] to [5], wherein the step generation unit inputs an instruction to generate a second test step into a generation model using input data including the operation target information or the generated first test step, and obtains the output of one or more second test steps from the generation model. [7] the test step includes one or more input values to be applied to the operation content; The test script generation system according to any one of [1] to [6], wherein the step generation unit inputs an instruction to generate an input value of the test step into a generation model and obtains output of one or more input values from the generation model. [8] The test script generation system described in [7], wherein the step generation unit inputs an instruction to generate the input value into a generative model using input data including an operable element and a description of the test step, and obtains an output of one or more of the input values from the generative model. [9] The test script generation system according to [8], wherein the input data further includes screen elements of the operable element and sibling elements.
[0011] The invention according to [1] makes it possible to automatically generate test steps for each operable element, and furthermore to efficiently generate test scripts by combining the necessary test steps by specifying the generated test steps. The invention according to [2] makes it possible to efficiently generate test steps using a generative model. According to the invention of [3], output data is obtained according to the structure defined by the generation rules, and test steps can be easily generated from the output data. The inventions [4] and [5] allow for efficient operation of test steps using explanatory text. The invention according to [6] allows for efficient updating of test steps. The invention according to [7] allows efficient generation of input values for test steps. The invention according to [8] can improve the accuracy of the output input value by using explanatory text. According to the invention of [9], the accuracy of the input value output can be improved by using the screen elements before and after the operable element. [Effects of the Invention]
[0012] According to the present invention, test scripts can be generated efficiently by eliminating unnecessary test steps and adjusting necessary test steps. [Brief explanation of the drawings]
[0013] [Figure 1] FIG. 1 is a block diagram of a system according to an embodiment of the present invention. [Figure 2] FIG. 2 is a diagram illustrating a hardware configuration of the present embodiment. [Figure 3] 3 shows a processing sequence according to the present embodiment. [Figure 4] 3 is a processing flowchart of the test script generation device of the present embodiment. [Figure 5] 10 is a flowchart of an extraction process according to an embodiment. [Figure 6] 10 is a flowchart of a step generation process according to the present embodiment. [Figure 7] FIG. 2 is a schematic diagram of the operable elements of the present embodiment. [Figure 8] FIG. 3 is a diagram illustrating an outline of the operation contents of the present embodiment. [Figure 9] 10 shows a display example of a test screen according to the present embodiment. [Figure 10] 10 shows an example of input and output data of a test step generation instruction according to the present embodiment. [Figure 11] 10 shows an example of input and output data for an instruction to generate an input value according to the present embodiment. DETAILED DESCRIPTION OF THE INVENTION
[0014] A test script generation system and a test script generation method according to an embodiment of the present invention will be described below with reference to the accompanying drawings. Note that the embodiment shown below is an example of the present invention, and the present invention is not limited to the embodiment below, and various configurations can be adopted.
[0015] In this embodiment, the configuration, operation, etc. of a test script generation system and a test script generation device are described. However, a test script generation method, a computer program, and a program recording medium on which the program is recorded, each having a similar configuration, also achieve the same effects. For example, by using a program recording medium, the program can be installed on a computer. The series of processes according to this embodiment described below are provided as a computer-executable program, and can be provided via a non-transitory computer-readable recording medium such as a CD-ROM or a flexible disk, or even via a communication line.
[0016] The test script generation system is composed of a computer device. The computer device has an arithmetic unit such as a CPU (Central Processing Unit) and a storage device. The computer device can function as a test script generation device by executing a test script generation program stored in the storage device using the arithmetic unit. The test script generation method is realized by processing the computer device including the test script generation device.
[0017] Figure 1 shows a block diagram of a test script generation system 1. The test script generation system 1 includes a test script generation device 2, a user terminal 3, and a generation device 4. The test script generation device 2, the user terminal 3, and the generation device 4 are each connected to a communication network NW and configured to be able to communicate with each other.
[0018] The test script generation device 2 includes, as functional components, an acquisition unit 21 that acquires various data, an extraction unit 22 that extracts operation target information contained in the screen, a step generation unit 23 that generates test steps, a script generation unit 24 that generates test scripts, and an output unit 25 that outputs the various generated data.
[0019] The test script generation device 2 acquires data from the user terminal 3. The test script generation device 2 generates output data based on the acquired data and sends it to the user terminal 3. The test script generation device 2 also sends a data generation instruction to the generation device 4 based on the acquired data. The test script generation device 2 receives the result of the data generation instruction from the generation device 4, generates output data based on the result, and sends it to the user terminal 3.
[0020] The user terminal 3 displays a screen S to be tested. The user terminal 3 transmits screen information relating to the screen S to the test script generation device 2. The user terminal 3 can accept input operations relating to the generation of a test script relating to the screen S from the user, and can receive output data from or via the test script generation device 2. The user terminal 3 can display a screen based on the output data on a display unit such as a monitor. Although only one user terminal 3 is shown in FIG. 1, multiple user terminals 3 may be present.
[0021] The generation device 4 includes a generation means 40 as a functional component. The generation means 40 is configured as a generation model. The generation means 40 executes a process of generating output data for input data. The generation device 4 inputs the input data included in the generation instruction into the generation model, obtains output data for the input data from the generation model, and transmits the output data to the sender of the data generation instruction. In this embodiment, the sender of the data generation instruction is the test script generation device 2, but this is not limited thereto, and a mode in which the sender is the user terminal 3 can also be adopted.
[0022] In this embodiment, the generation means 40 employs a natural language processing model (NLP). The generation means 40 is preferably a large-scale language model (LLM). The natural language processing model realizes computer processing of input data containing natural language. In this embodiment, the type of natural language processing model employed is not limited.
[0023] The natural language processing model can output text classification, sentiment analysis, text summarization, question answering, and the like as a result of natural language processing of input data containing natural language. In this embodiment, the generation means 40 outputs a proposed test step based on the screen element to be tested as a processing result. Note that some or all of the data input as natural language may be in natural language at the input stage, but may no longer be in natural language before or during processing in the natural language processing model. For example, the data input as natural language may be converted into data in a format that can be processed by the natural language processing model and then processed.
[0024] The generation means 40 may be implemented in a form other than a natural language processing model as long as it can output a response as a processing result for an input including natural language.
[0025] The generation means 40 may include image data in the input data. The generation means 40 can output, for example, an answer or a suggestion related to the input image data as a processing result. For example, the generation means 40 can receive image data related to a screen S as input and output a suggestion of a test step for the screen S as a processing result.
[0026] The generation means 40 can output the processing results for the input of data including natural language and image data. For example, the generation means 40 can accept input of questions or processing related to image data in natural language and can output the processing results for that.
[0027] Screen S is a screen of a web application, website, etc. displayed in a web browser. Screen S is displayed based on a plurality of screen elements. Screen elements include operable elements such as links, forms, buttons, etc., and non-operable elements such as titles and text.
[0028] The screen S is displayed by processing code written in a markup language such as HTML, XML, SGML, or XHTML in a web browser. The screen S may also include code written in languages such as CSS, JavaScript, or PHP. In this embodiment, code written in HTML is exemplified.
[0029] FIG. 2(a) shows a hardware configuration diagram of the test script generation device 2. The test script generation device 2 includes a control unit 201, a storage unit 202, and a communication unit 203 as its hardware configuration. In this embodiment, the test script generation device 2 can be a computer device such as a server device or a personal computer. Note that the test script generation device 2 may be configured by multiple computers, and is not limited to the configuration shown in FIG. 2(a) as long as it can realize the above-mentioned functional components (21-25) as a whole.
[0030] The control unit 201 is configured with one or more processors such as a CPU, and controls the overall processing of the test script generation device 2 by executing a test script generation program, an OS (Operating System), and other applications. The storage unit 202 is a hard disk drive (HDD), a solid state drive (SSD), a flash memory, a random access memory (RAM), or the like, and stores the test script generation program and various data. The storage unit 202 stores various data as a database. The communication unit 203 controls communication with the communication network NW, and realizes data communication with the user terminal 3 and the generation device 4.
[0031] The generating device 4 may have the same hardware configuration as the test script generating device 2. The generating device 4 may also be implemented in the same computer device as the test script generating device 2. Furthermore, the generating means 40 may be realized as a functional component of the test script generating device 2.
[0032] 2(b) shows a hardware configuration diagram of the user terminal 3. The user terminal 3 includes, as its hardware configuration, a control unit 301, a storage unit 302, a communication unit 303, an input unit 304, and a display unit 305. In this embodiment, the user terminal 3 may be a smartphone, a personal computer, a tablet terminal, or the like.
[0033] The control unit 301 is composed of one or more processors such as a CPU, and controls the overall processing of the user terminal 3 by executing an OS and other applications. The storage unit 302 is an HDD, SSD, flash memory, RAM, etc., and stores a browser application and various data. The communication unit 303 controls communication with the communication network NW, and realizes data communication with at least the test script generation device 2. The input unit 304 is an input interface that accepts input operations by the user, and is composed of a touch panel, mouse, keyboard, etc. The display unit 305 is composed of a display that displays the processing results of the control unit 301, etc.
[0034] In this embodiment, the user terminal 3 accesses the test script generation system 1 via a web browser, but this is not limiting. For example, the user terminal 3 may store a terminal generation support program in the storage unit 302 and execute the program using the control unit 301 to start an application and access the test script generation system 1. The user terminal 3 may also be configured to implement part of the functional configuration (21-25) of the test script generation device 2.
[0035] 3 illustrates a processing sequence in the test script generation system 1. The user terminal 3 establishes communication with the test script generation device 2 by performing a login process or the like via a web browser.
[0036] The user terminal 3 transmits screen information relating to the screen S to be tested to the test script generation device 2 (S101). Here, the screen information is transmitted to the test script generation device 2 to allow the test script generation device 2 to acquire screen elements of the screen S. Therefore, the screen information may be link information such as a URL (Uniform Resource Locator) of the screen S. Alternatively, the screen information may be screen elements included in the screen S.
[0037] The test script generation device 2 generates test steps for the screen S based on the screen information and transmits them to the user terminal 3 (S102). A test step is data for executing one test process related to the display and operation of the screen S. The content of a test step can be updated by an update instruction from the user terminal 3. In this embodiment, the test step before the update is referred to as the first test step, and the test step after the update is referred to as the second test step, to distinguish them from each other.
[0038] When updating a test step, the user terminal 3 transmits a step update instruction to the test script generation device 2 (S103). The step update instruction is transmitted by specifying one or more test steps to be updated. The step update instruction may also be applied to all test steps. Note that if no test steps are to be updated, steps S103 to S106 can be omitted.
[0039] The test script generation device 2 transmits a generation instruction to the generation device 4 for one or more test steps included in the step update instruction (S104). The generation device 4 generates generation data in accordance with the generation instruction and transmits the generation data to the test script generation device 2 (S105). The test script generation device 2 generates a second test step based on the generation data and transmits the second test step to the user terminal 3 (S106).
[0040] The user terminal 3 sends a script generation instruction to the test script generation device 2 to generate a test script based on the test steps (S107). When updating the test steps again, the user terminal 3 may send a step update instruction to the test script generation device 2, as in S103. The test step update process can be executed repeatedly, with no limit on the number of times. The test step updated via the generation device 4 is defined as a second test step, regardless of the number of updates.
[0041] The test script generation device 2 generates a test script corresponding to the test step in response to the test script generation instruction and transmits it to the user terminal 3 (S108). Note that the test step and the test script are in a corresponding relationship, and the test script may be generated at the same time as the test step is generated. In this case, in S107 and S108, the test script generation device 2 saves the test script based on the test step in response to the script generation instruction.
[0042] FIG. 4 illustrates an example of an overall processing flowchart in the test script generation device 2.
[0043] The acquisition unit 21 acquires each screen element included in a screen (S201). The acquisition unit 21 acquires link information of the screen, and acquires screen elements included in the screen accessed from the link information. The acquisition unit 21 may also acquire the screen elements by acquiring a code of the screen from the user terminal 3.
[0044] The extraction unit 22 extracts test target elements based on each screen element included in the screen (S202). The test target elements are identified by unique identification information based on attributes such as id, name, class, cssSelector, and xpath. In this embodiment, the extraction unit 22 extracts operation target information including, in particular, an operation target and an operable element for each screen element.
[0045] In this embodiment, an operable element refers to a screen element having a tag name or type related to an operation such as input or select. An operation target particularly refers to the identification information of a screen element that corresponds to the above-mentioned operable element among the elements to be tested. The operation target includes the type of identification information that identifies the target and the value of the type of identification information. The type of identification information indicates name, id, class, CssSelector, Xpath, etc. If the type of identification information is an id attribute, the value of the id of the screen element in question.
[0046] The step generation unit 23 generates a test step including operation content corresponding to the operable element included in the operation target information (S203). In this embodiment, the operation content is defined as an operation target according to the operable element and the operation content for the operation target, such as click, check, input, or select. A test step is composed of data including identification information of the test step, the operation content, and an explanation of the operation content. Since a screen element may be composed of multiple types of identification information and their values, a screen element can be uniquely identified by referring to both the type of identification information and its value.
[0047] In this embodiment, the operation content corresponds to "click" and includes an operation of clicking an operation target such as a button or a link. The operation content corresponds to "check" and includes an operation of checking an operation target such as a checkbox. The operation content corresponds to "input" and includes an operation of inputting text data into an operation target such as a form. The operation content corresponds to "select" and includes an operation of selecting an operation target such as a radio button or a pull-down list. The operation content is not limited to these examples and may include other operation classifications that define the operation content.
[0048] When the step generation unit 23 receives the step update instruction (YES in S204), the step generation unit 23 generates a second test step. The second test step is generated by the generation device 4.
[0049] If there is no step update instruction (NO in S204), the script generation unit 24 generates a test script based on the test steps (S205). Note that the script generation unit 24 may generate a test script based on the test steps in response to a script generation instruction. The test script is generated based on either the first test step, the second test step, or the first and second test steps.
[0050] Specific processing by the extraction unit 22 in step S202 will be described with reference to Fig. 5. The extraction unit 22 extracts a test target group from the screen elements. The test target group includes one or more screen elements.
[0051] First, the extraction unit 22 acquires the tag name and child node of a screen element (S301). In this embodiment, the tag names to be test target elements are listed and stored in the storage unit 202. The extraction unit 22 refers to the list, and if it can determine that the acquired tag name can be a test target element (YES in S302), it adds the screen element to the test target list.
[0052] If the extraction unit 22 cannot determine whether the screen element can be a test target element from the tag name (NO in S302) and there is no child node of the screen element (NO in S303), the extraction unit 22 adds the screen element to the test target list. If the screen element has a child node, the extraction unit 22 determines whether to add it to a specific test target list in S304 to S305.
[0053] If the child node has one or more text nodes (YES in S304), the extraction unit 22 adds the screen element to the test target list. If there is only one child node and the character string in the tag is the same as that of the parent node (YES in S305), the extraction unit 22 adds the screen element to the test target list. If the child node has only one text node and the character string in the tag is the same as that of the parent node (YES in S305), the extraction unit 22 recursively searches for the target screen element, and if all of the grandchild nodes are text nodes (YES in S306), the extraction unit 22 adds the screen element to the test target list. If the extraction unit 22 returns NO in S306, the extraction unit 22 excludes the screen element from the test target.
[0054] After determining whether to add a certain screen element to the test target list, if there are unprocessed screen elements (YES in S308), the extraction unit 22 returns to S301 and repeatedly determines whether to add the unprocessed screen elements to the test target list. The extraction unit 22 classifies all screen elements in the screen into test target elements and non-test target elements.
[0055] After extracting the screen elements to be tested, the extraction unit 22 deletes unnecessary screen elements and terminates the process (S309). Unnecessary screen elements include, for example, screen elements not included in the test target list, and screen elements that correspond to grandchild elements when grandparent elements and grandchild elements of the test target list exist simultaneously. Here, the extracted test target list may include operation target information and non-operation target information.
[0056] The step generation unit 23 generates test steps based on the non-operation target information and operation target information extracted as the test target list. The non-operation target information includes target identification information and target screen elements. Here, the target screen elements are non-operable elements on the screen that cannot be operated. The operation target information includes operation targets and operable elements. The operation targets are identification information or the like that can identify the operation targets. The operable elements are screen elements that can be operated on the screen by clicking, inputting, or the like.
[0057] The test group includes an operable element and its sibling screen elements. An older screen element of an operable element refers to a screen element located before the operable element. A younger screen element of an operable aspect refers to a screen element located after the operable element.
[0058] As a specific example, if an operable element is an input form, the older element is likely to be the caption of the input field. Furthermore, the younger element is likely to be an example of how to fill out the input field (such as the number of characters to be entered). In this case, if you try to generate test steps from only the operable elements, it is impossible to generate accurate input values because it is unclear what kind of input value to generate for the input field and how many characters to generate. The test target group is set for the purpose of improving the accuracy of test steps by extracting the operable element and its sibling elements as a group. Sibling elements may also be set to generate something other than input values.
[0059] The specific processing of the step generation unit 23 in S203 will be described with reference to Fig. 6. Fig. 6 shows the processing for generating a first test step. The step generation unit 23 executes processing for generating a test step for a screen element added to the test target list.
[0060] The step generation unit 23 generates test steps related to non-operable elements based on the non-operation target information (S401). Test steps related to basic elements are defined as steps used in basic screen tests such as tab switching, acquiring screen captures, and verifying expected values for screen URLs and titles. In contrast, test steps related to operable elements are defined as steps used in screen tests related to interactive functions associated with user operations on the screen.
[0061] The step generating unit 23 generates test steps for each test target group. The step generating unit 23 acquires all operable elements from the test target group (S402).
[0062] The step generation unit 23 generates a test step for each of the acquired operable elements. The step generation unit 23 acquires identification information of the operable elements (S403). The identification information may be, for example, any of id, name, cssSelector, xpath, etc.
[0063] The step generation unit 23 generates a description of the test step using any of the label, value, character string, and identification information contained in the acquired operable element. The description is a sentence that explains in natural language the operation content and operation target performed by the test step, and is referenced when the user specifies the test step and generates a test script. The description is generated by applying the variable of the operable element to the blank space in the template text. The label, value, character string, and identification information correspond to these variables. Note that the information used to generate the description is not limited to the above, and codes of other screen elements related to the description of the test step may also be used.
[0064] If there is a label attribute associated with the operable element (YES in S404), the step generation unit 23 generates a description of the test step using the label name of the label attribute (S405). If there are values for the placeholder attribute or value attribute (YES in S406), the step generation unit 23 generates a description of the test step using the value (S407). The values of the placeholder attribute and value attribute indicate placeholders, initial values, etc. displayed in operable elements such as forms. If there is a character string within a tag (YES in S408), the step generation unit 23 generates a description using the character string within the tag (S409). If there is no character string within the tag (NO in S408), the step generation unit 23 generates a description of the test step using identification information of the screen element (S410). The identification information of the screen element includes an alt attribute, a title attribute, an id attribute, a name attribute, a class attribute, etc. In this embodiment, the step generation unit 23 determines the label, value, and character string included in the screen element in the order of S404, S406, and S408. The order of these determinations may be changeable depending on the priority of the information used as the test step description.
[0065] The step generation unit 23 acquires the tag name and type of the operable element (S411). The step generation unit 23 determines whether the operable element corresponds to an input form, a button or link, a pull-down list, or a check box from the acquired tag name and type, and generates a test step according to the determination result.
[0066] The tag name indicates the meaning of the screen element, and input, select, textarea, a (anchor), button, etc. are used to determine operable elements. For the select tag name, the string within the option element tag and value are also obtained. For example, the tag name select can be determined as a selection step, textarea as an input step, and a or button as a click step. The type is related to the operation (tag name) of inputting data and indicates the type and format of the data. Types such as text, email, password, radio, checkbox, file, hidden, submit, image, reset, and button are used to determine whether an element is operable. For example, if the type is text, it can be determined that the element is an input form, if it is radio, it can be determined that the element is a radio button, and if it is checkbox, it can be determined that the element is a checkbox.
[0067] FIG. 7 shows an example of the tag names and types of the operable elements acquired in S411. FIG. 7(a) is an example of an operable element with tag name: input and type: text. Element C10 has tag name C11, type C12, and value C13. When type C12 is set to text as its type, it is displayed as an input form. Type C12 is displayed as a button or check box depending on the type set. Value C13 is set to a value such as a placeholder or initial value. 7(b) is an example of an operable element with tag name: select. Element C20 has tag name C21, value C22, and in-tag string C23. In-tag string C23 between optional elements represents the options selectable in the pull-down list, and in the illustrated example, includes three options: "Option 1," "Option 2," and "Option 3." Value C22 indicates the value of each option and is used for communicating information about the selection results.
[0068] If the operable element is an input form (YES in S412), the step generation unit 23 generates an input value and then generates an input test step (input step) (S413). If the operable element is a clickable button or link (YES in S414), the step generation unit 23 generates a click test step (click step) (S415). If the operable element is a pull-down list (YES in S416), the step generation unit 23 acquires the character string in the tag of the option element and the value of the value, and generates a select test step (selection step) that includes them as selection items (S416). If the operable element is a checkbox (YES in S418), the step generation unit 23 generates a check test step (check step) (S419). The check step includes at least one of an operation to check the checkbox and an operation to uncheck it.
[0069] If the operable element is not a checkbox (NO in S418), the step generation unit 23 generates a test step (verification step) for verifying the expected value of the character string in the tag (S420). Although the example in which the step generation unit 23 judges the operable element in the order of input step, click step, selection step, and check step has been shown, the order is not limited to these and any order may be used. Furthermore, the test steps for the operable element are not limited to those described above, and test steps that define other operation contents on the screen may also be provided.
[0070] The verification step executes tests to verify whether character strings such as the screen URL and title are displayed as expected, whether operable elements are in an inoperable state, etc. The expected values are given by character strings in tags, etc. When the verification step is executed, the verification results are also output.
[0071] In this embodiment, the operation content indicates the content of a test related to an operation on a screen. In this embodiment, the operation content is defined to include an operation target and operation content, and executes one operation in a test script. More specifically, the operation content includes operation content, an identification element, and an element value, and may further optionally include a variable (input value).
[0072] 8 shows an example of operation content in this embodiment. As shown in FIG. 8(a), the operation content includes an operation content section C30 indicating the content of the operation on a screen element, and an operation target section C40 indicating the identification information of the screen element. The operation target section C40 includes an identification element designation section C41 that designates the identification information (identification element), and a value designation section C42 that designates a value (element value) defined for the identification information designated in the identification element designation section C41.
[0073] The operation contents in the operation content section C30 include operations related to data input such as clicking on screen elements and entering text (input, click, select, check), operations to determine the screen to be operated on by specifying the browser, window, and tab, and operations to collect test data and compare and verify the test data.
[0074] In this embodiment, the identification information is a name attribute, an id attribute, a value attribute, a class attribute, a CssSelector, an Xpath, etc., obtained from code such as HTML that constitutes the target screen. The identification information is arbitrarily defined by the user for each screen element. The value is a variable corresponding to the identification information, and indicates the attribute value in the case of the name attribute, the id attribute, the value attribute, and the class attribute. CssSelector and Xpath provide identification information that can uniquely identify screen elements by expressions using the above-mentioned attribute values or expressions combined with code tags.
[0075] If the operation content includes an input value for a screen element, it may include a variable section C50 indicating the input value, as shown in FIG. 8(b). The input value indicates, for example, a character string when entering text into a text box. Furthermore, if the same identification information value is defined for the same screen element on the same screen, the operation target section C40 includes an index section C43 indicating an identifier. The identifier in the index section C43 is information linked to the identification information value in order to identify duplicate screen elements, and is assigned according to predetermined rules.
[0076] The operation content in Figure 8(a) shows an operation of clicking on a screen element whose identification information is the class attribute and whose value is given as class_price. The operation content in Figure 8(b) shows an operation of inputting "80" as an input value to the screen element whose identification information is the class attribute and whose value is given as class_price, and which has been assigned an identifier of 2.
[0077] The operation content is determined by determining an operation content section C30 from the tag name and type relating to the operation content included in the operable element, and determining an operation target section C40 from the identification information of the operation target included in the operable element.
[0078] After generating a test step for a certain operable element, if there are unprocessed elements (YES in S421), the step generation unit 23 returns to S403 and executes processing to generate test steps for other operable elements. Also, after generating a test step for a certain test target group, if there are unprocessed test target groups (YES in S422), the step generation unit 23 returns to S402 and executes processing to generate test steps for other test target groups. After executing processing for all elements and all test target groups, the step generation unit 23 completes processing.
[0079] In one aspect, the step generation unit 23 may generate the first test step by inputting a generation instruction for the first test step including operation content corresponding to one or more operable elements included in the test target group into the generation model, and obtaining output of one or more test steps from the generation model.
[0080] 9(a) shows an example of a screen display of a test screen W10 displayed on the user terminal 3. On the test screen W10, the target screen is specified by inputting a screen URL or the like. The test screen W10 includes a screen display area W11 that displays the target screen, an operation area W12 that accepts various operations by the user, a test step area W13 that accepts operations related to test steps, and an editing area W14 that accepts operations related to editing the test steps.
[0081] In FIG. 9(a), the screen display area W11 is displayed with operable elements such as a text box for entering an "email address," a text box for entering a "password," a check box for "remember login information," and a "login" button.
[0082] The operation area W12 includes a batch execution button, an update button, a script display button, and a save button. The batch execution button executes selected test steps all at once. The update button executes an update instruction for selected test steps or all test steps. The script display button displays the test script corresponding to the test step. The save button saves the test script corresponding to the test step.
[0083] When a screen is specified, the test step area W13 generates and displays one or more first test steps. The test steps explain the test operation content using the generated description. The test steps are linked to the operation content, and the operation content is executed by issuing an instruction to execute the test step. For example, in the input step, the operation of entering "test@example.jp" into the "Email address" text box is executed. Here, the part in " " is a variable, and by entering the variable into the template statement, it is displayed as the description of the test step.
[0084] In the test step area W13, you can select whether or not to execute each test step using a checkbox. The test step area W13 is configured so that test steps can be deleted, updated, and edited. In addition, the test step area W13 allows you to set the execution order of each test step.
[0085] 9(b) is an example of the display of test screen W10B when test step W131 is selected on test screen W10. Screen element W111 corresponding to test step W131 is highlighted in screen display area W11 along with the operation content. Edit area W141 displays the description, element identification method, ID, and current input value corresponding to test step W131, and accepts edits for each of these.
[0086] The explanatory text is generated by referencing template text stored in the storage unit 202, which corresponds to the operation content. The explanatory text is generated by inputting variables such as label names and input values into blank spaces in the template text. The element identification method is specified by the type of identification information (id, class, etc.) that identifies the element. The value indicates the value of the type of identification information (identification element) specified by the element identification method. The input value is set to an initial value based on the value of the placeholder or value. The input value can generate multiple candidate locations using a generative model.
[0087] The element identification method corresponds to the identification element specified in the identification element specification section C41. The value corresponds to the value specified in the value specification section C42. The input value corresponds to the input value specified in the variable section C50. In other words, the editing area W14 is used to edit each component of the operation content.
[0088] The test screen W10 is displayed by acquiring screen elements by the acquisition unit 21, extracting operable elements by the extraction unit 22, generating test steps by the step generation unit 23, and outputting the results by the output unit 25. The script generation unit 24 generates a test script based on the test steps by specifying one or more test steps or by pressing a script generation button.
[0089] When the update button is pressed, the test screen W10 regenerates (updates) the first test step as a second test step. Based on the step update instruction, the step generation unit 23 generates the first test step of the test screen W10 as a second test step.
[0090] The generation of the second test step will now be described. The step generation unit 23 generates input data for a step update instruction based on the extracted operation target information or the generated first test step. The step update instruction includes input data for the test step to be generated and a generation rule.
[0091] The input data includes an operation target and an operable element. The operation target includes a type of identification information and a value of the identification information. The operable element includes a screen element (HTML) of the operation target. In the case of an element related to a pull-down list or a check box, the input data may further include the value of the element.
[0092] The generation rules are rules for generating output data by the generation means 40. In this embodiment, the generation means 40 employs a large-scale language model that can generate output data according to the generation rules in natural language. In this embodiment, the input data and output data are also included as part of the generation rules. An example of the generation rules of this embodiment is shown below.
[0093] Generates a step of type click for clickable elements. For checkboxes, generate a step of type check using the input data value. For input-enabled elements (excluding checkboxes, radio buttons, and drop-down lists), generate 10 unique input values, then generate a step of type input. For selectable elements, generate a step of type select using the input data values. The generated test steps must be associated with the identification information of the input data.
[0094] The step generating unit 23 transmits a generation instruction including input data and a generation rule to the generating device 4, and obtains output data generated by the generating device 4.
[0095] In this embodiment, the output data includes a test step identifier, a type of operation in the test step, a description of the test step, and an operation target. Test step types include, but are not limited to, click, input, check, and selection. The output data may further include values depending on the type. In selection steps and check steps, the values use the values of the input data. In input steps, the values are generated by generating multiple different input values.
[0096] 10 shows an example of input data and output data included in a test step generation instruction. In this embodiment, the input data and output data are structured by a data format. The data format can be an array structure such as JSON, CSV, or XML. In this embodiment, the data format is JSON, but is not limited to this and any format can be used.
[0097] The input data has properties of targetID, target, outerHTML, and values. The target corresponds to the type of identification information to be operated on, the targetID corresponds to the value of the identification information, and the outerHTML corresponds to the operable element. The description of each property is written in natural language in the generation rules, and the definitions are interpreted by the generation means 40.
[0098] The output data has the following properties: ID, type, action, values, target, and targetID. The type corresponds to the type of test step, the action corresponds to the description, and the target and targetID correspond to the operation target. These properties are explained in the generation rules, just like the input data.
[0099] In this embodiment, the generation rules include specifications for the structures of the input data and the output data. The generation rules define the properties of the input data, so that the generation means 40 recognizes the operation target information or the input data from the first test step as properties. The generation means 40 can further generate the properties of the output data defined by the generation rules using the properties of the input data.
[0100] The step generation unit 23 generates a second test step based on the output data. The second test step includes an operation content based on the type, target, and target ID. The operation content can also include an input value based on the values according to the type. In other words, the structure of the output data defines properties corresponding to the operation content.
[0101] The step generation unit 23 generates an input value included in a test step. The step generation unit 23 can generate the input value of a test step by inputting an instruction to generate an input value to the generation means 40 and obtaining the output of the input value of the test step from the generation means 40. The instruction to generate an input value includes input data and a generation rule. The instruction to generate an input value can adopt the first test step as input data. Note that the input data may be operation target information extracted by the extraction unit 22.
[0102] The instruction to generate the second test step and the instruction to generate the input value can be executed independently of each other, or can be executed simultaneously. For example, in generating the second test step, if an input value is required for an input step, the step generation unit 23 can simultaneously generate the input value.
[0103] 11 shows an example of input data included in an instruction to generate an input value and output data for the input value. The input data and output data are in a structured data format similar to the data in FIG.
[0104] The input data has the properties id, html, description, badExample, and goodExample. id corresponds to identification information unique to the input step, html corresponds to the screen element (operable element) for which the input value is generated and its sibling screen elements, and description corresponds to the description of the test step. badExample and goodExample indicate a bad example and a good example, respectively, for generating input values. The output data has properties of id and values, where id corresponds to unique identification information for the input step, and values corresponds to the input values of the test step.
[0105] An older screen element of a target screen element refers to a screen element located before the target screen element. For example, when generating an input value for a name, good examples would be "Taro, Jiro, Ayaka, Hanako", and bad examples would be "Yamada, Yamada Taro, David". These data can be set by the user, or the results of the previous input value generation can be used.
[0106] When generating input values, the test step description and good and bad examples are used as input data, and multiple desirable data that can serve as candidate input values for the screen test can be generated by referring to the variables contained in the description and good and bad examples of input values.
[0107] In generating an input value, the input data and output data are included as part of the generation rule. Examples of generation rules included in an instruction to generate an input value are shown below.
[0108] Do not generate bad data. Generate good examples and similar data. Generate data based on the element's type and pattern attribute values. Generate data that meets the length conditions according to the max, maxlength, min, and minlength attribute values of the element. Generates data similar to the element's value and placeholder attribute values. The element name, id and description in the input data are analyzed to determine the use of the element before generating the data. In the html of the input data, the html before the element may contain an explanation about the element. In the html of the input data, the html after the element may contain an input example for the element.
[0109] The html before the element in the generation rule refers to the screen element of the older element, and the html after the element refers to the screen element of the younger element. Sibling elements are extracted as the test target group. Sibling elements are related to the input value to be generated and may correspond to the explanation of the input item or input example (including input rules, etc.). The accuracy of the input value of the output data can be improved by referring to these explanations and input examples.
[0110] The step generation unit 23 generates input steps based on multiple input values included in the output data. One or multiple input values are specified for each input step, and the input step is executed as a test operation in which those input values are input. Note that the step generation unit 23 may generate multiple input steps based on multiple input values. [Explanation of symbols]
[0111] 1 Test script generation system 2 Test script generator 21 Acquisition Department 22 Extraction part 23 Step generation section 24 Script Generation Section 25 Output section 3. User terminal 4 Generator 40 Generation means
Claims
1. an extraction unit that extracts operation target information including an operation target and an operable element for each screen element included in the screen; a step generation unit that generates a test step including an operation content corresponding to an operational element included in the operation target information; a script generation unit that generates a test script by specifying one or more of the test steps.
2. 2. The test script generation system of claim 1, wherein the step generation unit inputs a test step generation instruction into a generation model using input data including an operation target and an operable element, and obtains the output of one or more test steps from the generation model.
3. the step generation unit inputs a test step generation instruction including the input data and a generation rule to the generative model, and generates one or more test steps based on output data acquired from the generative model; 3. The test script generation system according to claim 2, wherein the structure of the output data is defined by the generation rule so as to include an operation target and an operation type.
4. 4. The test script generation system according to claim 1, wherein the test step includes a description of the test step written in a natural language.
5. 5. The test script generation system according to claim 4, wherein the step generation unit generates variables to be included in the description of the test step using at least one selected from a label name, a value, a character string within a tag, and identification information included in the operation target information.
6. 2. The test script generation system of claim 1, wherein the step generation unit inputs a second test step generation instruction into a generation model using input data including the operation target information or the generated first test step, and obtains outputs of one or more second test steps from the generation model.
7. the test step includes one or more input values to be applied to the operation content; 2. The test script generation system according to claim 1, wherein the step generation unit inputs an instruction to generate an input value of the test step to a generation model and obtains an output of one or more input values from the generation model.
8. 8. The test script generation system of claim 7, wherein the step generation unit inputs an instruction to generate the input value into a generative model using input data including an operable element and a description of the test step, and obtains output data including one or more of the input values from the generative model.
9. The test script generation system according to claim 8 , wherein the input data further includes screen elements of sibling elements of the operable element.
10. extracting operation target information including an operation target and an operable element for each screen element included in the screen; generating a test step including an operation content corresponding to the operational element included in the operation target information; generating a test script by specifying one or more of the test steps.
11. an extraction unit that extracts operation target information including an operation target and an operable element for each screen element included in the screen; a step generation unit that generates a test step including an operation content corresponding to an operational element included in the operation target information; a test script generation program that causes a computer to function as a script generation unit that generates a test script by specifying one or more of the test steps.
Citation Information
Patent Citations
Test case generation method and device, electronic equipment and storage medium
CN117389890A
Software test apparatus, software test method, and software test program
JP2016194787A
Utilizing artificial intelligence to test cloud applications
US20190213115A1
Test support device, test support program and test support method
JP2021174096A
Program, information processing method, and information processing device
JP2023075780A