Test script generation method and device, server and computer storage medium

By generating unique key-value pairs for automated test scripts, the problem of rewriting test scripts due to changes in object details is solved, thus achieving reusability and efficient maintenance of test scripts.

CN115470094BActive Publication Date: 2025-12-16JINGDONG TECH HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110648756.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-10
Publication Date
2025-12-16
Estimated Expiration
2041-06-10

AI Technical Summary

Technical Problem

Existing automated test scripts need to be rewritten when product object details change, leading to maintenance difficulties.

Method used

Generate test records and assign unique keys to each object detail. Generate test scripts based on operation information and unique keys. Supports editing and adding when object details change.

Benefits of technology

This achieves test script reusability, reduces the need for rewriting when object details change, and improves maintenance efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115470094B_ABST
    Figure CN115470094B_ABST
Patent Text Reader

Abstract

The application provides a test script generation method and device, a server and a computer storage medium. The method comprises the following steps: generating a test record of the current test during the process in which a user tests a target product according to a test plan; the test record comprises operation information of the user operating at least one first object detail of the target product; then, a unique key value of each first object detail is generated; finally, a test script of the test plan is generated according to the operation information of the user operating each first object detail and the unique key value of each first object detail. Therefore, when the object details of the target product change and the test script needs to be edited, the unique key value of the object details can be used to determine the object details that need to be adjusted in the test script and to edit the object details, so that the test script does not need to be rewritten, and the reusability of the test script is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a test script generation method and device, a server and a computer storage medium. BACKGROUND

[0002] With the rapid development of the Internet, mobile phones, computers and other terminal devices have become necessities of people's daily work and life. Many companies develop a large number of application products to meet the needs of everyone, so more and more testers are involved in product testing. With the increasing popularity of automated testing, various industries have begun to use automated testing to improve testing efficiency.

[0003] Currently, the test scripts used in automated testing are usually written in two ways: recording and replaying and manually writing code. However, whether the test script is written by recording and replaying or manually writing code, when the object details in the product change, the test script needs to be rewritten, which makes it difficult to maintain the test script. SUMMARY

[0004] Therefore, the present application provides a test script generation method, device, server and computer storage medium, which makes the generated test script more reusable and easier to maintain.

[0005] The first aspect of the present application provides a test script generation method, comprising:

[0006] In the process of testing the target product according to the test plan, a test record of this test is generated; wherein the test record includes operation information of at least one first object detail of the target product operated by the user; the first object detail is a page or page element selected by the user during testing;

[0007] For each first object detail, a unique key value of the first object detail is generated;

[0008] According to the operation information of each first object detail operated by the user and the unique key value of each first object detail, a test script of the test plan is generated.

[0009] Optionally, the unique key value of each first object detail is generated, comprising:

[0010] The key value of the parent page to which the first object detail belongs, the element identifier of the first object detail, the text content of the first object detail, and the index value of the first object detail on the parent page are combined to obtain a unique key value of the first object detail.

[0011] Optionally, before the step of generating the test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail, the method further comprises:

[0012] obtaining a unique key value set of the target product; wherein the unique key value set of the target product comprises a unique key value of each second object detail in the target product; the second object detail is an object detail registered successfully when the object detail is registered for the target product;

[0013] matching the unique key value of each first object detail with the unique key value of the corresponding second object detail in the unique key value set of the target product;

[0014] If all the first object details are matched successfully in the unique key value set of the target product, the step of generating the test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail is executed.

[0015] Optionally, after the step of generating the test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail, the method further comprises:

[0016] receiving an editing instruction of the user;

[0017] responding to the editing instruction, performing corresponding operation on the test script of the test plan.

[0018] Optionally, the step of generating the test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail comprises:

[0019] processing the test record in a manner of replacing the first object detail in the operation information of the user operating each first object detail with the unique key value of the first object detail to obtain the test script of the test plan.

[0020] The second aspect of the application provides a test script generation device, comprising:

[0021] The test record generation unit is configured to generate a test record of the current test during the process in which the user tests the target product according to the test plan, wherein the test record comprises operation information of the user operating at least one first object detail of the target product; and the first object detail is a page or a page element selected by the user during the test process.

[0022] The unique key value generation unit is configured to generate a unique key value of each first object detail.

[0023] The test script generation unit is configured to generate a test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail.

[0024] Optionally, the unique key value generation unit comprises:

[0025] The unique key value generation subunit is configured to combine a key value of a parent page to which the first object detail belongs, an element identifier of the first object detail, text content of the first object detail, and an index value of the first object detail on the parent page to obtain the unique key value of the first object detail.

[0026] Optionally, the test script generation apparatus further comprises:

[0027] The acquisition unit is configured to acquire a unique key value set of the target product, wherein the unique key value set of the target product comprises a unique key value of each second object detail in the target product; and the second object detail is an object detail that is successfully registered when the target product registers object details.

[0028] The matching unit is configured to match the unique key value of each first object detail with a unique key value of a corresponding second object detail in the unique key value set of the target product.

[0029] The test script generation unit is configured to:

[0030] If all the first object details are successfully matched in the unique key value set of the target product, the test script generation unit generates the test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail.

[0031] Optionally, the test script generation apparatus further comprises:

[0032] The receiving unit is configured to receive an editing instruction of the user.

[0033] The response unit is used to respond to the editing instructions and perform corresponding operations on the test script of the test plan.

[0034] Optionally, the test script generation unit includes:

[0035] The test script generation subunit is used to process the test record by replacing the first object detail in the operation information of the user's operation on each first object detail with the unique key value of the first object detail, so as to obtain the test script of the test plan.

[0036] A third aspect of this application provides a server, comprising:

[0037] One or more processors;

[0038] A storage device on which one or more programs are stored;

[0039] When the one or more programs are executed by the one or more processors, the one or more processors implement the test script generation method as described in any one of the first aspects.

[0040] The fourth aspect of this application provides a computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the test script generation method as described in any one of the first aspects.

[0041] From the above scheme, the test script generation method, device, server and computer storage medium provided by the application can be known, the test script generation method comprises: generating a test record of this test in the process that a user tests a target product according to a test plan; wherein the test record comprises operation information of the user operating at least one first object detail of the target product; the first object detail is a page or a page element selected by the user in the testing process; then, for each first object detail, a unique key value of the first object detail is generated; finally, according to the operation information of the user operating each first object detail and the unique key value of each first object detail, a test script of the test plan is generated. Since the test script finally generated in the application is obtained according to the operation information of the user operating each first object detail and the unique key value of each first object detail, when the object details of the target product change and the test script needs to be edited, the unique key value of the object details can be used to determine the object details that need to be adjusted in the test script and edit them, and if new object details are added to the target product, the operation information of the new object details can also be added in the test script according to the unique key value of the new object details, without the need to rewrite the test script, thereby realizing the reusability of the test script. BRIEF DESCRIPTION OF DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of the provided drawings.

[0043] Figure 1 A specific flowchart of a test script generation method provided by an embodiment of the present application is provided.

[0044] Figure 2 A specific flowchart of a test script generation method provided by another embodiment of the present application is provided.

[0045] Figure 3 A schematic diagram of a test script generation device provided by another embodiment of the present application is provided.

[0046] Figure 4 A schematic diagram of a test script generation device provided by another embodiment of the present application is provided.

[0047] Figure 5 A schematic diagram of a server for implementing a test script generation method provided by another embodiment of the present application is provided. DETAILED DESCRIPTION

[0048] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative effort belong to the scope of protection of the present application.

[0049] It should be noted that the terms "first", "second", and the like mentioned in the present application are only used to distinguish different devices, modules or units, and are not intended to limit the order or interdependence of the functions performed by these devices, modules or units, and the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the processes, methods, articles or devices including a series of elements not only include those elements, but also include other elements not explicitly listed or inherent to such processes, methods, articles or devices. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.

[0050] The embodiment of the present application provides a test script generation method, as shown in Figure 1 The embodiment of the present application provides a test script generation method, as shown in

[0051] S101, in the process that a user tests a target product according to a test plan, a test record of this test is generated.

[0052] The test plan can be, but is not limited to, a text information for testing the target product, and the user can test the target product according to the test plan on a mobile phone or a cloud real machine. The target product can also be understood as a product to be tested. The test record includes operation information of at least one first object detail of the target product operated by the user. The first object detail is a page or a page element selected by the user in the testing process. The operation information can include, but is not limited to, operation sequence, stay time, operation type and the like, which are not limited here. The page element can be, but is not limited to, a picture, a text, a button, a text box and the like, which are also not limited here.

[0053] The generated test record will be illustrated as follows: the user tests the target product according to the test plan on the mobile phone or the cloud real machine, first clicks the button A in the testing process, then cuts the picture B, and finally stays in the page X for 10 seconds.

[0054] S102, for each first object detail, a unique key value of the first object detail is generated.

[0055] Optionally, in another embodiment of the present application, one implementation of step S102 specifically comprises:

[0056] For each first object detail, the key value of the parent page to which the first object detail belongs, the element identifier of the first object detail, the text content of the first object detail, and the index value of the first object detail on the parent page are combined to obtain a unique key value of the first object detail.

[0057] The key value of the parent page to which the first object detail belongs, the element identifier of the first object detail, the text content of the first object detail, and the index value of the first object detail on the parent page are all known data, and the index value starts from 1 and increases by a step, for example, the index value of the first page element in page A is 1, the index value of the second page element in page B is 2, and so on. That is, if two different page elements are in the same page, even if they have the same element identifier and text content, as long as the index values of the two page elements are different, the two page elements will be recorded as different page elements. That is, the generation rule of the unique key value of the present application can uniquely number all object details.

[0058] It should be noted that the way of combining the key value of the parent page to which the first object detail belongs, the element identifier of the first object detail, the text content of the first object detail, and the index value of the first object detail on the parent page is very diverse. It can be that the key value of the parent page to which the first object detail belongs, the element identifier of the first object detail, the text content of the first object detail, and the index value of the first object detail on the parent page are combined in turn; or the element identifier of the first object detail, the key value of the parent page to which the first object detail belongs, the text content of the first object detail, and the index value of the first object detail on the parent page are combined in turn, which is not limited here.

[0059] S103, generating a test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail.

[0060] It should be noted that the way of generating a test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail can be, but is not limited to, replacing the first object detail in the operation information of the user operating each first object detail with the unique key value of the first object detail to process the test record to obtain the test script of the test plan.

[0061] For example, the test record is that the button A is clicked first, then the picture B is cut, and finally the page X is stayed for 10 seconds. The button A corresponds to the unique key value h, the picture B corresponds to the unique key value m, and the page X corresponds to the unique key value n. The generated test script can perform the corresponding operations, that is, click the position corresponding to the unique key value h, cut the picture corresponding to the unique key value m, and finally stay in the position corresponding to the unique key value n for 10 seconds.

[0062] From the above scheme, it can be seen that the test script generation method provided by the application is: in the process that a user tests a target product according to a test plan, a test record of this test is generated; wherein the test record includes operation information of the user operating at least one first object detail of the target product; the first object detail is a page or a page element selected by the user in the testing process; then, for each first object detail, a unique key value of the first object detail is generated; finally, according to the operation information of the user operating each first object detail and the unique key value of each first object detail, a test script of the test plan is generated. Since the test script finally generated in the application is obtained according to the operation information of the user operating each first object detail and the unique key value of each first object detail, when the object details of the target product change and the test script needs to be edited, the unique key value of the object detail can be used to determine the object detail that needs to be adjusted in the test script and to edit it, and if a new object detail is added to the target product, the operation information of the new object detail can also be added in the test script according to the unique key value of the new object detail, without the need to rewrite the test script, thereby realizing the reusability of the test script.

[0063] Optionally, in another embodiment of the application, the step S103 further includes:

[0064] After receiving the editing instruction of the user, the test script of the test plan is operated according to the editing instruction.

[0065] The editing instruction can be, but is not limited to, adding an assertion, modifying a waiting time, capturing an abnormal pop-up window, eliminating, etc., which is not limited here.

[0066] It should be noted that as the target product changes, if the object details change, the user can modify the test script on the mobile phone or the cloud real machine. The modification can be, but is not limited to, specifying the association relationship between the new and old object details by user intervention or performing fuzzy matching in an automatic manner to complete the docking of the new and old object details, without discarding the original test script, thereby greatly improving the reusability of the test script.

[0067] With the upgrading of the target product, if the operation information in the test script needs to be upgraded, a new operation information node can be inserted between the original operation information nodes of the test script, or the original operation information node can be edited, including but not limited to the introduction of new assertions, new operation information, new object details, etc., without the need to discard the original test script.

[0068] It can be seen that, compared with the prior art, when the object details of the target product change and the test script needs to be edited, a new test script needs to be generated, and the test script generated by the present application can be directly reused, and the original test script can be directly edited according to the changes in the object details of the target product.

[0069] Optionally, in another embodiment of the present application, an embodiment of the test script generation method includes the following steps, as shown in Figure 2

[0070] S201, during the testing of the target product by the user according to the test plan, generating a test record of this test.

[0071] The test record includes operation information of the user operating at least one first object detail of the target product; the first object detail is a page or a page element selected by the user during the testing.

[0072] S202, for each first object detail, generating a unique key value of the first object detail.

[0073] It should be noted that the specific implementation process of steps S201 and S202 can be referred to the specific implementation process of steps S101 and S102 respectively, which will not be repeated here.

[0074] S203, obtaining a unique key value set of the target product.

[0075] The unique key value set of the target product includes a unique key value of each second object detail in the target product; the second object detail is an object detail that is successfully registered when the target product performs object detail registration.

[0076] That is, the target product will perform object detail registration in advance, and each object detail in the target product will be registered when the target product performs object detail registration for the first time, and a unique key value will be generated for each successfully registered object detail. The method of generating a unique key value can refer to the method of generating a unique key value in the above embodiment, which will not be repeated here.

[0077] ​It can be understood that, in the subsequent registration of the object details of the product same as the target product, i.e. the product same as the target product but different version, only the added or changed object details need to be registered.

[0078] It should be noted that the registration of the object details can be manual registration or automatic registration, which is not limited here.

[0079] S204, for each first object detail, matching the unique key value of the first object detail with the unique key value corresponding to the second object detail in the unique key value set of the target product.

[0080] S205, judging whether all the first object details are successfully matched in the unique key value set of the target product.

[0081] Specifically, if it is judged that all the first object details are successfully matched in the unique key value set of the target product, step S206 is executed.

[0082] S206, generating the test script of the test plan according to the operation information of the user's operation on each first object detail and the unique key value of each first object detail.

[0083] It should be noted that the specific implementation process of step S206 can refer to the specific implementation process of step S103 described above, which will not be repeated here.

[0084] From the above scheme, the application provides a test script generation method: in the process of testing the target product according to the test plan by the user, the test record of this test is generated; wherein the test record includes the operation information of the user operating at least one first object detail of the target product; the first object detail is the page or page element selected by the user in the testing process; then, for each first object detail, the unique key value of the first object detail is generated; the unique key value set of the target product is obtained. The unique key value set of the target product includes the unique key value of each second object detail in the target product; the second object detail is the object detail successfully registered when the target product is registered. For each first object detail, the unique key value of the first object detail is matched with the unique key value of the second object detail in the unique key value set of the target product. If all the first object details are successfully matched in the unique key value set of the target product, it is indicated that the object details in the test record of this test of the target product and the object details in the object detail registration process of the target product are the same object details, so that after the test script of the test plan is generated according to the operation information of the user operating each first object detail and the unique key value of each first object detail, the current generated test script of the test plan and the version of the previously generated test script of the test plan can be controlled.

[0085] Another embodiment of the application provides a test script generation device, as shown in Figure 3 , specifically comprising:

[0086] The test record generation unit 301 is configured to generate a test record of this test in the process of testing the target product according to the test plan by the user.

[0087] The test record includes the operation information of the user operating at least one first object detail of the target product; the first object detail is the page or page element selected by the user in the testing process.

[0088] The unique key value generation unit 302 is configured to generate a unique key value of each first object detail.

[0089] Optionally, in another embodiment of the application, an embodiment of the unique key value generation unit 302 comprises:

[0090] The unique key value generation sub-unit is configured to combine the key value of the parent page to which the first object detail belongs, the element identifier of the first object detail, the text content of the first object detail, and the index value of the first object detail on the parent page to obtain the unique key value of the first object detail.

[0091] The specific working process of the units disclosed in the above embodiments of the application can be found in the corresponding method embodiment contents, which will not be repeated here.

[0092] The test script generation unit 303 is configured to generate a test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail.

[0093] The specific working process of the units disclosed in the above embodiments of the application can be found in the corresponding method embodiment contents, as shown in Figure 1 The specific working process of the units disclosed in the above embodiments of the application can be found in the corresponding method embodiment contents, which will not be repeated here.

[0094] Optionally, in another embodiment of the application, an embodiment of the test script generation device further includes:

[0095] The receiving unit is configured to receive the editing instruction of the user.

[0096] The response unit is configured to respond to the editing instruction and perform corresponding operations on the test script of the test plan.

[0097] The specific working process of the units disclosed in the above embodiments of the application can be found in the corresponding method embodiment contents, which will not be repeated here.

[0098] Optionally, in another embodiment of the application, an embodiment of the test script generation unit 303 includes:

[0099] The test record is processed in a manner of replacing the first object detail in the operation information of the user operating each first object detail with the unique key value of the first object detail, to obtain the test script of the test plan.

[0100] The specific working process of the units disclosed in the above embodiments of the application can be found in the corresponding method embodiment contents, which will not be repeated here.

[0101] From the above scheme, the application provides a test script generation device: the test record generation unit 301 generates the test record of this test in the process that the user tests the target product according to the test plan; wherein the test record includes the operation information of the user operating at least one first object detail of the target product; the first object detail is the page or page element selected by the user in the testing process; then, the unique key value generation unit 302 generates the unique key value of each first object detail; finally, the test script generation unit 303 generates the test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail. Since the test script finally generated in the application is obtained according to the operation information of the user operating each first object detail and the unique key value of each first object detail, when the object detail of the target product changes and the test script needs to be edited, the unique key value of the object detail can be used to determine the object detail that needs to be adjusted in the test script and edit it, and if a new object detail is added to the target product, the operation information of the new object detail can also be added in the test script according to the unique key value of the new object detail, without the need to rewrite the test script, realizing the reusability of the test script.

[0102] Another embodiment of the application provides a test script generation device, as shown in Figure 4 , specifically comprising:

[0103] The test record generation unit 401 is configured to generate the test record of this test in the process that the user tests the target product according to the test plan.

[0104] The test record includes the operation information of the user operating at least one first object detail of the target product; the first object detail is the page or page element selected by the user in the testing process.

[0105] The unique key value generation unit 402 is configured to generate the unique key value of each first object detail.

[0106] The acquisition unit 403 is configured to acquire the unique key value set of the target product.

[0107] The unique key value set of the target product includes the unique key value of each second object detail in the target product; the second object detail is the object detail that is successfully registered when the target product performs object detail registration.

[0108] The matching unit 404 is configured to match the unique key value of each first object detail with the unique key value of the corresponding second object detail in the unique key value set of the target product.

[0109] The test script generation unit 405 is configured to generate a test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail, if all the first object details are successfully matched in the unique key value set of the target product.

[0110] The specific working process of the units disclosed in the above embodiments of the application can be referred to the corresponding method embodiment contents, such as Figure 2 shown, which will not be described here.

[0111] As can be known from the above solutions, the application provides a test script generation device: the test record generation unit 401 generates a test record of this test in the process of the user testing the target product according to the test plan; wherein the test record includes operation information of the user operating at least one first object detail of the target product; the first object detail is a page or a page element selected by the user in the testing process; then, the unique key value generation unit 402 generates a unique key value of each first object detail; the acquisition unit 403 acquires a unique key value set of the target product. The unique key value set of the target product includes a unique key value of each second object detail in the target product; the second object detail is an object detail successfully registered when the target product performs object detail registration. The matching unit 404 matches the unique key value of each first object detail with the unique key value of the second object detail in the unique key value set of the target product. If all the first object details are successfully matched in the unique key value set of the target product, it means that the object details in the test record of this test of the target product and the object details in the object detail registration process of the target product are the same object details, so that after the test script generation unit 405 generates a test script of the test plan according to the operation information of the user operating each first object detail and the unique key value of each first object detail, the current generated test script of the test plan and the version of the previously generated test script of the test plan can be controlled.

[0112] Another embodiment of the application provides a server, as shown in Figure 5 , comprising:

[0113] One or more processors 501.

[0114] A storage device 502 having one or more programs stored thereon.

[0115] When the one or more programs are executed by the one or more processors 501, the one or more processors 501 implement the test script generation method as described in any one of the above embodiments.

[0116] Another embodiment of the present application provides a computer storage medium, having stored thereon a computer program, wherein the computer program is executed by a processor to implement the method for generating a test script according to any one of the above embodiments.

[0117] In the above embodiments disclosed in the present application, it should be understood that the disclosed apparatus and method can also be implemented by other manners. The apparatus and method embodiments described above are only illustrative. For example, the flowcharts and block diagrams in the drawings show the possible implementation architecture, function and operation of the apparatus, method and computer program product according to the embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment or a part of code, which includes one or more executable instructions for implementing the specified logic function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order from that shown in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and the combination of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0118] In addition, the functional modules in the various embodiments of the present disclosure can be integrated together to form a separate part, or each module can exist independently, or two or more modules can be integrated to form a separate part. When the functions are realized in the form of software functional modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present disclosure. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.

[0119] Those skilled in the art could make or employ the present application without undue experimentation having regard to the detailed description herein. Various modifications can be made to the embodiments described herein, and the generic principles illustrated herein can be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating test scripts, characterized in that, include: During the process of a user testing a target product according to a test plan, a test record for this test is generated; wherein, the test record includes operation information of the user operating on at least one first object detail of the target product; the first object detail is a page or page element selected by the user during the test; For each detail of the first object, the key value of the parent page to which the first object detail belongs, the element identifier of the first object detail, the text content of the first object detail, and the index value of the first object detail on the parent page are combined to obtain the unique key value of the first object detail. The test record is processed by replacing the first object detail in the operation information of each first object detail operated by the user with the unique key value of the first object detail, so as to obtain the test script of the test plan; Receive editing instructions from the user; In response to the editing command, perform corresponding operations on the test script of the test plan.

2. The generation method according to claim 1, characterized in that, Before generating the test script for the test plan based on the user's operation information for each detail of the first object and the unique key value of each detail of the first object, the method further includes: Obtain the unique key-value set of the target product; wherein, the unique key-value set of the target product includes the unique key-value of each second object detail in the target product; the second object detail is the object detail that was successfully registered when the target product performed object detail registration; For each detail of the first object, the unique key value of the first object detail is matched with the unique key value of the corresponding second object detail in the unique key value set of the target product; If all the details of the first object are successfully matched in the unique key-value set of the target product, then the test script step of generating the test plan based on the operation information of the user on each detail of the first object and the unique key-value of each detail of the first object is executed.

3. A test script generation apparatus, characterized in that, include: The test record generation unit is used to generate a test record for the current test during the process of a user testing a target product according to a test plan; wherein, the test record includes operation information of the user operating on at least one first object detail of the target product; the first object detail is a page or page element selected by the user during the test; The unique key value generation subunit is used to combine the key value of the parent page to which the first object detail belongs, the element identifier of the first object detail, the text content of the first object detail, and the index value of the first object detail on the parent page for each first object detail to obtain the unique key value of the first object detail. The test script generation unit is used to process the test record by replacing the first object details in the operation information of the user's operation on each first object detail with the unique key value of the first object detail, so as to obtain the test script of the test plan; The receiving unit is used to receive the user's editing instructions; The response unit is used to respond to the editing instructions and perform corresponding operations on the test script of the test plan.

4. The generating apparatus according to claim 3, characterized in that, Also includes: The acquisition unit is used to acquire the unique key-value set of the target product; wherein, the unique key-value set of the target product includes the unique key-value of each second object detail in the target product; the second object detail is the object detail that was successfully registered when the target product performed object detail registration; The matching unit is used to match the unique key value of each first object detail with the unique key value of the corresponding second object detail in the unique key value set of the target product; The test script generation unit is used for: If all the details of the first object are successfully matched in the unique key-value set of the target product, then the test script step of generating the test plan based on the operation information of the user on each detail of the first object and the unique key-value of each detail of the first object is executed.

5. A server, characterized in that, include: One or more processors; A storage device on which one or more programs are stored; When the one or more programs are executed by the one or more processors, the one or more processors implement the test script generation method as described in any one of claims 1 to 2.

6. A computer storage medium, characterized in that, It stores a computer program, wherein the computer program, when executed by a processor, implements the method for generating test scripts as described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Automated test method and device, storage medium and computer equipment

    CN110309061A

  • Test case query method and device and readable storage medium

    CN111046073A