A method and device for implementing self-repair of test scripts
By generating and comparing the text identifiers of the test script and interface parameters, self-repair of the test script is realized, solving the problem of high maintenance cost of test scripts in the existing technology, and improving testing efficiency and accuracy.
Patent Information
- Application Number
- CN201810472313.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-05-17
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2038-05-17
AI Technical Summary
The prior art cannot enable the test script to automatically correct errors and modify them as the application program interface under test, resulting in semi-automated testing process and high maintenance costs.
By calling the test script generation algorithm, the temporary test script text and the temporary tested interface are generated into the parameter nested link text, and the MD5 algorithm is used to generate text identifiers, and the text identifiers are looped to determine the official test script text, realizing the self-contained test script repair.
It realizes self-correction and self-repair of test scripts, reduces manual maintenance costs, and improves testing efficiency and accuracy.
Smart Images

Figure CN110502420B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for implementing self-repair of a test script. Background Art
[0002] With the continuous development of testing technology, the application of interface automated testing technology is becoming more and more extensive. Automated testing technology has shown absolute advantages in shortening the test cycle and improving the quality of the system under test.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] For interface automation testing, people manually develop test scripts, write test parameters, run the platform, and then view reports. If problems occur in the test script, they need to manually modify the script and re-execute it. In other words, the existing test is a semi-automated process, and most of the time in the test cycle is wasted on writing and maintaining the automation script. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and apparatus for implementing self-repair of test scripts, which can solve the problem in the prior art that the test scripts cannot automatically correct errors and automatically modify functions along with the application program interface under test.
[0006] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a method for realizing self-repair of test scripts is provided, including calling a test script generation algorithm to generate a temporary test script text and a temporary tested interface input parameter nested link text; generating a text identifier of the temporary test script text and a text identifier of the temporary tested interface input parameter nested link text; looping the above steps, and then comparing the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text used for testing.
[0007] Optionally, a test script generation algorithm is called to generate a temporary test script text and a temporary tested interface input parameter nested link text, including:
[0008] The storage interface of the predecessor binary search tree is used to import and traverse the interface under test, and a binary search tree with a predecessor node is generated;
[0009] An in-order traversal algorithm is performed on the binary search tree to generate a temporary test script text and a temporary tested interface input parameter nested link text.
[0010] Optionally, the text identifier of the current temporary tested interface input parameter nested link text is compared with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text for the test, including:
[0011] If the text identifier of the current temporary tested interface input parameter nested link text is different from the text identifier of the previously generated temporary tested interface input parameter nested link text, the current temporary test script text is used as the formal test script text for testing.
[0012] Optionally, the text identifier of the current temporary tested interface input parameter nested link text is compared with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text for the test, including:
[0013] If the text identifier of the current temporary tested interface input parameter nested link text is the same as the text identifier of the previously generated temporary tested interface input parameter nested link text, then determine whether the text identifier of the current temporary test script text is the same as the text identifier of the previously generated temporary test script text;
[0014] If they are the same, the temporary test script generated last time is used as the formal test script text for testing;
[0015] If they are not the same, the application interface call line of the current temporary test script text will replace the application interface call line of the temporary test script text generated last time, and then the temporary test script text generated last time will be used as the formal test script text for testing.
[0016] In addition, according to one aspect of an embodiment of the present invention, a device for implementing self-repair of a test script is provided, including a generation module, which is used to call a test script generation algorithm to generate a temporary test script text and a temporary tested interface input parameter nested link text; generate a text identifier of the temporary test script text and a text identifier of the temporary tested interface input parameter nested link text; and a repair module, which is used to compare the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text used for testing.
[0017] Optionally, the generation module calls a test script generation algorithm to generate a temporary test script text and a temporary tested interface input parameter nested link text, including:
[0018] The storage interface of the predecessor binary search tree is used to import and traverse the interface under test, and a binary search tree with a predecessor node is generated;
[0019] An in-order traversal algorithm is performed on the binary search tree to generate a temporary test script text and a temporary tested interface input parameter nested link text.
[0020] Optionally, the repair module compares the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text for the test, including:
[0021] If the text identifier of the current temporary tested interface input parameter nested link text is different from the text identifier of the previously generated temporary tested interface input parameter nested link text, the current temporary test script text is used as the formal test script text for testing.
[0022] Optionally, the repair module compares the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text for the test, including:
[0023] If the text identifier of the current temporary tested interface input parameter nested link text is the same as the text identifier of the previously generated temporary tested interface input parameter nested link text, then determine whether the text identifier of the current temporary test script text is the same as the text identifier of the previously generated temporary test script text;
[0024] If they are the same, the temporary test script generated last time is used as the formal test script text for testing;
[0025] If they are not the same, the application interface call line of the current temporary test script text will replace the application interface call line of the temporary test script text generated last time, and then the temporary test script text generated last time will be used as the formal test script text for testing.
[0026] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:
[0027] one or more processors;
[0028] a storage device for storing one or more programs,
[0029] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any of the above embodiments for implementing test script self-repair.
[0030] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, any of the methods described above based on implementing test script self-repair is implemented.
[0031] An embodiment of the above invention has the following advantages or beneficial effects: an interface automatic repair technology based on a script automatic generation algorithm is proposed, which can save the huge cost of the maintenance process of the test script after writing, and achieve the results of self-correction and self-operation of the test script.
[0032] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0034] Figure 1 is a schematic diagram of the main process of a method for implementing test script self-repair according to an embodiment of the present invention;
[0035] Figure 2 It is a schematic diagram of the main process of a method for implementing test script self-repair according to a reference embodiment of the present invention;
[0036] Figure 3 is a schematic diagram of main modules of an apparatus for implementing test script self-repair according to an embodiment of the present invention;
[0037] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0038] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0039] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0040] Figure 1 A method for implementing test script self-repair according to an embodiment of the present invention is as follows: Figure 1 As shown, the method for implementing test script self-repair includes:
[0041] Step S101, calling a test script generation algorithm to generate a temporary test script text and a temporary tested interface input parameter nested link text.
[0042] Among them, the temporary tested interface input parameter nested link is in the automatic generation algorithm, which will stack the parameter hierarchical call relationship of the tested interface and form a call hierarchical relationship description method in json format through stack reading.
[0043] Preferably, the storage interface of the predecessor binary search tree is used to import and traverse the tested java interface to generate a binary search tree with a predecessor node. Then, the binary search tree is traversed in order to generate a temporary test script text and a temporary tested interface input parameter nested link text.
[0044] Among them, the binary search tree is also called a binary search tree. It is either an empty tree or a binary tree with the following properties: if its left subtree is not empty, then the values of all nodes on the left subtree are less than the value of its root node; if its right subtree is not empty, then the values of all nodes on the right subtree are greater than the value of its root node; its left and right subtrees are also binary sorted trees. The predecessor is that each node has a pointer to its parent node.
[0045] That is to say, the predecessor binary search tree node of the present invention is a basic type node specially designed for analyzing the interface and the called object relationship, which includes a variable name, a variable type, a left child pointer, a right child pointer and a parent pointer.
[0046] The in-order traversal algorithm traverses the left subtree first, then traverses the root node, and finally traverses the right subtree.
[0047] Furthermore, the test script text is saved in java format, while the tested interface input parameter nested link text is saved in json format.
[0048] It is also worth noting that the nested link text of the input parameter of the tested interface described in the above process is the nested relationship of the input parameter of the tested interface, with the Java basic type as the end point.
[0049] Step S102, generating a text identifier of a temporary test script text and a text identifier of a temporary tested interface input parameter nested link text.
[0050] Preferably, the MD5 algorithm is used to generate the text identifier of the temporary test script text and the text identifier of the temporary tested interface input parameter nested link text respectively.
[0051] MD5 is the abbreviation of Message-digest Algorithm 5. The MD5 algorithm processes the input information in 512-bit groups after initialization. Each group is divided into 16 to 32-bit sub-groups. After a series of transformations, four 32-bit groups are output. These 32-bit groups are cascaded to generate a 128-bit hash value. The hash value obtained by the MD5 algorithm is used as the text identifier of the temporary test script text and the temporary tested interface input parameter nested link text.
[0052] Of course, other algorithms can also be used to generate the text identifier of the temporary test script text and the text identifier of the temporary tested interface input parameter nested link text respectively, such as Base64, DES, RSA, MD2, MD4, SHA-1, SHA-2, SHA-3, ECDSA, FULL SHA-2, ECC-FULL and other algorithms.
[0053] Furthermore, the specific implementation process includes: reading the contents of the temporary test script text and the temporary tested interface input parameter nested link text in binary mode, and then generating (for example, using MD5 operation) and saving the hash value of the temporary test script text and the temporary tested interface input parameter nested link text, which is the text identifier of the corresponding text content, set to Tn (java) and Tn (json) respectively, where n is the number of times step S101 and step S102 are repeated.
[0054] Furthermore, the text identifiers of the temporary test script text and the temporary tested interface input parameter nested link text are a string of codes obtained by running the MD5 algorithm after reading their text contents into the memory in binary format.
[0055] Step S103, compare the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the temporary tested interface input parameter nested link text obtained by the previous execution of steps S101 and S102 to determine the formal test script text used for the test.
[0056] Preferably, when comparing the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the temporary tested interface input parameter nested link text obtained by the previous execution of step S101 and step S102, if there is a difference, it means that the temporary tested interface input parameter nested link text has changed, and then the current temporary test script text is used for testing, that is, the current temporary test script is used as the formal test script.
[0057] As another embodiment, if there is no difference between the text identifier of the current temporary interface under test input parameter nested link text and the text identifier of the temporary interface under test input parameter nested link text obtained by the previous execution of step S101 and step S102, the text identifier of the current temporary test script text can also be compared with the text identifier of the temporary test script text obtained by the previous execution of step S101 and step S102. According to the comparison result, if there is a difference, it means that the name of the tested interface API (application programming interface, which is the agreement for connecting different components of the software system) has been found to have changed, and the API call line of the current temporary test script text is replaced with the API call line of the previous temporary test script text, and then the previous temporary test script text is used for testing, and the current temporary test script text is discarded. If there is no difference, the previous temporary test script text is used for testing.
[0058] It should be noted that if a syntax error occurs during the test execution, the script maintainer can be notified to intervene and manually fix the error.
[0059] In summary, the present invention generates a temporary test script text and a temporary tested interface input parameter nested link text by applying the same algorithm to the tested interface, and then generates a unique text content identifier. Compare the two generated temporary identifiers. If there is a difference, call the corresponding repair strategy to complete the script repair, and implement self-correction and self-repair before each run of the test script. In other words, the present invention will perform a test on the mutability of the tested interface before each run, and can automatically repair the test script to the greatest extent possible, ensuring that each test run can obtain correct test results. At the same time, a large amount of labor costs required for script maintenance are released, that is, the present invention can save a lot of labor costs required for historical script maintenance.
[0060] Figure 2 1 is a schematic diagram of the main process of a method for implementing test script self-repair according to a reference embodiment of the present invention. The method for implementing test script self-repair may include:
[0061] Step S201, using the storage interface of the predecessor binary search tree to import and traverse the interface under test, and generating a binary search tree with a predecessor node.
[0062] Step S202, performing an in-order traversal algorithm on the binary search tree to generate a temporary test script text and a temporary tested interface input parameter nested link text.
[0063] Step S203, using the MD5 algorithm to generate text identifiers of the temporary test script text and the temporary tested interface input parameter nested link text respectively.
[0064] Step S204, determine whether the text identifier of the current temporary tested interface input parameter nested link text is the same as the text identifier of the temporary tested interface input parameter nested link text generated last time, if they are the same, proceed to step S206, otherwise proceed to step S205.
[0065] Step S205, use the current temporary test script text to perform testing and exit the process.
[0066] Step S206, determine whether the text identifier of the current temporary test script text is the same as the text identifier of the temporary test script text generated last time, if the same, proceed to step S207, otherwise proceed to step S208.
[0067] Step S207, use the temporary test script text generated last time to perform testing and exit the process.
[0068] Step S208, replace the application interface call line of the previously generated temporary test script text with the application interface call line of the current temporary test script text, then use the previously generated temporary test script text for testing, discard the current temporary test script text, and exit the process.
[0069] As a specific implementation process of a reference embodiment, an interface test script text A1.java and an interface input parameter nested link text A1.json are generated by a test script generation algorithm for the tested interface A. Then, text identifiers of the above two files are generated for A1.java and A1.json, which are set as T1 (A.java) and T1 (A.json) respectively.
[0070] Before the test script executes the test, the test script text A2.java and the interface input parameter nested link text A2.json are generated again for the tested interface A. Then, the MD5 algorithm is applied to generate text identifiers for A2.java and A2.json, which are set to T2 (A2.java) and T (A2.json) respectively. Then the self-correction repair strategy algorithm is entered:
[0071] If T2(A2.json) is not equal to T1(A1.json), then replace A1.java with A2.java and execute the test.
[0072] If T2 (A2.json) is equal to T1 (A1.json), compare T2 (A2.java) and T1 (A1.java). If T2 (A2.java) is not equal to T1 (A1.java), replace the API call line of A1.java with the API call line of A2.java, and then use A1.java for testing and discard A2.java.
[0073] If T2(A2.json) is equal to T1(A1.json) and T2(A2.java) is equal to T1(A1.java), then discard A2.java and A2.json and execute A1.java for testing.
[0074] Figure 3 A device for implementing self-repair of test scripts according to an embodiment of the present invention is provided. Figure 3 As shown, the device for implementing test script self-repair includes a generation module 301 and a repair module 302. The generation module 301 calls the test script generation algorithm to generate a temporary test script text and a temporary tested interface input parameter nested link text, and generates a text identifier of the temporary test script text and a text identifier of the temporary tested interface input parameter nested link text. The repair module 302 compares the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text used for testing.
[0075] Preferably, the generation module 301 uses the storage interface of the predecessor binary search tree to import and traverse the tested java interface to generate a binary search tree with a predecessor node. Then, the binary search tree is traversed in order to generate a temporary test script text and a temporary tested interface input parameter nested link text.
[0076] As a preferred embodiment, the repair module 302 compares the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text for testing:
[0077] If the text identifier of the current temporary tested interface input parameter nested link text is different from the text identifier of the previously generated temporary tested interface input parameter nested link text, the current temporary test script text is used as the formal test script text for testing.
[0078] As another preferred embodiment, if the text identifier of the current temporary tested interface input parameter nested link text is the same as the text identifier of the previously generated temporary tested interface input parameter nested link text, then it can be determined whether the text identifier of the current temporary test script text is the same as the text identifier of the previously generated temporary test script text. If they are the same, the previously generated temporary test script is used as the formal test script text for testing. Otherwise, the application interface call line of the previously generated temporary test script text is replaced by the application interface call line of the current temporary test script text, and then the previously generated temporary test script text is used as the formal test script text for testing.
[0079] It should be noted that the specific implementation content of the device for implementing test script self-repair in the present invention has been described in detail in the method for implementing test script self-repair described above, so the repeated content will not be described here.
[0080] Figure 4 An exemplary system architecture 400 to which the method for implementing test script self-repair or the apparatus for implementing test script self-repair according to an embodiment of the present invention can be applied is shown. Figure 4 An exemplary system architecture 400 is shown to which a method for implementing test script self-repair or an apparatus for implementing test script self-repair according to an embodiment of the present invention can be applied.
[0081] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0082] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0083] The terminal devices 401 , 402 , and 403 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0084] The server 405 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.
[0085] It should be noted that the method for implementing test script self-repair provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the device for implementing test script self-repair is generally arranged in the server 405 .
[0086] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0087] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0088] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0089] The following components are connected to the I / O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.
[0090] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.
[0091] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0092] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0093] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a generation module and a repair module. The names of these modules do not constitute limitations on the modules themselves in some cases.
[0094] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: calling a test script generation algorithm to generate a temporary test script text and a temporary tested interface input parameter nested link text; generating text identifiers of the temporary test script text and the temporary tested interface input parameter nested link text; looping the above steps, and then comparing the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text used for testing.
[0095] The technical solution according to the embodiment of the present invention can solve the problem that the prior art cannot enable the test script to automatically correct errors and automatically modify functions along with the editing interface of the tested application.
[0096] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for implementing test script self-repair, characterized in that: include: The test script generation algorithm is called to generate a temporary test script text and a temporary tested interface input parameter nested link text; wherein, the temporary tested interface input parameter nested link is in the automatic generation algorithm, the parameter level call relationship of the tested interface is stacked and stored, and the calling level relationship description method in json format is formed by stack reading; Generate a text identifier of a temporary test script text and a text identifier of a temporary tested interface input parameter nested link text; Loop the above steps, and then compare the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text used for testing, including: if the text identifier of the current temporary tested interface input parameter nested link text is the same as the text identifier of the previously generated temporary tested interface input parameter nested link text, then determine whether the text identifier of the current temporary test script text is the same as the text identifier of the previously generated temporary test script text; if they are not the same, then replace the application interface call line of the previously generated temporary test script text with the application interface call line of the previously generated temporary test script text, and then use the previously generated temporary test script text as the formal test script text for testing.
2. The method according to claim 1, characterized in that Call the test script generation algorithm to generate temporary test script text and temporary tested interface input parameter nested link text, including: The storage interface of the predecessor binary search tree is used to import and traverse the interface under test, and a binary search tree with a predecessor node is generated; An in-order traversal algorithm is performed on the binary search tree to generate a temporary test script text and a temporary tested interface input parameter nested link text.
3. The method according to claim 1, characterized in that: Compare the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text used for the test, including: If the text identifier of the current temporary tested interface input parameter nested link text is different from the text identifier of the previously generated temporary tested interface input parameter nested link text, the current temporary test script text is used as the formal test script text for testing.
4. The method according to any one of claims 1 to 3, characterized in that: After determining whether the text identifier of the current temporary test script text is the same as the text identifier of the temporary test script text generated last time, the method further includes: if they are the same, using the temporary test script generated last time as the formal test script text for testing.
5. A device for implementing self-repair of test scripts, characterized in that: include: A generation module is used to call a test script generation algorithm to generate a temporary test script text and a temporary tested interface input parameter nested link text; generate a text identifier of the temporary test script text and a text identifier of the temporary tested interface input parameter nested link text; wherein, the temporary tested interface input parameter nested link is in the automatic generation algorithm, and the parameter hierarchical call relationship of the tested interface is stacked and stored, and a call hierarchical relationship description method in json format is formed by stack reading; A repair module is used to compare the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text used for testing, including: if the text identifier of the current temporary tested interface input parameter nested link text is the same as the text identifier of the previously generated temporary tested interface input parameter nested link text, then determine whether the text identifier of the current temporary test script text is the same as the text identifier of the previously generated temporary test script text; if they are not the same, then replace the application interface call line of the previously generated temporary test script text with the application interface call line of the previously generated temporary test script text, and then use the previously generated temporary test script text as the formal test script text for testing.
6. The device according to claim 5, characterized in that The generation module calls the test script generation algorithm to generate a temporary test script text and a temporary tested interface input parameter nested link text, including: The storage interface of the predecessor binary search tree is used to import and traverse the interface under test, and a binary search tree with a predecessor node is generated; An in-order traversal algorithm is performed on the binary search tree to generate a temporary test script text and a temporary tested interface input parameter nested link text.
7. The device according to claim 5, characterized in that The repair module compares the text identifier of the current temporary tested interface input parameter nested link text with the text identifier of the previously generated temporary tested interface input parameter nested link text to determine the formal test script text for testing, including: If the text identifier of the current temporary tested interface input parameter nested link text is different from the text identifier of the previously generated temporary tested interface input parameter nested link text, the current temporary test script text is used as the formal test script text for testing.
8. The device according to any one of claims 5 to 7, characterized in that: After determining whether the text identifier of the current temporary test script text is the same as the text identifier of the temporary test script text generated last time, the repair module includes: If they are the same, the temporary test script generated last time will be used as the formal test script text for testing.
9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Method for generating performance test scripts based on server interfaces
CN102368227A
Performance test system of GIS (Geographic Information System) platform
CN102508763A