Case Script Generation Method, Device, Storage Medium and Electronic Device

Through natural language recognition algorithms, the parameter transfer information of interface test cases is recognized, parameter association scripts are generated, and combined with case transaction scripts, the problem of writing a large number of parameter transfer scripts in the existing technology is solved, and the generation efficiency of interface test case scripts is improved.

CN114691109BActive Publication Date: 2025-06-10AGRICULTURAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210322671.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-30
Publication Date
2025-06-10
Estimated Expiration
2042-03-30

AI Technical Summary

Technical Problem

When existing manual writing interface test case scripts, a large number of parameter transfer scripts are required, resulting in large workload, long time and low efficiency.

Method used

By determining the parameter transmission information of the test case, using a preset natural language recognition algorithm for recognition, obtaining parameter matching information, generating parameter association scripts, and generating a complete case script in combination with case transaction scripts.

Benefits of technology

This reduces the amount of pass-through scripts required by testers in case scripting, improves efficiency and shortens development time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691109B_ABST
    Figure CN114691109B_ABST
Patent Text Reader

Abstract

The present invention provides a method and apparatus for generating a case script, a storage medium, and an electronic device. The method includes: determining the parameter passing information corresponding to a test case, where the parameter passing information is natural language information describing the parameter passing rules corresponding to the test case; identifying the parameter passing information through a preset natural language recognition algorithm to obtain corresponding parameter matching information; generating a corresponding parameter association script based on the parameter matching information; determining a plurality of case transactions corresponding to the test case, and determining a case transaction script, where the case transaction script includes a transaction script corresponding to each case transaction; generating a case script corresponding to the test case based on the parameter association script and the case transaction script. By applying the method of the present invention, a parameter association script can be automatically generated based on the parameter matching information identified by the natural language recognition technology, and then a case script can be generated, eliminating the need for testers to write the full-process case script themselves, reducing the workload and improving the efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of testing technologies, and particularly to a method and apparatus for generating case scripts, a storage medium, and an electronic device. Background Art

[0002] Interface testing is one of the important contents in system testing work. During the interface testing process, the interface testing is usually implemented by executing the case scripts of the interface testing cases.

[0003] Currently, the case scripts of the interface testing cases are usually written by testers themselves, and the testers need to write the execution scripts for processes such as transaction execution and parameter passing between interfaces by themselves.

[0004] Among the interface testing cases applied during the interface testing process, there are a large number of process-oriented cases, that is, cases involving multiple transaction processes, which makes there be a large number of parameter passing processes in the case scripts. Based on the existing manual method of writing case scripts, testers need to write a large number of parameter passing scripts, and the workload of the entire case script writing work is large, which takes a lot of time and has low efficiency. Summary of the Invention

[0005] In view of this, embodiments of the present invention provide a method for generating case scripts to solve the problem that in the existing manual method of writing case scripts, testers need to write a large number of parameter passing scripts, and the workload of the entire script writing work is large, time-consuming, and inefficient.

[0006] Embodiments of the present invention also provide a case script generation apparatus to ensure the implementation and application of the above method in practice.

[0007] To achieve the above object, embodiments of the present invention provide the following technical solutions:

[0008] A method for generating case scripts includes:

[0009] Determine the parameter passing information corresponding to the test case, where the parameter passing information is natural language information describing the parameter passing rules corresponding to the test case;

[0010] Identify the parameter passing information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case;

[0011] Generate a parameter association script corresponding to the test case according to the parameter matching information;

[0012] Determine multiple case transactions corresponding to the test case, and determine the case transaction script corresponding to the test case, where the case transaction script includes the transaction script corresponding to each case transaction;

[0013] Generate the case script corresponding to the test case according to the parameter association script and the case transaction script.

[0014] In the above method, optionally, the step of identifying the parameter matching information corresponding to the test case by using a preset natural language recognition algorithm for the parameter passing information includes:

[0015] Perform keyword recognition on the parameter passing information according to the preset natural language recognition algorithm to obtain a field matching rule in a preset format;

[0016] Display the field matching rule to the user and prompt the user whether to adjust the field matching rule;

[0017] If a trigger instruction for the user to adjust the field matching rule is received, obtain the adjusted field matching rule and use the adjusted field matching rule as the parameter matching information corresponding to the test case.

[0018] In the above method, optionally, the step of determining the case transaction script corresponding to the test case includes:

[0019] Determine the transaction script corresponding to each case transaction;

[0020] Determine the transaction order corresponding to each case transaction;

[0021] Generate the case transaction script corresponding to the test case according to the transaction script corresponding to each case transaction and the transaction order corresponding to each case transaction.

[0022] In the above method, optionally, the step of determining the transaction script corresponding to each case transaction includes:

[0023] In multiple preset transactions, determine the target preset transaction corresponding to each case transaction;

[0024] Obtain the transaction script corresponding to each target preset transaction from a preset transaction script library; the preset transaction script library contains the transaction scripts corresponding to each preset transaction;

[0025] Use the transaction script corresponding to each target preset transaction as the transaction script corresponding to the case transaction corresponding to the target preset transaction.

[0026] In the above method, optionally, the step of generating the case transaction script corresponding to the test case according to the transaction script corresponding to each case transaction and the transaction order corresponding to each case transaction includes:

[0027] Process the trading scripts corresponding to each of the case transactions in sequence according to the trading order corresponding to each case transaction, obtain a combined trading script, and use the combined trading script as the case trading script corresponding to the test case.

[0028] Optionally, the above method further includes:

[0029] Display the case script to the tester and prompt the tester whether to adjust the case script;

[0030] When receiving an instruction from the tester to adjust the case script, obtain the adjusted case script and use the adjusted case script as the new case script corresponding to the test case.

[0031] A case script generation device includes:

[0032] A first determination unit for determining the parameter passing information corresponding to the test case, where the parameter passing information is natural language information describing the parameter passing rules corresponding to the test case;

[0033] An identification unit for identifying the parameter passing information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case;

[0034] A first generation unit for generating a parameter association script corresponding to the test case based on the parameter matching information;

[0035] A second determination unit for determining multiple case transactions corresponding to the test case and determining the case trading script corresponding to the test case, where the case trading script includes the trading script corresponding to each case transaction;

[0036] A second generation unit for generating a case script corresponding to the test case based on the parameter association script and the case trading script.

[0037] Optionally, the above device further includes:

[0038] A display unit for displaying the case script to the tester and prompting the tester whether to adjust the case script;

[0039] An adjustment unit for obtaining the adjusted case script when receiving an instruction from the tester to adjust the case script and using the adjusted case script as the new case script corresponding to the test case.

[0040] A storage medium, the storage medium includes stored instructions, wherein, when the instructions are running, the device where the storage medium is located is controlled to execute the case script generation method as described above.

[0041] An electronic device, including a memory, and one or more instructions, wherein one or more instructions are stored in the memory and are configured to be executed by one or more processors to execute the case script generation method as described above.

[0042] Based on the case script generation method provided by the embodiments of the present invention, it includes: determining the parameter passing information corresponding to the test case, the parameter passing information is natural language information describing the parameter passing rules corresponding to the test case; identifying the parameter passing information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case; generating a parameter association script according to the parameter matching information; determining multiple case transactions corresponding to the test case, and determining the case transaction script corresponding to the test case, the case transaction script includes the transaction script corresponding to each case transaction; generating the case script corresponding to the test case according to the parameter association script and the case transaction script. When applying the method provided by the embodiments of the present invention to generate the case script of the test case, the parameter passing information can be identified through the natural language recognition algorithm to obtain the parameter matching information, and a parameter association script, that is, the script of the parameter passing process, can be generated according to the parameter matching information. Then, the case script corresponding to the test case is generated according to the case transaction script including each transaction script and the parameter association script. During the development of the case script, testers do not need to write a large number of parameter passing scripts by themselves, which can reduce the workload and improve the efficiency. Description of the Drawings

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained according to the provided drawings without creative efforts.

[0044] Figure 1 It is a method flow chart of a case script generation method provided by the embodiments of the present invention;

[0045] Figure 2 It is another method flow chart of a case script generation method provided by the embodiments of the present invention;

[0046] Figure 3 It is a structural schematic diagram of a case script generation device provided by the embodiments of the present invention;

[0047] Figure 4Another structural schematic diagram of a case script generation device provided by an embodiment of the present invention;

[0048] Figure 5 Structural schematic diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners

[0049] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

[0050] In this application, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the phrase "including one..." does not exclude the presence of additional identical elements in the process, method, article or device including the element.

[0051] An embodiment of the present invention provides a case script generation method, which can be applied to a case script generation system, and the execution subject can be the server of the system. The method flow chart of the method is as Figure 1 shown and includes:

[0052] S101: Determine the parameter passing information corresponding to the test case, where the parameter passing information is natural language information describing the parameter passing rules corresponding to the test case;

[0053] In the method provided by the embodiment of the present invention, the user can import the parameter passing information corresponding to the test case or pre-store the parameter passing information in the database. When it is necessary to generate a case script for the test case, a corresponding script generation instruction can be sent to the system server through the front end. When the server receives the instruction, the imported or pre-stored parameter passing information can be obtained. The parameter passing information is information describing the parameter passing rules corresponding to the test case in natural language, and the parameter passing information may include the parameter passing rules between system-level interfaces and the parameter passing rules between transaction-level interfaces described in natural language. For example, the value of field b within the range of the system to be tested is equal to the value of field a, or the value of field c in transaction A is equal to the value of field d in transaction B, etc.

[0054] S102: Identify the parameter passing information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case;

[0055] In the method provided by the embodiments of the present invention, a natural language recognition algorithm is preset in the system according to the recognition requirements. The parameter passing information is recognized through the preset natural language recognition algorithm to determine the association relationship between parameters, and the association relationship between parameters is established according to the preset association configuration method to obtain the parameter matching information corresponding to the test case. The parameter matching information includes the association relationships of each group of parameters, and may also include information such as parameter field names and field lengths.

[0056] S103: Generate a parameter association script corresponding to the test case according to the parameter matching information;

[0057] In the method provided by the embodiments of the present invention, a parameter association script template can be preset for the corresponding association relationship of parameters. According to the association relationships of each group of parameters in the parameter matching information, the corresponding template can be called for parameter filling to obtain a parameter passing script corresponding to each group of parameter association relationships, so as to generate a parameter association script corresponding to each group of parameter association relationships. The parameter association script contains the parameter passing scripts corresponding to each group of parameter association relationships.

[0058] S104: Determine multiple case transactions corresponding to the test case, and determine a case transaction script corresponding to the test case. The case transaction script contains a transaction script corresponding to each case transaction;

[0059] In the method provided by the embodiments of the present invention, multiple case transactions corresponding to the test case can be determined according to the case information of the test case, that is, each transaction that needs to be executed for the test case. Then, a case transaction script is determined, that is, a case transaction script containing the transaction scripts corresponding to each case transaction. The transaction script corresponding to a case transaction refers to a script for executing a transaction, which can be pre-configured by a tester.

[0060] S105: Generate a case script corresponding to the test case according to the parameter association script and the case transaction script.

[0061] In the method provided by the embodiments of the present invention, the parameter association script and the case transaction script can be merged to generate a case script corresponding to the test case. Specifically, according to the arrangement order of each transaction script in the case transaction script, the parameter passing scripts corresponding to the association relationships of each group of parameters in the parameter association script are merged with each transaction script in sequence, that is, the parameter passing script representing the parameter passing process between two case transactions is merged with the transaction scripts of these two case transactions correspondingly.

[0062] Based on the method provided by the embodiments of the present invention, the parameter information corresponding to the test case is recognized through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case; according to the parameter matching information, a parameter association script is generated, and the case transaction script corresponding to the test case is determined, and each case transaction corresponding to the test case in the case transaction script includes the corresponding transaction script. Then, according to the parameter association script and the case transaction script, the case script corresponding to the test case is generated. By applying the method provided by the embodiments of the present invention, based on the recognition of the parameter information through the natural language recognition algorithm, the parameter association script of the test case, that is, the script of the parameter passing process between interfaces, can be automatically generated, and then the case script can be generated. During the development of the case script, the system can automatically generate the parameter passing script and the overall case script. Testers do not need to write a large number of parameter passing scripts by themselves, which can reduce the workload of case script development, shorten the time-consuming of case script development, and improve work efficiency.

[0063] On the basis of the method shown in Figure 1 In the method provided by the embodiments of the present invention, the process of recognizing the parameter information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case mentioned in step S102 includes:

[0064] According to the preset natural language recognition algorithm, keyword recognition is performed on the parameter information to obtain a field matching rule in a preset format;

[0065] In the method provided by the embodiments of the present invention, keyword recognition is performed on the parameter information through the natural language recognition algorithm, mainly to recognize the Chinese names of the fields with an association relationship, and a matching relationship is established for the fields representing the same meaning (associated with the same parameter value) according to a preset format to generate a field matching rule in a preset format.

[0066] The field matching rule is displayed to the user, and the user is prompted whether to adjust the field matching rule;

[0067] In the method provided by the embodiments of the present invention, the currently recognized field matching rule can be exported through the system front end, the field matching rule is displayed to the user, and an editable text is provided to the user to prompt the user whether to adjust the field matching rule. The user can be a tester.

[0068] If a trigger instruction for the user to adjust the field matching rule is received, the adjusted field matching rule is obtained, and the adjusted field matching rule is used as the parameter matching information corresponding to the test case.

[0069] In the method provided by the embodiments of the present invention, the user can adjust the field matching rule at the front end and submit the adjusted field matching rule. In response to the user's operation, the front end can send a trigger instruction based on the adjusted field matching rule. When the server receives the trigger instruction for the user to adjust the field matching rule, it can obtain the adjusted field matching rule submitted by the user and use this field matching rule as the parameter matching information corresponding to the test case.

[0070] In the method provided by the embodiments of the present invention, if the user does not adjust the field matching rule, the directly recognized field matching rule is used as the parameter matching information corresponding to the test case.

[0071] Based on the method provided by the embodiments of the present invention, the user can adjust the recognized field matching rule, which can improve the accuracy of field matching and further improve the accuracy of the parameter association script and the case script.

[0072] It should be noted that the embodiments of the present invention are only provided to better illustrate the method provided by the embodiments of the present invention. In the specific implementation process, the directly recognized generated field matching rule can also be used as the parameter matching information, which does not affect the function implementation of the method provided by the embodiments of the present invention.

[0073] Further, on the basis of the Figure 1 method shown, in the method provided by the embodiments of the present invention, the process of determining the case transaction script corresponding to the test case mentioned in step S104 includes:

[0074] Determine the transaction script corresponding to each case transaction;

[0075] In the method provided by the embodiments of the present invention, the tester can pre-configure the transaction scripts corresponding to each case transaction and import them into the case script generation system.

[0076] Determine the transaction order corresponding to each case transaction;

[0077] In the method provided by the embodiments of the present invention, the tester can pre-configure the transaction order of each case transaction according to the requirements of the test case, that is, the execution order of each case transaction. The configuration information of the transaction order of each test case is pre-stored in the server, and the transaction order corresponding to each case transaction can be determined according to the pre-stored configuration information.

[0078] Generate the case transaction script corresponding to the test case according to the transaction script corresponding to each case transaction and the transaction order corresponding to each case transaction.

[0079] Further, based on the method provided in the above embodiment, in the method provided by the embodiment of the present invention, the process of determining the transaction script corresponding to each of the case transactions includes:

[0080] Among multiple preset transactions, determine the target preset transaction corresponding to each of the case transactions;

[0081] In the method provided by the embodiment of the present invention, the transaction information of multiple transactions can be preset according to the test case requirements. The case transactions corresponding to the current test case are actually also preset transactions. The target preset transaction corresponding to each case transaction can be determined from multiple preset transactions. Specifically, it can be determined by matching the transaction identifiers.

[0082] Obtain the transaction script corresponding to each of the target preset transactions from the preset transaction script library; the preset transaction script library contains the transaction scripts corresponding to each of the preset transactions;

[0083] In the method provided by the embodiment of the present invention, testers can pre-configure the transaction scripts corresponding to each preset transaction, that is, the scripts for executing the preset transactions. Based on the transaction scripts corresponding to each preset transaction, a transaction script library is set up to obtain the preset transaction script library. The transaction script corresponding to each target preset transaction can be obtained from the preset transaction script library.

[0084] Use the transaction script corresponding to each of the target preset transactions as the transaction script corresponding to the case transaction corresponding to the target preset transaction.

[0085] In the method provided by the embodiment of the present invention, the transaction script corresponding to each case transaction is the transaction script corresponding to the target preset transaction corresponding to each case transaction, that is, the transaction script corresponding to the case transaction in the preset transaction script library.

[0086] Further, based on the method provided in the above embodiment, in the method provided by the embodiment of the present invention, the process of generating the case transaction script corresponding to the test case according to the transaction script corresponding to each of the case transactions and the transaction order corresponding to each of the case transactions includes:

[0087] Perform sequential merging processing on the transaction scripts corresponding to each of the case transactions according to the transaction order corresponding to each of the case transactions to obtain a merged transaction script, and use the merged transaction script as the case transaction script corresponding to the test case.

[0088] Further, based on Figure 1 the method shown, the embodiment of the present invention provides another case script generation method. Referring to Figure 2 the flowchart shown, the method provided by the embodiment of the present invention further includes:

[0089] S106: Display the case script to the tester and prompt the tester whether to adjust the case script.

[0090] In the method provided by the embodiments of the present invention, the case script generated by exporting through the system front end can be displayed to the tester, and editable text can be provided to the tester to prompt the tester whether to adjust the case script.

[0091] S107: When receiving an instruction from the tester to adjust the case script, obtain the adjusted case script and use the adjusted case script as the new case script corresponding to the test case.

[0092] In the method provided by the embodiments of the present invention, the tester can adjust the generated case script at the front end and submit the adjusted case script. In response to the operation of the tester submitting the adjusted case script, the front end can send a corresponding instruction based on the adjusted case script. When the server receives this instruction, it can obtain the case script adjusted by the tester and use the adjusted case script as the new case script corresponding to the test case for subsequent system testing.

[0093] To better illustrate the method provided by the embodiments of the present invention, the following further gives examples of the case script generation method provided by the embodiments of the present invention. The case script generation process provided by the embodiments of the present invention specifically includes:

[0094] Generated based on system-level and transaction-level keyword matching rules for natural language recognition;

[0095] For flow-based cases, there are some keyword information transfer rules that need to be observed throughout the system or between two transactions, and these need to be configured before the development of flow-based cases. System-level rules, such as the value of field B within the scope of this system being equal to the value of field A. Rules between two transactions, such as: field b in transaction B being equal to field a in transaction A. Apply natural language recognition technology to identify the Chinese names of the two fields, and fields with the same Chinese meaning are automatically established with field matching rules, and manual adjustment of the field matching rules can be performed. The field matching rules contain keyword association configuration data, and the keyword association configuration data refers to static data formed by configuring the association relationship according to the determined parameter relationship.

[0096] Arrange the transaction order;

[0097] The tester arranges the transaction order according to the case logic to obtain a case script (case transaction script) containing each transaction script arranged in the transaction order.

[0098] Rule-based case script generation;

[0099] Export the sorted case script (case transaction script), use the tool to select the case script (case transaction script), generate the corresponding parameter association script according to the field matching rule data, and then generate a new case script.

[0100] Manual adjustment and debugging;

[0101] Import the new interface test case script using the open-source interface test tool for manual adjustment and debugging, and perform testing after debugging.

[0102] The method provided by the embodiments of the present invention realizes the automated development of process cases, facilitating the daily work of batch testing personnel. This method only requires the testing personnel to arrange the front and back relationships of the transactions in the case, provide a parameter association script generated based on information such as field length, keyword name, and keyword association configuration data, and then a case script can be generated. After the testing personnel make adjustments, debugging is carried out, greatly reducing the workload of the testing personnel in writing case scripts and promoting the case script development work towards automation.

[0103] associated with Figure 1 corresponding to the case script generation method shown in Figure 1 the specific implementation of the method shown in Figure 3 shown, including:

[0104] The first determination unit 201 is used to determine the parameter passing information corresponding to the test case, and the parameter passing information is natural language information describing the parameter passing rules corresponding to the test case;

[0105] The recognition unit 202 is used to recognize the parameter passing information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case;

[0106] The first generation unit 203 is used to generate a parameter association script corresponding to the test case according to the parameter matching information;

[0107] The second determination unit 204 is used to determine multiple case transactions corresponding to the test case and determine the case transaction script corresponding to the test case, and the case transaction script includes the transaction script corresponding to each case transaction;

[0108] The second generation unit 205 is used to generate a case script corresponding to the test case according to the parameter association script and the case transaction script.

[0109] Based on the device provided by the embodiments of the present invention, the parameter information corresponding to the test case is recognized through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case; according to the parameter matching information, a parameter association script is generated, and the case transaction script corresponding to the test case is determined. Each case transaction corresponding to the test case in the case transaction script includes a corresponding transaction script. Then, according to the parameter association script and the case transaction script, the case script corresponding to the test case is generated. By applying the device provided by the embodiments of the present invention, based on the recognition of the parameter information through the natural language recognition algorithm, the parameter association script of the test case, that is, the script for the parameter passing process between interfaces, can be automatically generated, and then the case script can be generated. During the development process of the case script, the system can automatically generate the parameter passing script and the overall case script. Testers do not need to write a large number of parameter passing scripts by themselves, which can reduce the workload of case script development, shorten the time-consuming of case script development, and improve work efficiency.

[0110] Further, based on the Figure 3 device shown above, the embodiments of the present invention provide another case script generation device. Referring to the Figure 4 structural schematic diagram shown above, the device provided by the embodiments of the present invention further includes:

[0111] A display unit 206, configured to display the case script to the tester and prompt the tester whether to adjust the case script;

[0112] An adjustment unit 207, configured to, when receiving an instruction from the tester to adjust the case script, obtain the adjusted case script and use the adjusted case script as the new case script corresponding to the test case.

[0113] Based on the device provided in the above embodiments, in the device provided by the embodiments of the present invention, the recognition unit 202 includes:

[0114] A recognition subunit, configured to perform keyword recognition on the parameter information according to the preset natural language recognition algorithm to obtain a field matching rule in a preset format;

[0115] A display subunit, configured to display the field matching rule to the user and prompt the user whether to adjust the field matching rule;

[0116] An adjustment subunit, configured to, if receiving a trigger instruction from the user to adjust the field matching rule, obtain the adjusted field matching rule and use the adjusted field matching rule as the parameter matching information corresponding to the test case.

[0117] Based on the device provided in the above embodiments, in the device provided in the embodiments of the present invention, the second determination unit 204 includes:

[0118] A first determination subunit, configured to determine a transaction script corresponding to each of the case transactions;

[0119] A second determination subunit, configured to determine a transaction order corresponding to each of the case transactions;

[0120] A generation subunit, configured to generate a case transaction script corresponding to the test case according to the transaction script corresponding to each of the case transactions and the transaction order corresponding to each of the case transactions.

[0121] Based on the device provided in the above embodiments, in the device provided in the embodiments of the present invention, the first determination subunit includes:

[0122] A third determination subunit, configured to determine a target preset transaction corresponding to each of the case transactions from multiple preset transactions;

[0123] An acquisition subunit, configured to acquire a transaction script corresponding to each of the target preset transactions from a preset transaction script library; the preset transaction script library contains transaction scripts corresponding to each of the preset transactions;

[0124] A fourth determination subunit, configured to use the transaction script corresponding to each of the target preset transactions as the transaction script corresponding to the case transaction corresponding to the target preset transaction.

[0125] Based on the device provided in the above embodiments, in the device provided in the embodiments of the present invention, the second generation unit 205 includes:

[0126] A merging subunit, configured to perform sequential merging processing on the transaction scripts corresponding to each of the case transactions according to the transaction order corresponding to each of the case transactions, obtain a merged transaction script, and use the merged transaction script as the case transaction script corresponding to the test case.

[0127] The embodiments of the present invention further provide a storage medium, which includes stored instructions. When the instructions run, the device where the storage medium is located is controlled to execute the case script generation method as described above.

[0128] The embodiments of the present invention further provide an electronic device, the structural schematic diagram of which is as Figure 5 shown, and specifically includes a memory 301 and one or more instructions 302. One or more instructions 302 are stored in the memory 301 and are configured to be executed by one or more processors 303 to perform the following operations on the one or more instructions 302:

[0129] Determine the parameter passing information corresponding to the test case, where the parameter passing information is natural language information describing the parameter passing rules corresponding to the test case;

[0130] Identify the parameter passing information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case;

[0131] Generate a parameter association script corresponding to the test case based on the parameter matching information;

[0132] Determine multiple case transactions corresponding to the test case and determine a case transaction script corresponding to the test case, where the case transaction script contains a transaction script corresponding to each case transaction;

[0133] Generate a case script corresponding to the test case based on the parameter association script and the case transaction script.

[0134] Each embodiment in this specification is described in a progressive manner. For the same or similar parts between the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for a system or a system embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For the relevant parts, reference can be made to the partial description of the method embodiment. The systems and system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative efforts.

[0135] Professionals can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0136] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention 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 a case script, characterized in that, it includes: Determine the parameter passing information corresponding to the test case, where the parameter passing information is natural language information describing the parameter passing rules corresponding to the test case; Identify the parameter passing information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case; Generate a parameter association script corresponding to the test case according to the parameter matching information; Determine multiple case transactions corresponding to the test case, and determine the case transaction script corresponding to the test case, where the case transaction script contains the transaction script corresponding to each case transaction; Generate a case script corresponding to the test case according to the parameter association script and the case transaction script.

2. The method according to claim 1, characterized in that, The step of identifying the parameter passing information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case includes: Perform keyword recognition on the parameter passing information according to the preset natural language recognition algorithm to obtain a field matching rule in a preset format; Display the field matching rule to the user and prompt the user whether to adjust the field matching rule; If a trigger instruction for the user to adjust the field matching rule is received, obtain the adjusted field matching rule and use the adjusted field matching rule as the parameter matching information corresponding to the test case.

3. The method according to claim 1, characterized in that, The step of determining the case transaction script corresponding to the test case includes: Determine the transaction script corresponding to each case transaction; Determine the transaction order corresponding to each case transaction; Generate a case transaction script corresponding to the test case according to the transaction script corresponding to each case transaction and the transaction order corresponding to each case transaction.

4. The method according to claim 3, characterized in that, The step of determining the transaction script corresponding to each case transaction includes: Among multiple preset transactions, determine the target preset transaction corresponding to each case transaction; Obtain the transaction script corresponding to each target preset transaction from a preset transaction script library; the preset transaction script library contains the transaction script corresponding to each preset transaction; Use the transaction script corresponding to each target preset transaction as the transaction script corresponding to the case transaction corresponding to the target preset transaction.

5. The method according to claim 3, characterized in that, The step of generating a case transaction script corresponding to the test case according to the transaction script corresponding to each case transaction and the transaction order corresponding to each case transaction includes: Perform sequential merging processing on the transaction scripts corresponding to each case transaction according to the transaction order corresponding to each case transaction to obtain a merged transaction script, and use the merged transaction script as the case transaction script corresponding to the test case.

6. The method according to claim 1, characterized in that, It further includes: Display the case script to the tester and prompt the tester whether to adjust the case script; When receiving the instruction for the tester to adjust the case script, obtain the adjusted case script, and use the adjusted case script as the new case script corresponding to the test case.

7. A case script generation device, characterized in that, comprising: A first determination unit, configured to determine the parameter passing information corresponding to the test case, where the parameter passing information is natural language information describing the parameter passing rules corresponding to the test case; An identification unit, configured to identify the parameter passing information through a preset natural language recognition algorithm to obtain the parameter matching information corresponding to the test case; A first generation unit, configured to generate a parameter association script corresponding to the test case according to the parameter matching information; A second determination unit, configured to determine multiple case transactions corresponding to the test case, and determine the case transaction script corresponding to the test case, where the case transaction script includes the transaction script corresponding to each case transaction; A second generation unit, configured to generate a case script corresponding to the test case according to the parameter association script and the case transaction script.

8. The device according to claim 7, characterized in that, further comprising: A display unit, configured to display the case script to the tester and prompt the tester whether to adjust the case script; An adjustment unit, configured to obtain the adjusted case script when receiving the instruction for the tester to adjust the case script, and use the adjusted case script as the new case script corresponding to the test case.

9. A storage medium, characterized in that, the storage medium includes stored instructions, wherein when the instructions run, the device where the storage medium is located is controlled to execute the case script generation method according to any one of claims 1 to 6.

10. An electronic device, characterized in that, comprising a memory, and one or more instructions, wherein one or more instructions are stored in the memory and are configured to be executed by one or more processors to execute the case script generation method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Test method and device

    CN107608874A

  • Test environment model generation method and device, computer device and storage medium

    CN108241357A