Program test method, device and equipment based on sandbox test case and medium

By determining the value range and request type of the request parameter in the sandbox test case and performing parameter matching, the problem of low accuracy and reliability of request packets in the prior art is solved, and more efficient and accurate program testing is achieved.

CN119807054APending Publication Date: 2025-04-11INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411871572.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the prior art, the accuracy and reliability of request packets in sandbox testing cases are low, resulting in limited program testing efficiency and accuracy.

Method used

By obtaining the test case request of the program to be tested, the value range of the request parameters is determined, and the request type is determined based on the preset set of case parameter value ranges. If the request type is a case-matchable type, the request parameter is matched with the input parameters of the candidate test case to determine whether the target input parameter exists. If present, the candidate test case corresponding to the target input parameter is used as the target test case and the test is performed.

Benefits of technology

It improves the accuracy and reliability of test case call requests, ensures the accurate determination of target test cases, and thus improves the efficiency and accuracy of program testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119807054A_ABST
    Figure CN119807054A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a program test method, device and equipment based on sandbox test cases and a medium, and relates to the technical field of financial science and technology. The method comprises the steps of obtaining a test case calling request of a to-be-tested program, and determining a request parameter value range of request parameters in the test case calling request; determining a request type of the test case calling request according to the request parameter value range and a preset case parameter value range set; if the request type is a case matching type, matching the request parameter with a candidate input parameter of each candidate test case, and determining whether a target input parameter exists or not; and if yes, taking the candidate test case corresponding to the target input parameter as a target test case so as to test the to-be-tested program through the target test case. According to the scheme, the accuracy and reliability of the test case calling request are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of financial technology, and in particular, to a program testing method, device, equipment and medium based on sandbox test cases. Background Art

[0002] In the API (Application Programming Interface) open platform scenario, the main technical implementation solution is to simulate a complete service through container technology or virtual machines, without affecting the operation of other programs outside the sandbox. Sandbox environment test cases are managed manually or through self-developed systems. The sandbox aims to lower the development threshold for developers through self-service joint testing.

[0003] In the prior art, a corresponding sandbox test case is retrieved through a request message to test the program. Therefore, it is very important to improve the accuracy and reliability of the request message. Summary of the invention

[0004] The present invention provides a program testing method, device, equipment and medium based on sandbox test cases to improve the accuracy and reliability of test case retrieval requests.

[0005] In one aspect of the present invention, a program testing method based on a sandbox test case is provided, which is applied to a sandbox baffle, and the method comprises:

[0006] Obtaining a test case call request for the program to be tested, and determining a request parameter value range of a request parameter in the test case call request;

[0007] Determine the request type of the test case call request according to the request parameter value range and a preset case parameter value range set; wherein the case parameter value range set is determined according to case parameter information obtained from the candidate test case associated with the candidate test interface;

[0008] If the request type is a case-matchable type, the request parameters are matched with candidate input parameters of each candidate test case to determine whether a target input parameter exists; wherein the candidate test case is determined according to a configuration file template and a parameter program template;

[0009] If so, the candidate test case corresponding to the target input parameter is used as the target test case, so as to test the program to be tested through the target test case.

[0010] According to another aspect of the present invention, there is provided a program testing device based on a sandbox test case, which is configured on a sandbox baffle, and the device comprises:

[0011] A request parameter value range determination module, used to obtain a test case call request of a program to be tested, and determine a request parameter value range of a request parameter in the test case call request;

[0012] A request type determination module, used to determine the request type of the test case call request according to the request parameter value range and a preset case parameter value range set; wherein the case parameter value range set is determined according to the case parameter information obtained from the candidate test case associated with the candidate test interface;

[0013] a target input parameter determination module, for matching the request parameter with the candidate input parameters of each candidate test case to determine whether the target input parameter exists if the request type is a case-matchable type; wherein the candidate test case is determined according to a configuration file template and a parameter program template;

[0014] The target test case determination module is used to take the candidate test case corresponding to the target input parameter as the target test case if it exists, so as to test the program to be tested through the target test case.

[0015] According to another aspect of the present invention, there is provided an electronic device, comprising:

[0016] one or more processors;

[0017] A memory for storing one or more programs;

[0018] When one or more programs are executed by one or more processors, the one or more processors can execute any one of the program testing methods based on sandbox test cases provided by the embodiments of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to enable a processor to implement any one of the program testing methods based on sandbox test cases provided in the embodiments of the present invention when executed.

[0020] An embodiment of the present invention provides a program testing scheme based on sandbox test cases, which obtains a test case call request of a program to be tested and determines a request parameter value range of a request parameter in the test case call request; determines a request type of the test case call request according to the request parameter value range and a preset case parameter value range set; wherein the case parameter value range set is determined according to case parameter information obtained from a candidate test case associated with a candidate test interface; if the request type is a case-matchable type, matches the request parameters with candidate input parameters of each candidate test case to determine whether a target input parameter exists; wherein the candidate test case is determined according to a configuration file template and a parameter program template; if so, uses the candidate test case corresponding to the target input parameter as a target test case, so as to test the program to be tested through the target test case. The above scheme verifies the request parameters in the test case call request according to the case parameter value range set and the request parameter value range, determines the request type of the test case call request, and when the verification passes, that is, the request type is a case-matchable type, then matches the request parameters with the candidate input parameters of each candidate test case respectively, thereby avoiding directly matching the request parameters in the test case call request with the candidate input parameters of each candidate test case, reducing the possibility of parameter matching failure, and improving the accuracy and reliability of the test case call request; at the same time, the request parameters are matched with the candidate input parameters of each candidate test case to determine the target input parameters, and then the target test case is determined, thereby improving the accuracy of the determined target test case; and, the candidate test case is determined according to the configuration file template and the parameter program template, thereby improving the efficiency of determining the candidate test case.

[0021] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 is a flowchart of a program testing method based on a sandbox test case provided in Embodiment 1 of the present invention;

[0024] Figure 2 is a flowchart of a program testing method based on a sandbox test case provided in Embodiment 2 of the present invention;

[0025] Figure 3 This is a schematic diagram of the structure of an API open platform provided in Embodiment 3 of the present invention;

[0026] Figure 4 It is a structural schematic diagram of a program testing device based on a sandbox test case provided in a fourth embodiment of the present invention;

[0027] Figure 5 It is a structural diagram of an electronic device for implementing a program testing method based on a sandbox test case provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION

[0028] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0029] Sandbox technology: a security mechanism used to isolate running programs, with the purpose of limiting the access rights of untrusted processes or untrusted code at runtime. Programs running in a sandbox can only access the resources loaded by the sandbox, without affecting external applications, systems or platforms, and preventing them from causing permanent changes to other programs or data in the computer.

[0030] Test case: A set of test inputs, execution conditions, and expected results compiled for a specific purpose to verify whether a specific software requirement is met.

[0031] Embodiment 1

[0032] Figure 1 It is a flowchart of a program testing method based on sandbox test cases provided in Example 1 of the present invention. This embodiment can be applied to determining test cases in a sandbox environment to test programs through test cases. The method can be executed by a program testing device based on sandbox test cases. The device can be implemented in software and / or hardware and can be configured in an electronic device that carries a program testing function based on sandbox test cases.

[0033] See also Figure 1 The program testing method based on the sandbox test case shown is applied to the sandbox baffle, including:

[0034] S110: Obtain a test case calling request for the program to be tested, and determine a request parameter value range of a request parameter in the test case calling request.

[0035] The program to be tested refers to a program that needs to be tested. The embodiment of the present invention does not limit the type of the program to be tested, and the type can be set by a technician based on experience or needs.

[0036] The test case retrieval request refers to a request that can be used to instruct the acquisition of a target test case. The target test case refers to a case used to test the program under test. The request parameter refers to the case request parameter included in the test case retrieval request, which can be understood as the input parameter of the target test case. The request parameter value range refers to the limit interval of the request parameter value.

[0037] Specifically, the sandbox baffle obtains the test case call request of the program to be tested from the API sandbox gateway; the sandbox baffle determines the request parameter value range of the request parameter in the test case call request. Among them, the sandbox baffle refers to the API sandbox baffle, which can be used to determine the target test case according to the test case call request. The API sandbox gateway refers to the API gateway in the sandbox environment, which can be used to obtain the test case call request and forward the test case call request to the sandbox baffle.

[0038] S120: Determine a request type of the test case retrieval request according to a request parameter value range and a preset case parameter value range set.

[0039] The case parameter value range set refers to a set of candidate parameter value ranges. The candidate parameter value range refers to the range limit of the value of the parameter in the candidate test case. It should be noted that different parameters in a candidate test case may correspond to different candidate parameter value ranges. For example, the candidate parameter value range may be a numerical range, field length, field format, field type, etc.

[0040] Exemplarily, the case parameter value range set is determined according to case parameter information obtained from the candidate test case associated with the candidate test interface.

[0041] The candidate test interface can be used to store the candidate test cases. The case parameter information refers to the relevant information of the parameters in the candidate test case. Exemplarily, the case parameter information may include the candidate input parameter, the candidate output parameter, the candidate parameter value range, the interface identifier of the candidate test interface, and the case file identifier of the candidate test case.

[0042] Among them, the candidate input parameter refers to the input parameter of the candidate test case. The candidate output parameter refers to the parameter output by the candidate test case, that is, the expected data obtained by executing the candidate test case. The interface identifier of the candidate test interface can be used to uniquely characterize the identity of the candidate test interface. The case file identifier of the candidate test case can be used to uniquely characterize the identity of the candidate test case.

[0043] The request type refers to the type of the test case call request. Exemplarily, the request type may include a case matchable type and a case unmatchable type. The case matchable type indicates that the request parameters in the test case call request can be matched with the candidate input parameters. The case unmatchable type indicates that the request parameters in the test case call request are prohibited from being matched with the candidate input parameters.

[0044] Exemplarily, the sandbox baffle obtains case parameter information from the candidate test cases associated with each candidate test interface; determines the interface case association relationship based on the interface identifier of the candidate test interface and the case file identifier of the candidate test case in the case parameter information; summarizes the candidate parameter value ranges in the case parameter information to obtain a case parameter value range set; the sandbox baffle stores the interface case association relationship, the case parameter value range set, the candidate input parameters, and the candidate output parameters. It should be noted that each interface case association relationship corresponds to the candidate input parameters and candidate output parameters of the candidate test case in the association relationship. Among them, the interface case association relationship refers to the binding relationship between the candidate test interface and the candidate test case.

[0045] Exemplarily, the sandbox baffle determines the request type of the test case call request according to the request parameter value range and the preset case parameter value range.

[0046] In an optional embodiment, the request type of the test case call request is determined based on the request parameter value range and a preset case parameter value range set, including: determining whether there is a reference parameter value range in the case parameter value range set that matches the request parameter value range; if so, determining that the request type of the test case call request is a case matchable type; if not, determining that the request type of the test case call request is a case unmatchable type.

[0047] The reference parameter value range refers to a candidate parameter value range that is the same as the request parameter value range.

[0048] Exemplarily, for any request parameter value range, determine whether the request parameter value range is the same as a candidate parameter value range in the case parameter value range set. If so, it indicates that there is a matching reference parameter value range for the request parameter value range, and it is determined that the request parameter value range has passed the verification; if all request parameter value ranges in the test case call request have passed the verification, it is determined that the request type of the test case call request is a case-matchable type; if the request parameter value range is not in any candidate parameter value range in the case parameter value range set, that is, there is no matching reference parameter value range for the request parameter value range, and it is determined that the request parameter value range has failed the verification; if there is at least one request parameter value range that has failed the verification in the test case call request, it is determined that the request type of the test case call request is a case-unmatchable type.

[0049] In an embodiment of the present invention, if the request type of the test case call request is a case unmatched type, parameter exception information is generated and fed back to the case caller. The parameter exception information can indicate that there is an error in the request parameter value range in the test case call request. Exemplarily, the parameter exception information can include parameter exception prompt information and abnormal parameter value information. The parameter exception prompt information is used to prompt the case caller that there is an abnormality in the request parameter. The abnormal parameter value information refers to the request parameter value range that failed the verification. The case caller is used to send a test case call request to the API gateway and call the target test case.

[0050] Exemplarily, when it is determined that the request type of the test case call request is a case unmatchable type, the request parameters in the test case call request can be adjusted in a timely manner, thereby avoiding irrelevant operations of subsequent parameter matching and reducing resource waste.

[0051] It can be understood that by determining whether there is a reference parameter value range that matches the request parameter value range in the case parameter value range set, if there is a reference parameter value range, the request type of the test case call request is determined to be a case-matchable type, thereby improving the accuracy of the determined request type.

[0052] S130: If the request type is a case-matchable type, match the request parameters with the candidate input parameters of each candidate test case to determine whether the target input parameters exist.

[0053] Exemplarily, the candidate test cases are determined according to a configuration file template and a parameter program template, wherein the configuration file template refers to a template of a parameter file used to generate a test case, and the parameter program template refers to a template of a program used to generate a test case.

[0054] The target input parameter refers to a candidate input parameter that is in the same candidate test case and is the same as the request parameter.

[0055] In an optional embodiment, the request parameters are matched with the candidate input parameters of each candidate test case to determine whether the target input parameters exist, including: sorting the candidate test cases according to the case file identifier of each candidate test case to obtain a case sorting result; matching the request parameter order with the candidate input parameters of each candidate test case according to the case sorting result; if the matching result is a successful match, it is determined that the target input parameters exist.

[0056] The case ranking result refers to the result of ranking the candidate test cases.

[0057] Exemplarily, the candidate test cases can be sorted according to the case file identifier of each candidate test case according to the preset identification sorting strategy to obtain the case sorting result. The embodiment of the present invention does not impose any limitation on the preset identification sorting strategy, which can be set by the technician according to experience or needs. Exemplarily, the preset identification sorting strategy can be an English alphabet strategy or a Chinese pinyin strategy. Among them, the English alphabet strategy refers to sorting the candidate test cases according to the English alphabet. The Chinese pinyin strategy refers to sorting the candidate test cases according to the Chinese pinyin table.

[0058] For example, if the preset identifier sorting strategy is an English letter strategy or a Chinese Pinyin strategy, the identifier Pinyin corresponding to the case file identifier is determined; and each candidate test case is sorted according to the preset identifier sorting strategy and the identifier Pinyin of the case file identifier.

[0059] Continuing with the above example, first sort the corresponding candidate test cases according to the first letter of the pinyin of the identification of the case file identifier; then sort the candidate test cases with the same first letter according to the second letter of the pinyin of the identification corresponding to the case file identifier; repeat the above process until all candidate test cases are sorted to obtain the case sorting result.

[0060] Exemplarily, according to the case sorting results, the request parameters are matched one by one with the candidate input parameters of each candidate test case; it is determined whether the candidate input parameters of a candidate test case are the same as the request parameters; if so, the matching result is determined to be a successful match, and it is determined that the target input parameters exist; if not, the matching result is determined to be a failed match, and it is determined that the target input parameters do not exist.

[0061] It can be understood that by introducing the case sorting results, matching the request parameter order with the candidate input parameters of each candidate test case to determine whether the target input parameters exist, parameter matching omissions are avoided, the reliability of parameter matching is improved, and the accuracy of whether the target input parameters exist is improved.

[0062] In an optional embodiment, taking the candidate test case corresponding to the target input parameter as the target test case includes: according to the case sorting result, taking the first successfully matched candidate input parameter as the target input parameter, and taking the candidate test case corresponding to the target input parameter as the target test case.

[0063] For example, when the target input parameter is matched according to the case sorting result, the parameter matching process can be stopped immediately, and the candidate test case corresponding to the matched target input parameter is used as the target test case. The advantage is that it can reduce resource waste and improve the efficiency of determining the target test case.

[0064] Exemplarily, according to the case sorting result, the request parameter sequence is matched with the candidate input parameters of each candidate test case; the first successfully matched candidate input parameter is used as the target input parameter, and the candidate test case corresponding to the target input parameter is used as the target test case.

[0065] It can be understood that by taking the first successfully matched candidate input parameter as the target input parameter and the candidate test case corresponding to the target input parameter as the target test case, the accuracy of the target test case is improved by accurately determining the target input parameter.

[0066] Exemplarily, if the request type is a case-matchable type, the sandbox baffle matches the request parameters with the candidate input parameters of each candidate test case to determine whether the target input parameters exist.

[0067] S140 , if it exists, taking the candidate test case corresponding to the target input parameter as the target test case, so as to test the program to be tested through the target test case.

[0068] Exemplarily, if there are target input parameters, the sandbox baffle uses the candidate test case corresponding to the target input parameter as the target test case; the sandbox baffle sends the target test case to the API display page in the production environment, and the case caller determines whether to accept the target test case through the target test case displayed on the API display page; if accepted, the program test request is fed back to the API open platform, and the API open platform responds to the program test request and performs sandbox testing on the program to be tested according to the target test case. Among them, the program test request refers to a request to test the program to be tested.

[0069] An embodiment of the present invention provides a program testing scheme based on sandbox test cases, which obtains a test case call request of a program to be tested and determines a request parameter value range of a request parameter in the test case call request; determines a request type of the test case call request according to the request parameter value range and a preset case parameter value range set; wherein the case parameter value range set is determined according to case parameter information obtained from a candidate test case associated with a candidate test interface; if the request type is a case-matchable type, matches the request parameters with candidate input parameters of each candidate test case to determine whether a target input parameter exists; wherein the candidate test case is determined according to a configuration file template and a parameter program template; if so, uses the candidate test case corresponding to the target input parameter as a target test case, so as to test the program to be tested through the target test case. The above scheme verifies the request parameters in the test case call request according to the case parameter value range set and the request parameter value range, determines the request type of the test case call request, and when the verification passes, that is, the request type is a case-matchable type, then matches the request parameters with the candidate input parameters of each candidate test case respectively, thereby avoiding directly matching the request parameters in the test case call request with the candidate input parameters of each candidate test case, reducing the possibility of parameter matching failure, and improving the accuracy and reliability of the test case call request; at the same time, the request parameters are matched with the candidate input parameters of each candidate test case to determine the target input parameters, and then the target test case is determined, thereby improving the accuracy of the determined target test case; and, the candidate test case is determined according to the configuration file template and the parameter program template, thereby improving the efficiency of determining the candidate test case.

[0070] Embodiment 2

[0071] Figure 2 This is a flowchart of a program testing method based on a sandbox test case provided by the second embodiment of the present invention. Based on the above embodiments, this embodiment "determines a parameter configuration file according to the test requirements and the configuration file template; determines a candidate test case according to the parameter configuration file and the parameter program template" to improve the determination mechanism of the candidate test case. It should be noted that for the part not described in detail in the embodiment of the present invention, reference can be made to the description of other embodiments.

[0072] See also Figure 2 The program testing method based on the sandbox test case shown includes:

[0073] S210: Determine a parameter configuration file according to the test requirements and the configuration file template.

[0074] The test requirement refers to the requirement for sandbox testing of the program. For example, the test requirement can be set by a technician based on experience or needs. The parameter configuration file is a configuration file for generating parameters of candidate test cases.

[0075] In an optional embodiment, a parameter configuration file is determined according to test requirements and a configuration file template, including: determining a test scenario and test parameter association data according to the test requirements, and determining a reference test interface from candidate test interfaces according to the test scenario; determining the number of candidate test cases associated with the reference test interface; determining a target test interface from the reference test interface according to the number of cases; and determining the parameter configuration file according to the interface identifier of the target test interface, the test parameter association data and the configuration file template.

[0076] The test scenario refers to the scenario of the sandbox test. The test parameter association data refers to the parameter association data involved in the test requirements. Exemplarily, the test parameter association data may include at least one of the candidate input parameter identifier or the key of the candidate input parameter, the value of the candidate input parameter, and the candidate parameter value range.

[0077] Among them, the candidate test interface refers to the API interface on the API development platform, which can be used to store candidate test cases. The reference test interface refers to the candidate test interface used to adapt to the test scenario in the test requirements. The number of cases refers to the number of candidate test cases bound to the reference test interface. The target test interface refers to the reference test interface used to bind the candidate test cases corresponding to the parameter configuration file.

[0078] It should be noted that, according to the pre-set test scenarios, the candidate test interfaces on the API open platform are grouped, and the candidate test interfaces in the same group are used to bind the candidate test cases under the same test scenario.

[0079] Exemplarily, determine the test scenarios and test parameter association data corresponding to the business requirements; use the candidate test interface used to bind the candidate test cases of the aforementioned test scenarios (i.e., the test scenarios corresponding to the business requirements) as the reference test interface; determine the number of candidate test cases associated with each reference test interface; use the reference test interface with a smaller number of cases as the target test interface; fill the interface identifier and test parameter association data of the target test interface into the configuration file template to obtain the parameter configuration file.

[0080] It should be noted that the reference test interface with the smallest number of cases is used as the target test interface. If there are at least two reference test interfaces with the smallest number of cases, a reference test interface is randomly selected as the target test interface.

[0081] It can be understood that by determining the target test interface from the candidate test interfaces based on the test scenarios and the number of cases, the accuracy of the determined target test interface is improved. At the same time, it avoids a candidate test interface being associated with a large number of candidate test cases, thereby improving the performance of the candidate test interface.

[0082] S220: Determine candidate test cases according to the parameter configuration file and the parameter program template.

[0083] Exemplarily, according to the parameter configuration file, the parameter program template is updated to obtain the parameter running program, and the parameter running program is executed to obtain the candidate test case. The parameter running program can be used to read the parameter configuration file to obtain the candidate test case. The candidate output parameters in the candidate test case can be determined based on the result of the parameter running program.

[0084] In the embodiment of the present invention, after determining the candidate test case, the candidate test case is uploaded to the API open platform; the API management side in the API open platform performs case verification on the candidate test case; after the verification passes, the candidate test case is bound to the corresponding candidate test interface. The case verification may include performing repeatability verification on the candidate test case.

[0085] S230: Obtain a test case calling request for the program to be tested, and determine a request parameter value range of a request parameter in the test case calling request.

[0086] S240: Determine a request type of the test case retrieval request according to the request parameter value range and a preset case parameter value range set.

[0087] The case parameter value range set is determined according to the case parameter information obtained from the candidate test case associated with the candidate test interface.

[0088] S250: If the request type is a case-matchable type, match the request parameters with the candidate input parameters of each candidate test case to determine whether the target input parameters exist.

[0089] Among them, the candidate test cases are determined according to the configuration file template and the parameter program template.

[0090] S260: If so, the candidate test case corresponding to the target input parameter is used as the target test case, so as to test the program to be tested through the target test case.

[0091] The embodiment of the present invention provides a program testing scheme based on sandbox test cases, which improves the mechanism for determining candidate test cases by determining parameter configuration files according to test requirements and configuration file templates, and determining candidate test cases according to parameter configuration files and parameter program templates. The above scheme, by determining parameter configuration files according to test requirements and configuration file templates, and then determining candidate test cases according to parameter configuration files and parameter program templates, realizes standardized management of test case parameters and improves the configuration efficiency of candidate test cases.

[0092] Embodiment 3

[0093] The embodiment of the present invention provides an optional example based on the above embodiment. It should be noted that for the part not described in detail in the embodiment of the present invention, reference can be made to the description of other embodiments.

[0094] The existing sandbox environment cannot perform correctness checks on the legality of request messages, the accuracy of request parameters, etc., and cannot assist developers in quickly completing interface instance calls. It cannot reduce the dependence on manual work and environmental configuration during development and joint testing, and cannot effectively improve the efficiency of development access and docking.

[0095] The purpose of the embodiment of the present invention is to use a lightweight configuration file to assist in quickly configuring sandbox test cases, support the rapid addition of test cases, improve the richness of sandbox environment test cases, and solve the problems of being unable to cross platforms and difficulty in managing test cases.

[0096] In the embodiment of the present invention, the Swagger open source tool can be used to generate candidate test cases for the API (Application Programming Interface) interface, parameter specifications and restrictions in the candidate test cases, mainly to perform detailed specification management on the constraints such as the field format, type, and range of the interface, so as to facilitate the sandbox baffle to read according to the format.

[0097] Exemplarily, candidate test cases are generated based on a parameter configuration file determined by a configuration file template, and the code annotation field information and range restrictions in the parameter configuration file are read through a parameter program template to form an interface call test case file (ie, candidate test case).

[0098] Exemplarily, on the API interface management side, the generated candidate test cases are imported and bound to the designated candidate test interface, supporting one candidate test interface to be bound to multiple candidate test cases. Specifically, the candidate test interface is bound to the candidate test case and uploaded through the test case management platform. After the operator selects the designated candidate test interface, the candidate test case is uploaded and submitted to the API interface management side for case verification. After the case verification passes, the candidate test case is bound to the corresponding candidate test interface. There is no upper limit on the number of candidate test cases bound to the candidate test interface. During joint testing, the case caller can view all candidate test cases bound to the called candidate test interface online and select the candidate test case to call.

[0099] Exemplarily, on the API sandbox baffle side, the sandbox baffle service memory is read according to the binding relationship between the candidate test interface and the candidate test case. When the API sandbox gateway forwards the test case call request, it matches the candidate input parameters in the candidate test case according to the request parameters of the test case call request, and first determines whether the request parameter value range matches the candidate parameter value range in the candidate test case. If the parameter check fails, it returns to the case caller "the parameter input is incorrect, and check xxx related parameters"; if the parameter check passes, and the relevant request parameters match the candidate input parameters of a candidate test case completely, it returns the first matching target test case to the case caller; if the parameter match fails, it informs the case caller "there is no matching test case, please check the input parameters".

[0100] Exemplarily, the test case caller can view the candidate test cases bound to the candidate test interface and the target test cases on the API display page, so as to facilitate the call to the sandbox environment API gateway for test verification.

[0101] For example, see Figure 3 The structural diagram of the API open platform is shown. Among them, the API open platform includes API display and API management in the production environment, API gateway in the sandbox environment, and API sandbox baffle located in the back-end application. Among them, API display can be used to display the candidate test cases bound to each candidate test interface, and the target test case determined according to the test case call request. API management can be used to manage candidate test interfaces and candidate test cases bound to candidate test interfaces. The API gateway in the sandbox environment can be used to forward the test case call request to the API sandbox baffle. The API sandbox baffle can be used to determine the target test case according to the test case call request.

[0102] A program testing method based on sandbox test cases provided by an embodiment of the present invention can verify the legality of test case call requests and the accuracy of request parameters, and can quickly help developers find relatively low-level problems during development and joint testing, reducing reliance on manual consultation; candidate test cases can be quickly generated, support rapid import, and can be transplanted and used across platforms without the need for secondary development.

[0103] It should be noted that the information collected in the embodiments of the present invention is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse; if the user chooses to refuse, the expert decision-making process will be entered.

[0104] Embodiment 4

[0105] Figure 4 This is a structural diagram of a program testing device based on sandbox test cases provided in Example 4 of the present invention. This embodiment can be applied to determining test cases in a sandbox environment to test programs through test cases. The method can be executed by a program testing device based on sandbox test cases. The device can be implemented in software and / or hardware and can be configured in an electronic device that carries a program testing function based on sandbox test cases.

[0106] like Figure 4 As shown, the device is configured in a sandbox baffle. The device includes: a request parameter value range determination module 310, a request type determination module 320, a target input parameter determination module 330 and a target test case determination module 340. Among them,

[0107] The request parameter value range determination module 310 is used to obtain a test case call request of the program to be tested, and determine a request parameter value range of a request parameter in the test case call request;

[0108] A request type determination module 320, configured to determine the request type of the test case call request according to the request parameter value range and a preset case parameter value range set; wherein the case parameter value range set is determined according to the case parameter information obtained from the candidate test case associated with the candidate test interface;

[0109] A target input parameter determination module 330 is used to match the request parameter with the candidate input parameters of each candidate test case to determine whether the target input parameter exists if the request type is a case-matchable type; wherein the candidate test case is determined according to the configuration file template and the parameter program template;

[0110] The target test case determination module 340 is configured to use the candidate test case corresponding to the target input parameter as the target test case if it exists, so as to test the program to be tested through the target test case.

[0111] An embodiment of the present invention provides a program testing scheme based on sandbox test cases, which obtains a test case call request of a program to be tested and determines a request parameter value range of a request parameter in the test case call request; determines a request type of the test case call request according to the request parameter value range and a preset case parameter value range set; wherein the case parameter value range set is determined according to case parameter information obtained from a candidate test case associated with a candidate test interface; if the request type is a case-matchable type, matches the request parameters with candidate input parameters of each candidate test case to determine whether a target input parameter exists; wherein the candidate test case is determined according to a configuration file template and a parameter program template; if so, uses the candidate test case corresponding to the target input parameter as a target test case, so as to test the program to be tested through the target test case. The above scheme verifies the request parameters in the test case call request according to the case parameter value range set and the request parameter value range, determines the request type of the test case call request, and when the verification passes, that is, the request type is a case-matchable type, then matches the request parameters with the candidate input parameters of each candidate test case respectively, thereby avoiding directly matching the request parameters in the test case call request with the candidate input parameters of each candidate test case, reducing the possibility of parameter matching failure, and improving the accuracy and reliability of the test case call request; at the same time, the request parameters are matched with the candidate input parameters of each candidate test case to determine the target input parameters, and then the target test case is determined, thereby improving the accuracy of the determined target test case; and, the candidate test case is determined according to the configuration file template and the parameter program template, thereby improving the efficiency of determining the candidate test case.

[0112] Optionally, the candidate test cases are determined based on the following means:

[0113] A parameter configuration file determination module is used to determine the parameter configuration file according to the test requirements and the configuration file template;

[0114] The candidate test case determination module is used to determine the candidate test cases according to the parameter configuration file and the parameter program template.

[0115] Optionally, the parameter configuration file determination module includes:

[0116] A reference test interface determination unit, configured to determine a test scenario and test parameter association data according to a test requirement, and determine a reference test interface from candidate test interfaces according to the test scenario;

[0117] A case quantity determination unit, used to determine the case quantity of the candidate test cases associated with the reference test interface;

[0118] a target test interface determining unit, configured to determine a target test interface from the reference test interfaces according to the number of cases;

[0119] The parameter configuration file determining unit is used to determine the parameter configuration file according to the interface identifier of the target test interface, the test parameter association data and the configuration file template.

[0120] Optionally, the request type determination module 320 includes:

[0121] a parameter value range matching unit, configured to determine whether there is a reference parameter value range matching the request parameter value range in the case parameter value range set;

[0122] The case matchable type determining unit is used to determine, if any, that the request type of the test case call request is a case matchable type.

[0123] Optionally, the target input parameter determination module 330 includes:

[0124] A case ranking result determination unit, used to sort the candidate test cases according to the case file identifier of each candidate test case to obtain a case ranking result;

[0125] A parameter matching unit, configured to match the request parameter sequence with the candidate input parameters of each of the candidate test cases according to the case sorting result;

[0126] The parameter matching success unit is used to determine the existence of the target input parameter if the matching result is a successful match.

[0127] Optionally, the target test case determination module 340 includes:

[0128] The target test case determination unit is used to take the first successfully matched candidate input parameter as the target input parameter according to the case sorting result, and take the candidate test case corresponding to the target input parameter as the target test case.

[0129] The program testing device based on sandbox test cases provided in an embodiment of the present invention can execute the program testing method based on sandbox test cases provided in any embodiment of the present invention, and has functional modules and beneficial effects corresponding to executing each program testing method based on sandbox test cases.

[0130] In the technical solution of the present invention, the collection, storage, use, processing, transmission, provision and disclosure of test case retrieval requests, test requirements, configuration file templates and parameter program templates involved all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0131] According to an embodiment of the present invention, the present invention also provides an electronic device, a readable storage medium and a computer program product.

[0132] Embodiment 5

[0133] Figure 5 It is a structural diagram of an electronic device for implementing a program testing method based on a sandbox test case provided by Embodiment 5 of the present invention. Electronic device 410 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0134] like Figure 5 As shown, the electronic device 410 includes at least one processor 411, and a memory connected to the at least one processor 411 in communication, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 411 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or the computer program loaded from the storage unit 418 to the random access memory (RAM) 413. In the RAM 413, various programs and data required for the operation of the electronic device 410 can also be stored. The processor 411, the ROM 412, and the RAM 413 are connected to each other via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0135] Multiple components in the electronic device 410 are connected to the I / O interface 415, including: an input unit 416, such as a keyboard, a mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a disk, an optical disk, etc.; and a communication unit 419, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 419 allows the electronic device 410 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0136] Processor 411 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. Processor 411 executes the various methods and processes described above, such as a program testing method based on a sandbox test case.

[0137] In some embodiments, the program testing method based on the sandbox test case can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 418. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 410 via the ROM 412 and / or the communication unit 419. When the computer program is loaded into the RAM 413 and executed by the processor 411, one or more steps of the program testing method based on the sandbox test case described above can be performed. Alternatively, in other embodiments, the processor 411 can be configured to execute the program testing method based on the sandbox test case by any other appropriate means (e.g., by means of firmware).

[0138] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0139] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0140] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0141] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0142] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0143] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0144] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.

[0145] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A program testing method based on sandbox test cases, characterized in that: Applied to a sandbox baffle, the method comprises: Obtaining a test case call request for the program to be tested, and determining a request parameter value range of a request parameter in the test case call request; Determine the request type of the test case call request according to the request parameter value range and a preset case parameter value range set; wherein the case parameter value range set is determined according to case parameter information obtained from the candidate test case associated with the candidate test interface; If the request type is a case-matchable type, the request parameters are matched with candidate input parameters of each candidate test case to determine whether a target input parameter exists; wherein the candidate test case is determined according to a configuration file template and a parameter program template; If so, the candidate test case corresponding to the target input parameter is used as the target test case, so as to test the program to be tested through the target test case.

2. The method according to claim 1, characterized in that: The candidate test cases are determined based on the following: Determine the parameter configuration file based on the test requirements and configuration file template; Determine candidate test cases based on the parameter configuration file and the parameter program template.

3. The method according to claim 2, characterized in that Determining the parameter configuration file according to the test requirements and the configuration file template includes: Determine test scenarios and test parameter association data according to test requirements, and determine reference test interfaces from candidate test interfaces according to the test scenarios; Determining the number of candidate test cases associated with the reference test interface; Determining a target test interface from the reference test interfaces according to the number of cases; A parameter configuration file is determined according to the interface identifier of the target test interface, the test parameter association data and the configuration file template.

4. The method according to claim 1, characterized in that: The determining the request type of the test case call request according to the request parameter value range and a preset case parameter value range set includes: Determining whether there is a reference parameter value range in the case parameter value range set that matches the request parameter value range; If so, it is determined that the request type of the test case call request is a case-matchable type.

5. The method according to claim 1, characterized in that The step of matching the request parameter with the candidate input parameter of each candidate test case to determine whether the target input parameter exists includes: Sorting the candidate test cases according to the case file identifiers of the candidate test cases to obtain case sorting results; According to the case sorting result, matching the request parameter sequence with the candidate input parameters of each of the candidate test cases; If the matching result is a successful match, it is determined that the target input parameter exists.

6. The method according to claim 5, characterized in that The step of taking the candidate test case corresponding to the target input parameter as the target test case includes: According to the case sorting result, the first successfully matched candidate input parameter is used as the target input parameter, and the candidate test case corresponding to the target input parameter is used as the target test case.

7. A program testing device based on a sandbox test case, characterized in that: Configured on a sandbox baffle, the device comprises: A request parameter value range determination module, used to obtain a test case call request of a program to be tested, and determine a request parameter value range of a request parameter in the test case call request; A request type determination module, used to determine the request type of the test case call request according to the request parameter value range and a preset case parameter value range set; wherein the case parameter value range set is determined according to the case parameter information obtained from the candidate test case associated with the candidate test interface; a target input parameter determination module, for matching the request parameter with the candidate input parameters of each candidate test case to determine whether the target input parameter exists if the request type is a case-matchable type; wherein the candidate test case is determined according to a configuration file template and a parameter program template; The target test case determination module is used to take the candidate test case corresponding to the target input parameter as the target test case if it exists, so as to test the program to be tested through the target test case.

8. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement a program testing method based on a sandbox test case as described in any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, a program testing method based on a sandbox test case as described in any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the steps of the program testing method based on sandbox test cases according to any one of claims 1 to 6 are implemented.