Interface test case generation method and device, equipment and medium
By acquiring standardized requirement templates and interface element coordinate libraries, interface test cases are automatically generated, solving the problems of low efficiency and conflicts caused by human differences in existing technologies, and achieving efficient generation and testing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AGRICULTURAL BANK OF CHINA
- Filing Date
- 2022-10-13
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies are inefficient in generating interface test cases and are prone to conflicts due to human differences. Manual recording is labor-intensive and difficult to maintain.
By obtaining the standardized requirement template of the interface to be tested, a flowchart is generated according to the set parsing rules, and interface test cases are automatically generated by combining the interface element coordinate library.
It improves the efficiency of generating interface test cases, avoids conflicts caused by differences in manual recording, and saves human resources.
Smart Images

Figure CN115509932B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer testing, and more particularly to methods, apparatus, equipment, and media for generating interface test cases. Background Technology
[0002] In the software system development process, system functional testing is typically required to verify the system's stability and functionality. A crucial task in system functional testing is generating functional test cases, with user interface (UI) test cases making up the largest proportion of these. Generating UI test cases is a tedious and error-prone process.
[0003] Current technologies typically involve first generating automated scripts through manual recording, then maintaining and managing these scripts, and finally executing them by machine for regression testing before each production deployment. However, due to the manual recording process, human error is inevitable during script generation. For example, the same transaction recorded by two different people might produce slightly different scripts. This situation presents some challenges for script maintenance, and the manual recording method also poses a human resource challenge. Summary of the Invention
[0004] This invention provides a method, apparatus, device, and medium for generating interface test cases, so as to realize the automatic generation of interface test cases.
[0005] According to a first aspect of the present invention, a method for generating interface test cases is provided, comprising:
[0006] Obtain the standardized requirement templates that have been pre-written for the interface to be tested;
[0007] The standardized requirement template is parsed according to the set parsing rules to generate a flowchart corresponding to the interface to be tested.
[0008] Based on the flowchart and a pre-determined coordinate library of interface elements of the interface to be tested, interface test cases are generated for the interface to be tested.
[0009] According to a second aspect of the present invention, an apparatus for generating interface test cases is provided, comprising:
[0010] The template acquisition module is used to acquire standardized requirement templates that have been pre-written for the interface to be tested.
[0011] The flowchart generation module is used to parse the standardized requirement template according to the set parsing rules and generate the flowchart corresponding to the interface to be tested.
[0012] The test case generation module is used to generate interface test cases for the interface to be tested based on the flowchart and a pre-determined coordinate library of interface elements of the interface to be tested.
[0013] According to a third aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] At least one processor; and
[0015] A memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to execute the interface test case generation method according to any embodiment of the present invention.
[0017] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the interface test case generation method according to any embodiment of the present invention.
[0018] The technical solution of this invention involves obtaining a pre-written standardized requirement template for the interface to be tested; parsing the standardized requirement template according to set parsing rules to generate a flowchart corresponding to the interface to be tested; and generating interface test cases for the interface to be tested based on the flowchart and a pre-determined coordinate library of interface elements. This method provides testers with a standardized requirement template, generates a flowchart of the requirements corresponding to the interface to be tested based on the standardized requirement template, automatically converts the interface elements in the interface to be tested into corresponding coordinates, and automatically generates interface test cases based on the flowchart and the coordinate library of interface elements. This eliminates the need for manual recording of the interface to be tested, improves the efficiency of interface test case generation, and avoids conflicts in interface test cases caused by differences in manual recording.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart of a method for generating interface test cases provided in Embodiment 1 of the present invention;
[0022] Figure 2 This is a flowchart of a method for generating interface test cases provided in Embodiment 2 of the present invention;
[0023] Figure 3 This is a schematic diagram of the structure of an interface test case generation device provided in Embodiment 3 of the present invention;
[0024] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0025] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0027] Example 1
[0028] Figure 1 This is a flowchart illustrating a method for generating interface test cases according to Embodiment 1 of the present invention. This embodiment is applicable to the generation of interface test cases. The method can be executed by an interface test case generation device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:
[0029] S110. Obtain the standardized requirement templates that have been pre-written for the interface to be tested.
[0030] In this embodiment, the interface to be tested can be understood as the interface that needs to be tested, generated according to business requirements, and can be an interface in the form of a web page, etc. The standardized requirement template can be understood as a template provided by the business requirements corresponding to the interface to be tested.
[0031] Specifically, different standardized requirement templates can be provided based on the interface elements (such as controls, buttons, etc.) included in each interface to be tested. Standardized requirement templates can be generated according to the business execution steps, the controls that need to be clicked, the controls that need to input content, the content requirements corresponding to the controls that need to input content, and the final requirements to be achieved. Users can fill in the standardized requirement templates according to the prompts in the standardized requirement templates based on their business requirements to generate standardized requirement templates corresponding to their business requirements.
[0032] For example, the interface to be tested corresponds to a function page of the web version of the corresponding tool. The web version can include multiple pages. If the business requirement of the interface to be tested is to implement account login, then the standardized requirement template can correspond to page 1, which can include: Business requirement: Implement account login; Step 1: The required control is text box 1, used to input the account name, which must be 4-8 characters long and cannot include special characters; Step 2: The required control is text box 2, used to input the password corresponding to the account name, which must be at least 10 characters long and include uppercase letters, lowercase letters, numbers, and symbols; Step 3: The required control is the login control.
[0033] S120. Parse the standardized requirement template according to the set parsing rules and generate the flowchart corresponding to the interface to be tested.
[0034] In this embodiment, the parsing rules can be understood as parsing rules generated based on the flowchart drawing rules. A flowchart can be understood as a flowchart generated according to set steps, combining the content of each step with corresponding graphic shapes.
[0035] Specifically, the standardized requirement template can be parsed according to the set parsing rules. The template is divided into steps, determining the sequence of each step and its corresponding branches. Then, the content of each step is parsed to determine whether it corresponds to affirmative statements or conditional statements. Affirmative statements can be filled into the flowchart using defined boxes, while conditional statements can be filled into the flowchart using diamond shapes. A diamond shape corresponding to a conditional statement typically has two branches. After parsing the standardized requirement template according to the parsing rules, a flowchart for the interface to be tested can be generated according to the corresponding step sequence and the shape of the step box for each step.
[0036] For example, the standardized requirement template includes step 1, content a; step 2, content b; step 3, content c, content c; step 4, content d, content d; step 5, content e, content e; step 6 is a sub-branch of step 4, content f. The standardized requirement template is parsed according to the set parsing rules, and the generated flowchart can be: Start; S1, box a; S2 connected to S1, box b; S3 connected to S2, rhombus c; S4 connected to S3, box d; S5 connected to S3, box e; S6 connected to S4, box f.
[0037] S130. Based on the flowchart and the pre-determined coordinate library of interface elements of the interface to be tested, generate interface test cases for the interface to be tested.
[0038] In this embodiment, the interface element coordinate library can be understood as the coordinates of the corners corresponding to the interface elements included in the interface to be tested. The interface test case can be understood as the script file read by the computer to execute the interface test.
[0039] Specifically, based on the developed UI design, the UI can be coordinated according to factors such as screen resolution and interface size, forming a coordinate library of interface elements corresponding to the elements included in the interface to be tested. The coordinate information of the corresponding interface elements in the coordinate library can be found according to each step in the flowchart. Since interface elements may be rectangular, the coordinate information is a coordinate group, that is, the four coordinates corresponding to the four corners of the rectangle. The area enclosed by the four coordinates is determined as the area of the corresponding interface element. According to the steps in the flowchart, the coordinate information corresponding to each interface element is arranged in sequence, generating a logically ordered sequence of interface element operations. This sequence of operations is then converted into a script file that the computer can read, thus generating the interface test cases for the interface to be tested.
[0040] For example, the interface to be tested may include four quadrilateral text boxes. Each text box can be determined based on the area formed by the four coordinates of the four corners. That is, the interface element coordinate library may include four sets of coordinates corresponding to the interface to be tested, namely, set A, set B, set C, and set D. By arranging the four sets of coordinates in order according to the flowchart, the operation order of each interface element can be determined as C, B, D to A. Then, the operation order of the interface elements is transformed, and the generated interface test case can be interface 1 (C, B, D to A).
[0041] This embodiment provides a method for generating interface test cases. It involves obtaining a pre-written standardized requirement template for the interface to be tested; parsing the standardized requirement template according to set parsing rules to generate a flowchart corresponding to the interface to be tested; and generating interface test cases for the interface to be tested based on the flowchart and a pre-determined coordinate library of interface elements. This method provides testers with a standardized requirement template, generates a flowchart of the requirements corresponding to the interface to be tested based on the standardized requirement template, automatically converts the interface elements in the interface to be tested into corresponding coordinates, and automatically generates interface test cases based on the flowchart and the coordinate library of interface elements. This eliminates the need for manual recording of the interface to be tested, improves the efficiency of interface test case generation, and avoids conflicts caused by differences in manual recording.
[0042] As a first optional embodiment of this example, after generating interface test cases for the interface to be tested based on the flowchart and a pre-determined coordinate library of interface elements of the interface to be tested, further optimizations include:
[0043] Based on the interface test cases, test the interface to be tested corresponding to the interface test cases.
[0044] Furthermore, based on the interface test cases, the specific steps for testing the interface to be tested corresponding to the interface test cases may include:
[0045] a1. Analyze the interface test cases and determine the element coordinate information of each interface element in the interface to be tested.
[0046] In this embodiment, element coordinate information can be understood as the coordinate group corresponding to the interface element.
[0047] Specifically, the processor can parse the interface test cases using a pre-defined parsing method to obtain the element coordinate information corresponding to the interface elements included in the interface test cases.
[0048] b1. Determine the operation position of the interface element corresponding to the element coordinate information based on the element coordinate information.
[0049] In this embodiment, the operation location can be understood as the location where clicking can trigger the function of the interface element.
[0050] Specifically, based on the element coordinate information, the coordinates of each interface element can be determined. The center point coordinates of the area enclosed by these coordinates are then calculated; these center point coordinates represent the operational position of the interface element corresponding to that coordinate information. By calculating the center point coordinates of all element coordinates parsed from the interface test cases, the operational position of each interface element in the test interface can be determined.
[0051] c1. Test the interface to be tested according to the operation location.
[0052] Specifically, based on the operation location and the order of element operations in the interface test case, the mouse or keyboard can be guided to click and input the interface elements in the interface under test in sequence, and operate on the center point coordinates to achieve the test of the interface under test.
[0053] For example, the interface to be tested includes two interface elements. By analyzing the interface test cases, it is determined that each interface element corresponds to four coordinates, that is, the element coordinate information includes two sets of coordinates. The coordinates corresponding to interface element A are A1, A2, A3, and A4, and its operation position (i.e., the middle position coordinates) corresponds to AO. The coordinates corresponding to interface element B are B1, B2, B3, and B4, and its operation position (i.e., the middle position coordinates) corresponds to BO. The element operation order is A first, then B. The requirement corresponding to the interface to be tested is C. Then the processor first clicks the AO position, then clicks the BO position, and determines whether the result is C, thus completing the test of the interface to be tested.
[0054] In the first optional embodiment of this embodiment, the element coordinate information corresponding to the interface elements is obtained by parsing the interface test cases. The operation position of each interface element is determined according to the element coordinate information. By controlling the mouse or keyboard to click on the operation position of the interface elements in the execution order of the interface test cases, the function corresponding to the interface element is triggered, thereby realizing automated testing of the interface to be tested, saving manpower and improving testing efficiency.
[0055] Example 2
[0056] Figure 2 This is a flowchart illustrating a method for generating interface test cases according to Embodiment 2 of the present invention. This embodiment is a further refinement based on the above embodiments. Figure 2 As shown, the method includes:
[0057] S210. Obtain the standardized requirement templates that have been pre-written for the interface to be tested.
[0058] S220. Based on the parsing rules, determine the execution steps included in the standardized requirement template.
[0059] In this embodiment, the execution steps can be understood as the execution steps required for the interface to be tested to achieve the specified requirements.
[0060] Specifically, the standardized requirement template includes labels for the steps required to implement the interface to be tested. The standardized requirement template can be parsed according to the set parsing rules. First, the labels can be determined. Based on the labels, the order of each step and the corresponding branch steps can be determined, that is, the execution steps included in the standardized requirement template can be identified.
[0061] For example, based on the parsing rules, the steps included in the normalized requirement template can be determined, which can be step 1 and the branch steps 1.1, 1.2 and 1.3 required to execute step 1, and step 2 and the branch steps 2.1, 2.2, 2.3 and 2.4 required to execute step 2.
[0062] S230. Based on the execution steps, generate the flowchart corresponding to the interface to be tested.
[0063] Specifically, the content of each execution step is analyzed to determine whether it corresponds to an affirmative statement or a conditional statement. The step box shape for an affirmative statement can be a predefined square, and thus the affirmative statement is filled into the flowchart as a square step box. The step box shape for a conditional statement can be a diamond, and thus the conditional statement is filled into the flowchart as a diamond step box. A diamond step box for a conditional statement typically has two subordinate branches. After parsing the standardized requirement template according to the parsing rules, a flowchart corresponding to the interface to be tested can be generated according to the order of the corresponding execution steps and the shape of the step box for each step.
[0064] For example, following the example above, branch steps 1.1, 1.2, and 1.3 are all affirmative statements, branch step 2.1 is a conditional statement, and 2.2, 2.3, and 2.4 are all affirmative statements. Then, in sequence, the start box connects to the square step box 1.1, square step box 1.1 connects to square step box 1.2, square step box 1.2 connects to square step box 1.3, square step box 1.3 connects to the diamond step box 2.1, diamond step box 2.1 connects to square step boxes 2.2 and 2.3, square step box 2.3 connects to square step box 2.4, and square step box 2.4 connects to the end box.
[0065] S240. Based on the flowchart, determine the element operation sequence corresponding to the element coordinate information included in the interface element coordinate library.
[0066] In this embodiment, the element operation order can be understood as the execution order of the interface elements included in the interface to be tested.
[0067] Specifically, based on each execution step in the flowchart, the corresponding interface element for each execution step can be determined, and then the element coordinate information corresponding to the interface element in the interface element coordinate library can be determined. According to the order of the execution steps, the element coordinate information corresponding to the interface elements can be arranged to generate the element operation sequence with business logic.
[0068] The steps for determining the coordinate library of interface elements may include:
[0069] a2. Obtain the interface parameter information corresponding to the interface to be tested.
[0070] In this embodiment, the interface parameter information can be understood as information such as the interface size corresponding to the interface to be tested.
[0071] Specifically, the system can recommend the optimal screen resolution for the interface to be tested to the user in advance. Based on the optimal screen resolution and the size of the interface to be tested, the corresponding interface parameter information can be determined.
[0072] b2. Based on the interface parameter information, perform coordinate processing on the interface elements included in the test interface and generate coordinate processing results.
[0073] Specifically, based on the interface parameter information, the size of the interface to be tested at the optimal screen resolution and the parameter information of the interface elements included in the interface to be tested can be determined, such as the length and width of buttons, text boxes, tables, etc. The interface elements included in the interface to be tested are then processed into coordinates. The coordinates of the corners corresponding to the borders of the interface elements are determined according to the pre-set coordinate transformation method, combined with the interface parameter information. The coordinate area corresponding to the corner coordinates can be considered as the corresponding interface element. The included coordinates are then associated with the interface elements to generate the coordinate processing result.
[0074] c2. Determine the coordinate library of interface elements based on the coordinate processing results.
[0075] Specifically, all interface elements in the interface to be tested can be processed into coordinates, and the coordinate groups formed by each interface element and its corresponding multiple coordinates can be associated. The association relationship between all interface elements and coordinates in the interface to be tested can be integrated as an interface element coordinate library.
[0076] Furthermore, based on the flowchart, the specific steps for determining the element operation sequence corresponding to the element coordinate information included in the interface element coordinate library may include:
[0077] a3. Obtain the element coordinate information corresponding to each interface element in the interface element coordinate library.
[0078] Specifically, the coordinate information of each interface element in the interface element coordinate library can be obtained, thereby determining the coordinate group formed by each interface element and its associated coordinates.
[0079] b3. Arrange the element coordinate information according to the logical order contained in the flowchart.
[0080] Specifically, the logical order of the execution steps of the interface to be tested can be determined according to the flowchart, the corresponding interface elements can be determined according to each execution step, the interface elements can be sorted according to the logical order of the execution steps, the coordinate group associated with the interface element can be determined according to the element coordinate information, and the coordinate group can be replaced to the position of the corresponding interface element sorted according to the logical order.
[0081] For example, interface element D is determined by 3 coordinates, that is, the coordinate group associated with D can be D3; interface element E is determined by 4 coordinates, that is, the coordinate group associated with E can be E4; interface element F is determined by 4 coordinates, that is, the coordinate group associated with F can be F4. The logical order in the flowchart is D first, then F and finally E. Therefore, the element coordinate information is arranged as D3 to F4 to E4.
[0082] c3. Based on the arrangement results, determine the order of element operations corresponding to the element coordinate information.
[0083] Specifically, by arranging the element coordinate information corresponding to the interface elements included in the test interface according to the logical order of the flowchart, the arrangement result of the element coordinate information can be obtained, thereby determining the element operation order corresponding to the element coordinate information.
[0084] S250. Compile the element operation sequence according to the set script rules to generate interface test cases for the interface to be tested.
[0085] Specifically, the element operation sequence can be compiled according to the set script rules. Based on the interface number corresponding to the element operation sequence and the element coordinate information included in the element operation sequence, it can be compiled into a script file that the computer can read, that is, generate interface test cases for the interface to be tested.
[0086] This second embodiment provides a method for generating interface test cases. By using predefined parsing rules, the execution steps in a standardized requirement template are analyzed to automatically generate a flowchart corresponding to the interface to be tested. Based on the interface parameter information of the interface to be tested, the interface elements are automatically converted to coordinate form. The order of element operations is determined based on the flowchart and element coordinate information. The operation order is then compiled according to predefined script rules to automatically generate interface test cases. This eliminates the need for manual recording of the interface to be tested, improving the efficiency of interface test case generation and avoiding conflicts caused by differences in manual recording.
[0087] Example 3
[0088] Figure 3 This is a schematic diagram of the structure of an interface test case generation device provided in Embodiment 3 of the present invention. Figure 3 As shown, the device includes: a template acquisition module 31, a flowchart generation module 32, and a case generation module 33. Among them,
[0089] Template acquisition module 31 is used to acquire standardized requirement templates that are pre-written for the interface to be tested.
[0090] The flowchart generation module 32 is used to parse the standardized requirement template according to the set parsing rules and generate the flowchart corresponding to the interface to be tested.
[0091] The case generation module 33 is used to generate interface test cases for the interface to be tested based on the flowchart and a pre-determined coordinate library of interface elements of the interface to be tested.
[0092] This embodiment provides a method for generating interface test cases. It involves obtaining a pre-written standardized requirement template for the interface to be tested; parsing the standardized requirement template according to set parsing rules to generate a flowchart corresponding to the interface to be tested; and generating interface test cases for the interface to be tested based on the flowchart and a pre-determined coordinate library of interface elements. This method provides testers with a standardized requirement template, generates a flowchart of the requirements corresponding to the interface to be tested based on the standardized requirement template, automatically converts the interface elements in the interface to be tested into corresponding coordinates, and automatically generates interface test cases based on the flowchart and the coordinate library of interface elements. This eliminates the need for manual recording of the interface to be tested, improves the efficiency of interface test case generation, and avoids conflicts caused by differences in manual recording.
[0093] Optionally, the flowchart generation module 32 is specifically used for:
[0094] Based on the parsing rules, determine the execution steps included in the standardized requirement template;
[0095] Based on the execution steps, generate a flowchart corresponding to the interface to be tested.
[0096] Furthermore, the steps for determining the coordinate library of interface elements include:
[0097] Obtain the interface parameter information corresponding to the interface to be tested;
[0098] Based on the interface parameter information, the interface elements included in the interface to be tested are processed into coordinates, and the coordinate processing results are generated.
[0099] Based on the coordinate processing results, determine the coordinate library of interface elements.
[0100] Optionally, the case generation module 33 may include:
[0101] The sequence determination unit is used to determine the order of element operations corresponding to the element coordinate information included in the interface element coordinate library, based on the flowchart.
[0102] The test case generation unit is used to compile the element operation sequence according to the set script rules and generate interface test cases for the interface to be tested.
[0103] The sequence determination unit is specifically used for:
[0104] Retrieve the element coordinate information corresponding to each interface element in the interface element coordinate library;
[0105] Arrange the element coordinate information according to the logical order contained in the flowchart;
[0106] Based on the arrangement results, determine the order of element operations corresponding to the element coordinate information.
[0107] Optionally, the device may also include:
[0108] The testing module is used to test the interface to be tested based on the interface test cases.
[0109] Furthermore, the testing module is specifically used for:
[0110] The interface test cases are analyzed to determine the element coordinate information of each interface element in the interface to be tested;
[0111] Based on the element coordinate information, determine the operation position of the interface element corresponding to the element coordinate information;
[0112] Test the interface to be tested based on the location of the operation.
[0113] The interface test case generation device provided in the embodiments of the present invention can execute the interface test case generation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0114] Example 4
[0115] Figure 4 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0116] like Figure 4 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0117] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0118] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the method for generating interface test cases.
[0119] In some embodiments, the method for generating interface test cases may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method for generating interface test cases described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the method for generating interface test cases by any other suitable means (e.g., by means of firmware).
[0120] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0121] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0122] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0123] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0124] The systems and technologies described herein can be implemented in computing systems that include back-end components (e.g., as a data server), or computing systems that include first-end components (e.g., an application server), or computing systems that include front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such back-end, first-end, or front-end components. The components of the system can be interconnected via digital data communication (e.g., a communication network) of any form or medium. Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0125] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0126] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0127] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for generating interface test cases, characterized in that, include: Obtain the standardized requirement templates that have been pre-written for the interface to be tested; The standardized requirement template is parsed according to the set parsing rules to generate a flowchart corresponding to the interface to be tested. Based on the flowchart and the pre-determined coordinate library of interface elements of the interface to be tested, interface test cases for the interface to be tested are generated. The step of determining the interface element coordinate library includes: Obtain the interface parameter information corresponding to the interface to be tested; Based on the interface parameter information, the interface elements included in the interface to be tested are subjected to coordinate processing to generate coordinate processing results; Based on the coordinate processing results, the interface element coordinate library is determined; The step of generating interface test cases for the interface to be tested based on the flowchart and a pre-determined coordinate library of interface elements of the interface to be tested includes: Based on the flowchart, determine the element operation sequence corresponding to the element coordinate information included in the interface element coordinate library; The script is compiled according to the set script rules to generate interface test cases for the interface to be tested.
2. The method according to claim 1, characterized in that, The step of parsing the standardized requirement template according to the set parsing rules to generate the flowchart corresponding to the interface to be tested includes: Based on the parsing rules, determine the execution steps included in the standardized requirement template; Based on the execution steps, a flowchart corresponding to the interface to be tested is generated.
3. The method according to claim 1, characterized in that, The step of determining the element operation sequence corresponding to the element coordinate information included in the interface element coordinate library according to the flowchart includes: Obtain the element coordinate information corresponding to each interface element in the interface element coordinate library; The element coordinate information is arranged according to the logical order contained in the flowchart; Based on the arrangement result, determine the element operation order corresponding to the element coordinate information.
4. The method according to claim 1, characterized in that, After generating interface test cases for the interface to be tested based on the flowchart and a pre-determined coordinate library of interface elements of the interface to be tested, the process further includes: Based on the interface test case, test the interface to be tested corresponding to the interface test case.
5. The method according to claim 4, characterized in that, The step of testing the interface to be tested according to the interface test case includes: The interface test case is analyzed to determine the element coordinate information of each interface element in the interface to be tested; Based on the element coordinate information, determine the operation position of the interface element corresponding to the element coordinate information; The interface to be tested is tested according to the operation location.
6. A device for generating interface test cases, characterized in that, include: The template acquisition module is used to acquire standardized requirement templates that have been pre-written for the interface to be tested. The flowchart generation module is used to parse the standardized requirement template according to the set parsing rules and generate the flowchart corresponding to the interface to be tested. The test case generation module is used to generate interface test cases for the interface to be tested based on the flowchart and a pre-determined coordinate library of interface elements of the interface to be tested. The step of determining the interface element coordinate library includes: Obtain the interface parameter information corresponding to the interface to be tested; Based on the interface parameter information, the interface elements included in the interface to be tested are subjected to coordinate processing to generate coordinate processing results; Based on the coordinate processing results, the interface element coordinate library is determined; The case generation module includes: The sequence determination unit is used to determine the element operation sequence corresponding to the element coordinate information included in the interface element coordinate library according to the flowchart. The test case generation unit is used to compile the operation sequence of the elements according to the set script rules to generate interface test cases for the interface to be tested.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the interface test case generation method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method for generating interface test cases according to any one of claims 1-5.