Interface verification method, device, storage medium and electronic equipment

By obtaining the interface return value template and making an interface call, the actual return result is quickly compared with the expected result, which solves the problem of slow interface verification and low efficiency in the existing technology and realizes efficient interface verification.

CN114416557BActive Publication Date: 2025-09-19SHENZHEN PING AN MEDICAL HEALTH TECHNOLOGY SERVICES CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210056054.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-18
Publication Date
2025-09-19
Estimated Expiration
2042-01-18

AI Technical Summary

Technical Problem

In the existing technology, the interface inspection/verification speed is slow and the efficiency is low, especially when multiple hospital systems are online at the same time, the manual verification speed is slow and the efficiency is low.

Method used

By obtaining the target return value template corresponding to the target interface to be tested, calling the interface using a predetermined interface calling method, obtaining the actual return result, and comparing the actual return result with the expected return result, the interface verification result is obtained.

Benefits of technology

It realizes fast interface verification, saves verification time and improves the efficiency of interface verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416557B_ABST
    Figure CN114416557B_ABST
Patent Text Reader

Abstract

The present application discloses an interface verification method, device, storage medium and electronic device, wherein the method includes: based on a target test project, determining a number of target test interfaces contained in the target test project; obtaining a target return value template corresponding to each target test interface; based on each target return value template, using a predetermined interface calling method, calling each target test interface to obtain an actual return result corresponding to each target test interface; comparing the actual return result corresponding to each target test interface with the expected return result in the corresponding return value template to obtain the verification result of each interface. The method in the present application compares the actual return result returned after calling the interface with the initial expected return result entered in advance, and realizes the verification of the interface according to the comparison result, thereby solving the problems of slow verification speed and low efficiency in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software testing technology, and in particular to an interface verification method, device, storage medium, and electronic device. Background Art

[0002] In the current insurance claims process, social commerce platforms, often connected to hospital systems, are used to obtain patient medical data from hospital systems and then provide feedback to insurance companies. This allows insurers to quickly obtain patient medical data, such as hospitalizations and visits, and facilitate subsequent insurance claims based on this data. Therefore, accurate data acquisition is crucial. Therefore, before the social commerce platform and hospital systems are officially put into use, they must be verified to determine whether they can accurately provide patient medical data.

[0003] However, existing verification methods mostly rely on manual verification. This involves connecting the insurance company and the social business platform. The insurance company initiates a medical record and customer identity verification interface. The social business platform retrieves the patient's bill, medical history, and discharge settlement information, returns it to the insurance company, and then manually verifies the data for accuracy. However, due to the large number of hospitals online, multiple systems and interfaces are involved. If more than 100 hospitals are online simultaneously, manually checking and verifying each hospital one by one would result in slow and inefficient verification.

[0004] Therefore, there is an urgent need for an interface verification method to solve the problem of slow interface troubleshooting / verification speed and low efficiency in the prior art. Summary of the Invention

[0005] In view of this, the present invention provides an interface verification method, device, storage medium and electronic device, the main purpose of which is to solve the problem of slow interface troubleshooting / verification speed and low efficiency in the existing technology.

[0006] To solve the above problems, the present application provides an interface verification method, including:

[0007] Based on the target test item, determining a number of target to-be-tested interfaces included in the target test item;

[0008] Obtaining a target return value template corresponding to each target interface to be tested;

[0009] Based on each target return value template, a predetermined interface calling method is adopted to call each target interface to be tested, and an actual return result corresponding to each target interface to be tested is obtained;

[0010] The actual return result corresponding to each target interface to be tested is compared with the expected return result in the corresponding return value template to obtain the verification result of each target interface to be tested.

[0011] Optionally, before determining a number of target test interfaces included in the target test item based on the target test item, the method further includes: configuring a corresponding return value template for each test interface, specifically including:

[0012] Acquire initial expected return results and data labels corresponding to each of the initial expected return results based on the test data;

[0013] Based on the interface attributes of each of the interfaces to be tested, obtaining the expected return result corresponding to each of the interfaces to be tested;

[0014] A corresponding return value template is configured for each interface to be tested based on the expected return result, interface tag, and data tag corresponding to each interface to be tested.

[0015] Optionally, obtaining a target return value template corresponding to each target interface to be tested specifically includes:

[0016] Based on the interface label of each target interface to be tested, a target return value template corresponding to each target interface to be tested is determined.

[0017] Optionally, the method further includes: calling each target interface to be tested by using a predetermined interface calling method based on each target return value template, specifically including:

[0018] Based on each of the target return value templates and each of the target to-be-tested interfaces, obtaining a target test script;

[0019] Each of the target test interfaces is called based on the target test script.

[0020] Optionally, the actual return result corresponding to each target interface to be tested is compared with the expected return result in the corresponding return value template to obtain the verification result of each interface to be tested, specifically including: based on each interface label, the actual return result corresponding to the interface label is compared with the expected return result in the corresponding return value template.

[0021] Optionally, the method further comprises: storing each of the return value templates in a target storage area;

[0022] The comparing, based on each of the interface tags, the actual return result corresponding to the interface tag with the expected return result in the corresponding return value template specifically includes:

[0023] Based on the interface tag corresponding to each of the actual return results, using a target call instruction to obtain a return value template corresponding to each of the actual return results from the target storage area;

[0024] The actual return result is compared with the expected return result in the return value template corresponding to the actual return result.

[0025] To solve the above problems, the present application provides an interface verification device, comprising:

[0026] A determination module, configured to determine, based on a target test item, a number of target to-be-tested interfaces included in the target test item;

[0027] An acquisition module, configured to acquire a target return value template corresponding to each target interface to be tested;

[0028] A calling module, configured to call each of the target test interfaces using a predetermined interface calling method based on each of the target return value templates, and obtain an actual return result corresponding to each of the target test interfaces;

[0029] The verification module is used to compare the actual return result corresponding to each target interface to be tested with the expected return result in the corresponding return value template to obtain the verification result of each target interface to be tested.

[0030] The interface verification device also includes a configuration module, which is used to: obtain the initial expected return result and the data tag corresponding to each initial expected return result based on the test data; obtain the expected return result corresponding to each interface to be tested based on the interface properties of each interface to be tested; and configure a corresponding return value template for each interface to be tested based on the expected return result, interface tag and data tag corresponding to each interface to be tested.

[0031] To solve the above problems, the present application provides a storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps of any of the above-mentioned interface verification methods.

[0032] To solve the above problems, the present application provides an electronic device, which includes at least a memory and a processor, wherein a computer program is stored on the memory, and the processor implements the steps of any of the above-mentioned interface verification methods when executing the computer program on the memory.

[0033] The interface verification method, device, storage medium and electronic device in the present application obtain the target return value template corresponding to the target interface to be tested. Therefore, a predetermined interface calling method can be used to call each interface based on the target return value template to quickly obtain the actual return result corresponding to each interface. This can quickly compare the actual return result of each interface with the expected return result in the return value template corresponding to each interface, that is, quickly determine whether the actual return result returned by each interface is consistent with the expected return result, thereby realizing rapid verification of each interface, saving interface verification time, and improving the efficiency of interface verification.

[0034] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are specifically listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Various other advantages and benefits will become apparent to those skilled in the art upon reading the detailed description of the preferred embodiment below. The accompanying drawings are for illustration purposes only and are not to be considered as limiting the present invention. The same reference symbols are used throughout the drawings to represent the same components. In the drawings:

[0036] Figure 1 This is a flow chart of an interface verification method according to an embodiment of the present application;

[0037] Figure 2 This is a flowchart of an interface verification method according to another embodiment of the present application;

[0038] Figure 3 This is a structural block diagram of an interface verification device according to another embodiment of the present application. DETAILED DESCRIPTION

[0039] Various aspects and features of the present application are described herein with reference to the accompanying drawings.

[0040] It should be understood that various modifications may be made to the embodiments of the present application. Therefore, the above description should not be considered as limiting, but merely as an example of an embodiment. Other modifications within the scope and spirit of the present application will occur to those skilled in the art.

[0041] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.

[0042] These and other characteristics of the present application will become apparent from the following description of a preferred form of embodiment given as a non-limiting example with reference to the accompanying drawings.

[0043] It should also be understood that although the present application has been described with reference to certain specific examples, those skilled in the art will readily be able to implement many other equivalent forms of the present application.

[0044] The above and other aspects, features and advantages of the present application will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings.

[0045] Specific embodiments of the present application will be described hereinafter with reference to the accompanying drawings; however, it should be understood that the embodiments described are merely examples of the present application and may be implemented in a variety of ways. Familiar and / or repetitive functions and structures are not described in detail to avoid obscuring the present application with unnecessary or redundant details. Therefore, the specific structural and functional details described herein are not intended to be limiting, but rather serve merely as a basis and representative basis for the claims to teach those skilled in the art to variously utilize the present application with substantially any suitable detailed structure.

[0046] This specification may use the phrases "in one embodiment," "in another embodiment," "in yet another embodiment," or "in other embodiments," which may all refer to one or more of the same or different embodiments according to the present application.

[0047] The present application embodiment provides an interface verification method, such as Figure 1 As shown, the specific steps include:

[0048] Step S101: Based on a target test item, determining a number of target to-be-tested interfaces included in the target test item;

[0049] During the specific implementation of this step, the target test project specifically refers to the test task of testing the various interfaces of the hospital system, or the test task of testing the various interfaces of the social business platform system.

[0050] Step S102: obtaining a target return value template corresponding to each target interface to be tested;

[0051] During the specific implementation process of this step, the target return value template corresponding to each target interface to be tested is determined based on the interface label of each target interface to be tested.

[0052] Step S103: Based on each target return value template, a predetermined interface calling method is adopted to call each target interface to be tested, and an actual return result corresponding to each target interface to be tested is obtained;

[0053] In the specific implementation process of this step, the calling method can specifically be a target test script, that is, before calling each of the target interfaces to be tested, the target test script can be obtained based on each of the target return value templates and each of the target interfaces to be tested. Specifically, when obtaining the target test script, the target test script can be written through jmeter (a Java-based stress testing tool). Among them, the process of obtaining the target test script is: first, create a request test script under the thread group of jmeter, fill in the target return value template corresponding to each target test interface into the script, and obtain the target test script. The specific implementation process of calling each of the target interfaces to be tested based on the target test script is: first, create a loop controller, move the target test script to the loop controller, and let the script run in a loop to obtain the corresponding actual return results.

[0054] Step S104: Compare the actual return result corresponding to each target interface to be tested with the expected return result in the corresponding return value template to obtain the verification result of each target interface to be tested.

[0055] During the specific implementation of this step, first, based on the interface tag corresponding to each actual return result, the target call instruction is used to obtain the return value template corresponding to each actual return result from the target storage area. Specifically, first: the actual return result is parsed into the target storage area; based on the interface tag corresponding to the actual return result, the pre-entered return value template is found; then, based on the position of the expected return result of the return value template, the corresponding expected return result is determined; then, the actual return result is compared with the corresponding expected return result to obtain a comparison result of whether the two are consistent. If the two are consistent, a verification result of a normal interface is obtained; if the two are inconsistent, a verification result of an abnormal interface is obtained.

[0056] In this embodiment, by obtaining the target return value template corresponding to the target interface to be tested, a predetermined interface calling method can be used to call each interface based on the target return value template, so as to quickly obtain the actual return result corresponding to each interface. This allows for rapid comparison based on the actual return result of each interface and the expected return result in the return value template corresponding to each interface, that is, to quickly determine whether the actual return result returned by each interface is consistent with the expected return result, thereby achieving rapid verification of each interface, saving interface verification time, and improving the efficiency of interface verification.

[0057] Another embodiment of the present application provides an interface verification method, such as Figure 2 As shown, the following steps are included:

[0058] Step S201: configuring a corresponding return value template for each interface to be tested;

[0059] During the specific implementation of this step, first, based on the test data, an initial expected return result and data labels corresponding to each of the initial expected return results are obtained. The test data can specifically be invoice data from patient reimbursement. The test data / invoice data includes several fields and data corresponding to each field. For example, the fields may include hospital name, patient name, examination fee, laboratory test fee, treatment fee, etc.; the data may include: Hospital A corresponding to the hospital name field, Zhang San corresponding to the patient name, etc. The initial expected return result specifically refers to the data corresponding to each field in the test data. For example, if the hospital name field corresponds to Hospital A, the initial expected result obtained is "Hospital A"; if the patient name field corresponds to Zhang San, the initial expected return result obtained under the patient name field is Zhang San; if the data corresponding to the bed fee amount field is 200.00 yuan, the initial expected return result obtained for the bed fee amount field is 200.00 yuan. During the specific implementation, the field information may also include examination fee, examination fee, laboratory test fee, treatment fee, surgery fee, nursing fee, material fee, etc., depending on the patient's examination items. During the specific implementation of this step, a batch of test data as described above can be pre-entered, and the corresponding initial expected return results and data tags corresponding to each initial expected return result can be obtained. The initial expected return results are then stored in a target storage area, with the initial expected return results being accompanied by data tags. The data tags are used to uniquely characterize the test data, and can be, for example, the patient's ID number, name, etc. in the test data.

[0060] Secondly: based on the interface attributes of each interface to be tested, obtain the expected return result corresponding to each interface to be tested. The interface attributes are determined according to the test items, that is, different test items correspond to different interface attributes, and the data types returned by interfaces with different interface attributes are different. For example, the interface attribute of each interface in the test item of the hospital system is the first attribute, and the data type returned by each interface under the first attribute can be a numeric type; for another example, the interface attribute of each interface in the test item of the social business platform system is the second attribute, and the data type returned by each interface under the second attribute can be a character type. In the specific implementation process of this step, after obtaining the initial expected return result, the target data type can be determined according to the interface attributes of each interface to be tested, and then each initial expected return result is converted into an expected return result corresponding to the target data type according to the target data type. Then, according to the target field information corresponding to each interface, that is, the data information corresponding to which fields are returned by each interface user, at least one expected return result corresponding to each interface is determined from each expected return result. That is, for example, interface A corresponds to the medical records interface, and the target field information corresponding to the medical records interface is the patient's basic information, including field information such as patient name, patient ID number, patient gender, date of birth, contact number, and contact address; interface B corresponds to the billing interface, and the field information corresponding to the billing interface includes hospital name, hospitalization number, patient name, department, bed, category (department), total cost, number of days in hospital, and items (medication fees, material fees, examination fees, and laboratory fees). Therefore, based on the first attribute of interface A, the expected return result of the numeric type corresponding to the field information such as patient name, patient ID number, patient gender, date of birth, contact number, and contact address can be configured to interface A, thereby obtaining the expected return result corresponding to interface A. Similarly, based on the second attribute of interface B, the expected return result of the character type corresponding to the field information such as hospital name, hospitalization number, patient name, department, bed, category (department), total cost, number of days in hospital, and items (medication fees, material fees, examination fees, and laboratory fees) can be configured to interface B, thereby obtaining the expected return result corresponding to interface B. In this embodiment, the hospital system may also include, for example, a case interface and a discharge settlement interface.

[0061] Again: configure a corresponding return value template for each interface to be tested based on the expected return result, interface label and data label corresponding to each interface to be tested. That is, after obtaining the expected return result corresponding to each interface, the corresponding data label can be determined according to the expected return result, and then the return value template corresponding to the interface can be obtained by further combining the interface label of the interface and the field information corresponding to the interface. In specific implementation, for the same interface, a set of expected return results corresponding to each test data can be obtained based on a number of test data, and then multiple return value templates containing different expected return result sets can be configured according to each expected return result set and the data label corresponding to each set. In this step, the return value template can use the json format (JavaScript Object Notation, a lightweight data exchange format), and the data between interfaces is transmitted in json format. The return value template contains the field information corresponding to the expected result. In this embodiment, the return value template formats (field information and data types of data information) corresponding to the interface to be tested in the hospital system and the interface to be tested in the social business platform system are different. For example, for the field information of the patient's name, the data type corresponding to the social business system interface is the first type, which can be specifically name; the data type corresponding to the hospital system interface is the second data type, which can be specifically aa01.

[0062] During the specific implementation of this step, after configuring the corresponding return value template for each interface to be tested, the return value template can also be stored in the target storage area, laying the foundation for subsequently obtaining the return value template from the target storage area, comparing the actual return result based on the expected return result in the return value template, and verifying whether the interface to be tested is abnormal.

[0063] Step S202: Based on the target test item, determine a number of target to-be-tested interfaces included in the target test item;

[0064] During the specific implementation of this step, the target test project specifically refers to the test task of testing the various interfaces of the hospital system, or the test task of testing the various interfaces of the social business platform system.

[0065] Step S203: obtaining a target return value template corresponding to each target interface to be tested;

[0066] In the specific implementation process, this step determines the target return value template corresponding to each target interface to be tested based on the interface label of each target interface to be tested. Specifically, the target return value template can be obtained from a predetermined target storage location.

[0067] Step S204: using a predetermined interface calling method based on each target return value template to call each target interface to be tested, and obtaining an actual return result corresponding to each target interface to be tested;

[0068] In the specific implementation process of this step, the calling method can specifically be a target test script, that is, before calling each of the target interfaces to be tested, the target test script can be obtained based on the target return value template and each of the target interfaces to be tested. Specifically, when obtaining the target test script, the target test script can be written through jmeter (a Java-based stress testing tool). First, a request test script is created under the thread group of jmeter, and the target return value template corresponding to each target test interface is filled in the script to obtain the target test script. Since the target return value template contains the data label of the test data, each interface to be tested can be called based on the target test script to obtain the actual return result returned by each interface to be tested for the data label. Based on the target test script, each target interface to be tested is called, and the specific implementation process is: first, a loop controller is created, the target test script is moved to the loop controller, and the script is run in a loop to obtain the actual return result corresponding to the data label. For example: the expected return result corresponding to the hospital name field is hospital A. Enter A=#(hospital A) on the target test script, where hospital A is the expected return result. The data label corresponding to hospital A is, for example, the patient's ID number 0000001. Then let the script run in a loop to obtain the actual return results such as hospitalization fees and medical expenses fed back by each target test interface for the patient's ID number 0000001. In this embodiment, the expected return result in the return value template can be specifically identified by the #() identifier. Each time a test is conducted, it is only necessary to modify the expected return result in the brackets according to the test data. When entering the expected return result, only the field information of concern can be entered. For example, only three field information out of N fields need to be concerned, where N is an integer greater than or equal to 0. Then only the expected return results of the three field information are entered. The results of other fields that do not have the expected return results entered will not be compared, thereby improving comparison efficiency.

[0069] Step S205: Compare the actual return result corresponding to each target interface to be tested with the expected return result in the corresponding return value template to obtain the verification result of each target interface to be tested.

[0070] During the specific implementation of this step, based on the interface tag corresponding to each actual return result, a target call instruction is first used to retrieve the return value template corresponding to each actual return result from the target storage area. The target call instruction can specifically be a call statement in the target test script. Specifically, the actual return result is first parsed into the target storage area. Based on the interface tag corresponding to the actual result, the return value template and the expected return result pre-entered in step S201 are located. Specifically, the return value template and the expected return result can be retrieved from the target storage area. The actual return result is then parsed. Finally, the actual return result is compared with the expected return result in the return value template corresponding to the actual return result. For example, if the expected return result is Hospital A, but the actual return result is Hospital B, the expected return result and the actual return result do not match. The interface under test that returned the actual return result is judged to be abnormal. For another example, if the expected return result corresponding to the hospital name field is Hospital B, the expected return result corresponding to the patient name field is Zhang San, and the expected return result corresponding to the hospitalization fee field is 10,000 yuan, and the actual return result is consistent with the expected return result, then the corresponding interface under test is normal and can accurately return the corresponding data. If the actual return results for the hospital name field and the patient name field are the same as the expected return results, but the actual return result for the hospitalization fee field is 5,000 yuan, which is inconsistent with the expected return result, then it is necessary to mark the actual return result of the hospitalization fee as inconsistent with the expected return result, and the verification result of the interface to be tested is abnormal. By marking the inconsistent fields, the fields of concern can be clearly identified, allowing testers to clearly understand which fields of information returned by which interfaces are correct and which fields of information returned by which interfaces are incorrect. This allows targeted troubleshooting and lays the foundation for subsequent correction and debugging of the system interface.

[0071] In this embodiment, by obtaining the target return value template corresponding to the target interface to be tested, a predetermined interface calling method can be used to call each interface based on the target return value template, so as to quickly obtain the actual return result corresponding to each interface. This allows for rapid comparison based on the actual return result of each interface and the expected return result in the return value template corresponding to each interface, that is, to quickly determine whether the actual return result returned by each interface is consistent with the expected return result, thereby achieving rapid verification of each interface, saving interface verification time, and improving the efficiency of interface verification.

[0072] Another embodiment of the present application provides an interface verification device, such as Figure 3 Shown, including:

[0073] Determining module 1: used to determine a number of target test interfaces included in the target test item based on the target test item;

[0074] Acquisition module 2, used to obtain the target return value template corresponding to each target interface to be tested;

[0075] A calling module 3 is configured to call each target interface to be tested using a predetermined interface calling method based on each target return value template, and obtain an actual return result corresponding to each target interface to be tested;

[0076] The verification module 4 is used to compare the actual return result corresponding to each target interface to be tested with the expected return result in the corresponding return value template to obtain the verification result of each target interface to be tested.

[0077] The interface verification device in this embodiment also includes a configuration module, which is used to: obtain the initial expected return result and the data label corresponding to each initial expected return result based on the test data; obtain the expected return result corresponding to each interface to be tested based on the interface properties of each interface to be tested; and configure a corresponding return value template for each interface to be tested based on the expected return result, interface label and data label corresponding to each interface to be tested.

[0078] The interface verification device in this embodiment also includes a configuration module, which is used to: configure a corresponding return value template for each interface to be tested before determining several target interfaces to be tested included in the target test project based on the target test project; the configuration module is specifically used to: obtain the initial expected return result and the data label corresponding to each initial expected return result based on the test data; obtain the expected return result corresponding to each interface to be tested based on the interface attributes of each interface to be tested; and configure a corresponding return value template for each interface to be tested based on the expected return result, interface label and data label corresponding to each interface to be tested.

[0079] In the specific implementation process of this embodiment, the acquisition module is specifically used to: determine the target return value template corresponding to each target interface to be tested based on the interface label of each target interface to be tested.

[0080] In the specific implementation process of this embodiment, the calling module is specifically used to: obtain the target test script based on each of the target return value templates and each of the target interfaces to be tested; and call each of the target interfaces to be tested based on the target test script.

[0081] In the specific implementation process of this embodiment, the verification module is specifically used to: based on each interface tag, compare the actual return result corresponding to the interface tag with the expected return result in the corresponding return value template.

[0082] During the specific implementation of this embodiment, the verification device also includes a storage module, which is used to: store each of the return value templates in a target storage area; the verification module is specifically used to: based on the corresponding interface label of each of the actual return results, obtain the return value template corresponding to each of the actual return results from the target storage area using a target call instruction; and compare the actual return result with the expected return result in the return value template corresponding to the actual return result.

[0083] Another embodiment of the present application provides a storage medium storing a computer program. When the computer program is executed by a processor, the following method steps are implemented:

[0084] Step 1: Based on the target test item, determine a number of target test interfaces included in the target test item;

[0085] Step 2: Obtain the target return value template corresponding to each target interface to be tested;

[0086] Step 3: Based on each target return value template, a predetermined interface calling method is adopted to call each target interface to be tested, and an actual return result corresponding to each target interface to be tested is obtained;

[0087] Step 4: Compare the actual return result corresponding to each target interface to be tested with the expected return result in the corresponding return value template to obtain the verification result of each target interface to be tested.

[0088] The specific implementation process of the above method steps can be found in the embodiments of any of the above interface verification methods, and this embodiment will not be repeated here.

[0089] In this embodiment, by obtaining the target return value template corresponding to the target interface to be tested, a predetermined interface calling method can be used to call each interface based on the target return value template, so as to quickly obtain the actual return result corresponding to each interface. This allows for rapid comparison based on the actual return result of each interface and the expected return result in the return value template corresponding to each interface, that is, to quickly determine whether the actual return result returned by each interface is consistent with the expected return result, thereby achieving rapid verification of each interface, saving interface verification time, and improving the efficiency of interface verification.

[0090] Another embodiment of the present application provides an electronic device, comprising at least a memory and a processor, wherein the memory stores a computer program, and the processor implements the following method steps when executing the computer program in the memory:

[0091] Step 1: Based on the target test item, determine a number of target test interfaces included in the target test item;

[0092] Step 2: Obtain the target return value template corresponding to each target interface to be tested;

[0093] Step 3: Based on each target return value template, a predetermined interface calling method is adopted to call each target interface to be tested, and an actual return result corresponding to each target interface to be tested is obtained;

[0094] Step 4: Compare the actual return result corresponding to each target interface to be tested with the expected return result in the corresponding return value template to obtain the verification result of each target interface to be tested.

[0095] The specific implementation process of the above method steps can be found in the embodiments of any of the above interface verification methods, and this embodiment will not be repeated here.

[0096] In this embodiment, by obtaining the target return value template corresponding to the target interface to be tested, a predetermined interface calling method can be used to call each interface based on the target return value template, so as to quickly obtain the actual return result corresponding to each interface. This allows for rapid comparison based on the actual return result of each interface and the expected return result in the return value template corresponding to each interface, that is, to quickly determine whether the actual return result returned by each interface is consistent with the expected return result, thereby achieving rapid verification of each interface, saving interface verification time, and improving the efficiency of interface verification.

[0097] The above embodiments are merely exemplary embodiments of the present application and are not intended to limit the scope of the present application. The scope of protection of the present application is defined by the claims. Those skilled in the art may make various modifications or equivalent substitutions to the present application within the essence and scope of protection of the present application, and such modifications or equivalent substitutions shall also be deemed to fall within the scope of protection of the present application.

Claims

1. An interface verification method, characterized in that: include: Obtaining initial expected return results and data tags corresponding to each of the initial expected return results based on test data, wherein the test data is invoice data for patient reimbursement, the initial expected return results are specifically data information corresponding to each field in the test data, and the data tags are used to uniquely characterize the test data; Determine a target data type according to the interface attributes of each interface to be tested, and convert each initial expected return result into an expected return result corresponding to the target data type according to the target data type to obtain an expected return result corresponding to each interface to be tested; Based on the expected return result corresponding to each of the interfaces to be tested, determining the corresponding data tag according to the expected return result, and obtaining the return value template corresponding to the interface in combination with the interface tag of the interface and the field information corresponding to the interface; Based on the target test item, determining a number of target to-be-tested interfaces included in the target test item; Determining a target return value template corresponding to each target interface to be tested based on the interface label of each target interface to be tested; Based on each target return value template, a predetermined interface calling method is adopted to call each target interface to be tested, and an actual return result corresponding to each target interface to be tested is obtained; Compare the actual return result corresponding to each target interface to be tested with the expected return result in the corresponding return value template to obtain the verification result of each target interface to be tested; The method further comprises: determining a corresponding data tag based on the expected return result corresponding to each interface to be tested, and obtaining a return value template corresponding to the interface in combination with the interface tag and field information corresponding to the interface. For the same interface, based on several test data, the expected return result sets corresponding to each test data are obtained. According to each expected return result set and the data label corresponding to each set, multiple return value templates containing different expected return result sets are configured. The return value templates are in JSON format. After configuring the corresponding return value template for each interface to be tested, the return value template is stored in the target storage area.

2. The method according to claim 1, wherein The method of calling each target interface to be tested by using a predetermined interface calling method based on each target return value template specifically includes: Based on each of the target return value templates and each of the target to-be-tested interfaces, obtaining a target test script; Each of the target test interfaces is called based on the target test script.

3. The method according to claim 1, wherein Compare the actual return result corresponding to each target interface to be tested with the expected return result in the corresponding return value template to obtain the verification result of each interface to be tested, specifically including: based on each interface label, compare the actual return result corresponding to the interface label with the expected return result in the corresponding return value template.

4. The method according to claim 3, wherein The method further comprises: storing each of the return value templates in a target storage area; The comparing, based on each of the interface tags, the actual return result corresponding to the interface tag with the expected return result in the corresponding return value template specifically includes: Based on the interface tag corresponding to each of the actual return results, using a target call instruction to obtain a return value template corresponding to each of the actual return results from the target storage area; The actual return result is compared with the expected return result in the return value template corresponding to the actual return result.

5. An interface verification device, characterized in that: include: A configuration module is configured to obtain initial expected return results and data tags corresponding to each of the initial expected return results based on test data, wherein the test data is invoice data for patient reimbursement, the initial expected return results are specifically data information corresponding to each field in the test data, and the data tags are used to uniquely characterize the test data; determine a target data type based on the interface attributes of each interface to be tested, and convert each initial expected return result into an expected return result corresponding to the target data type based on the target data type to obtain an expected return result corresponding to each interface to be tested; Based on the expected return result corresponding to each of the interfaces to be tested, determining the corresponding data tag according to the expected return result, and obtaining the return value template corresponding to the interface in combination with the interface tag of the interface and the field information corresponding to the interface; A determination module, configured to determine, based on a target test item, a number of target to-be-tested interfaces included in the target test item; An acquisition module, configured to determine a target return value template corresponding to each target interface to be tested based on an interface tag of each target interface to be tested; A calling module, configured to call each of the target test interfaces using a predetermined interface calling method based on each of the target return value templates, and obtain an actual return result corresponding to each of the target test interfaces; A verification module is used to compare the actual return result corresponding to each target interface to be tested with the expected return result in the corresponding return value template to obtain the verification result of each target interface to be tested; The configuration module is specifically used to: for the same interface, obtain an expected return result set corresponding to each test data based on a number of test data, and configure and obtain multiple return value templates containing different expected return result sets according to each expected return result set and the data tag corresponding to each set, wherein the return value template is in JSON format; After configuring the corresponding return value template for each interface to be tested, the return value template is stored in the target storage area.

6. A storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the interface verification method according to any one of claims 1 to 4 are implemented.

7. An electronic device, characterized in that: The method comprises at least a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the interface verification method according to any one of claims 1 to 4 when executing the computer program in the memory.

Citation Information

Patent Citations

  • Interface test method and device, electronic equipment and storage medium

    CN111274131A