An interface test data pushing method and device
By selecting interface functions in the interface test system and obtaining data from the historical database, and updating the interface function library during the test process, the problems of low efficiency and low quality of interface test data processing are solved, and automated push and data quality improvement are achieved.
Patent Information
- Application Number
- CN202210146930.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-17
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2042-02-17
AI Technical Summary
The prior art has problems in the processing of interface test data, such as low efficiency, low data quality and low automation, especially the low efficiency of manual data construction, database operations do not consider business needs, and the random data generated by tools is not related to the business.
When generating a test script in the interface test system, at least one interface function is selected, historical data is selected from the historical database as push data, and the interface function library is updated by accumulating test data during the test operation.
Automatic push of test data is realized, which improves the quality of test data and the efficiency of test scripts, saves time to manually construct data, and improves the accuracy of data by constantly updating the function library.
Smart Images

Figure CN114519007B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the financial field, and specifically to an interface test data pushing method and device. Background Art
[0002] Currently, in the processing of interface test data, there are generally three existing solutions: one is to construct all test data for all test scripts manually and then execute the test scripts; the second is to directly construct interface test data by operating the database; the third is to automatically generate random test data through tool code and then execute the script.
[0003] The existing solutions mainly have the following deficiencies:
[0004] (1) In the way of manually constructing test data, although it can construct test data related to the actual business scenario, it does not effectively combine manual and automated methods and cannot effectively improve the efficiency of interface testing.
[0005] (2) Directly operating the database often requires bulk data creation, and the actual business requirements of test data are not considered during the data creation process. Therefore, the quality of test data and interface testing cannot be guaranteed.
[0006] (3) Automatically generating random test data through tool code can avoid duplicate test data, but the generated data is also not related to the actual test business and cannot achieve the purpose of automatically pushing test data according to the actual test business. Therefore, the quality of test data and the efficiency of the written test scripts cannot be guaranteed. Summary of the Invention
[0007] In view of the problems in the prior art, the first aspect of this application provides an interface test data pushing method, and the interface test data pushing method includes:
[0008] During the process of generating a test script in the interface test system, at least one interface function is selected from multiple interface function libraries according to the interface information of the generated test project; each interface function corresponds to a historical database one by one;
[0009] After the test script is generated, the corresponding historical database is called according to the interface function, historical data in the historical database is selected as the pushed data, and the pushed data and the test case script are jointly sent to the interface test system for test operations; and
[0010] During the test operation process, the interface function library is updated by accumulating the fields generated during the test.
[0011] In some embodiments, the interface information includes the names, business descriptions, and business description information of each interface field; the selecting of at least one interface function from multiple interface function libraries according to the interface information of the generated test items includes:
[0012] Extracting a plurality of business fields from the names, business descriptions, and business description information of the interface fields;
[0013] Selecting the corresponding interface function from the interface function library according to each business field.
[0014] In some embodiments, the method further includes:
[0015] During the test operation, obtaining the test data generated during the test and importing it into the historical database;
[0016] Updating the historical database based on the usage times of the test data in the historical database.
[0017] In some embodiments, the updating the historical database based on the usage times of the test data in the historical database includes:
[0018] For the test data imported into the historical database, querying the corresponding effective push times in the historical data construction table according to the parameter names, parameter types in the table constructed according to the corresponding historical data, and the test item identifiers corresponding to each test data;
[0019] Updating the corresponding effective push times in the historical data construction table by using a counter;
[0020] Sorting the test data in the historical database according to the effective push times to obtain a test data push sequence, retaining the test data before the set position in the test data push sequence, and further updating the historical database.
[0021] In some embodiments, according to the interface function to call the corresponding historical database, selecting the historical data in the historical database as the push data includes:
[0022] Searching for the test data identifier corresponding to the parameter name in the historical data construction table according to the business field in the interface function;
[0023] Calling the corresponding historical database according to the test data identifier, and using the test data before the preset position in the test data push sequence corresponding to the historical database in the historical data construction table as the push data.
[0024] In some embodiments, it further includes:
[0025] The interface function library includes multiple general business field functions and at least one special business field function. If the fields in the interface information do not include any general business field or special business field, a random string function is established.
[0026] An iterative operation is performed to generate an original random string. If the fields in the interface information do not include the random string, a new random string is regenerated and replaces the original random string until the fields in the interface information include the current random string, and the final random string function is added to the interface function library.
[0027] In some embodiments, the general business fields include: account information, account registration network point information, and institutional financial risk level; the special business fields include: email, SIM card number, date, boolean value, and name.
[0028] Another embodiment of the present invention provides an interface test data push device, which includes:
[0029] An interface function selection module, during the process of generating a test script in the interface test system, selects at least one interface function from multiple interface function libraries according to the interface information of the generated test project; each interface function corresponds to a historical database one by one.
[0030] A push data determination module, after the test script is generated, calls the corresponding historical database according to the interface function, selects the historical data in the historical database as the push data, and sends the push data and the test case script to the interface test system for testing operations; and
[0031] An interface function library update module, during the testing operation, updates the interface function library by accumulating the fields generated during the testing process.
[0032] In yet another aspect of the present invention, the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the interface test data push method as described above is implemented.
[0033] In yet another aspect of the present invention, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the interface test data push method as described above is implemented.
[0034] As can be seen from the above technical solutions, an interface test data pushing method and device provided by this application select at least one interface function during the process of generating a test script in the interface test system, and then select historical data from the historical database as the pushing data. At the same time, in the test operation process of the present invention, the interface function library is updated by accumulating the fields generated during the test process, and then the function library is continuously updated in combination with the feedback of the test process. Thus, on the one hand, automatic pushing of test data can be achieved, and on the other hand, the quality of test data and the efficiency of test scripts can be ensured, saving the time of manually constructing test data only, improving the quality and efficiency of interface testing, and at the same time, the function library is continuously self-updated, and thus the pushed data is more and more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0036] Figure 1 It is a schematic flowchart of the interface test data pushing method in the embodiment of the present application.
[0037] Figure 2 is Figure 1 The specific flowchart of step S1 in.
[0038] Figure 3 It is one of the further included flowchart diagrams of the interface test data pushing method in the embodiment of the present application.
[0039] Figure 4 It is in the embodiment of the present application Figure 3 The specific flowchart of step S5 in.
[0040] Figure 5 is Figure 1 The specific flowchart of step S2 in.
[0041] Figure 6 It is the second of the further included flowchart diagrams of the interface test data pushing method in the embodiment of the present application.
[0042] Figure 7 It is one of the flowchart diagrams of the scenario cases in the embodiment of the present application.
[0043] Figure 8 It is the second of the flowchart diagrams of the scenario cases in the embodiment of the present application.
[0044] Figure 9It is a schematic structural diagram of the interface test data pushing device in an embodiment of the present application.
[0045] Figure 10 It is in an embodiment of the present application Figure 9 It is a specific structural schematic diagram of the interface function selection module in
[0046] Figure 11 It is one of the schematic structural diagrams further included in the interface test data pushing device in an embodiment of the present application.
[0047] Figure 12 It is Figure 11 It is a specific structural schematic diagram of the historical database update module 5 in
[0048] Figure 13 It is Figure 9 It is a specific structural schematic diagram of the push data determination module in
[0049] Figure 14 It is the second of the schematic structural diagrams further included in the interface test data pushing device in an embodiment of the present application.
[0050] Figure 15 It is a schematic structural diagram of the electronic device in an embodiment of the present application. Detailed implementation manners
[0051] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without making creative efforts shall fall within the protection scope of the present application.
[0052] It should be noted that the interface test data pushing method and device disclosed in the present application can be used in the financial field, and can also be used in any field other than the financial field. The application fields of the interface test data pushing method and device disclosed in the present application are not limited.
[0053] Currently, in the processing of interface test data, there are generally three existing solutions: one is to construct all test data for all test scripts manually and then execute the test scripts; the second is to directly construct interface test data by operating the database; the third is to automatically generate random test data through tool code and then execute the scripts.
[0054] The existing solutions mainly have the following deficiencies:
[0055] (1) The method of manually constructing test data can construct test data related to the actual business scenario, but it does not effectively combine manual and automated methods, and cannot effectively improve the efficiency of interface testing.
[0056] (2) Directly operating on the database often meets the requirement of batch data generation. During the data generation process, the actual business requirements of the test data are not considered, so the quality of the test data and interface testing cannot be guaranteed.
[0057] (3) Automatically generating random test data through tool code can avoid duplicate test data, but the generated data is also not related to the actual test business, and it cannot achieve the purpose of automatically pushing test data according to the actual test business, so the quality of the test data and the efficiency of the written test script cannot be guaranteed.
[0058] The following will describe in detail the interface test data pushing method and device provided by the present invention with reference to the accompanying drawings.
[0059] In a specific embodiment, the present application provides an interface test data pushing method, which is applied to an interface test data pushing device, as Figure 1 , and the interface test data pushing method includes:
[0060] S1: During the process of generating a test script in the interface test system, select at least one interface function from multiple interface function libraries according to the interface information of the generated test project; where each interface function corresponds to a historical database one by one;
[0061] S2: After the test script is generated, call the corresponding historical database according to the interface function, select the historical data in the historical database as the pushed data, and send the pushed data and the test case script to the interface test system for test operations together; and
[0062] S3: During the test operation process, update the interface function library by accumulating the fields generated during the test.
[0063] An interface test data pushing method provided by the present application selects at least one interface function during the process of generating a test script in an interface test system, and then selects historical data from a historical database as the pushing data. At the same time, in the test operation process of the present invention, the interface function library is updated by accumulating the fields generated during the test process, and then the function library is continuously updated in combination with the feedback of the test process. Thus, on the one hand, automatic pushing of test data can be realized, and on the other hand, the quality of test data and the efficiency of test scripts can be guaranteed, saving the time of manually constructing test data only, improving the quality and efficiency of interface testing, and continuously self-updating the function library, and then the pushed data is more and more accurate.
[0064] The following will elaborate on step S1 of the present invention.
[0065] In some embodiments, developers define interface information such as interface field names, Chinese descriptions of fields, field types, field business descriptions, etc. on an interface test platform. It can be seen that the interface information includes the names, business descriptions, and business description information of each interface field. In this embodiment, as Figure 2 shown, step S1 specifically includes:
[0066] S11: Extract multiple business fields from the names, business descriptions, and business description information of the interface fields;
[0067] S12: Select the corresponding interface functions from the interface function library according to each business field.
[0068] In this embodiment, first in data construction, according to the names, business descriptions, and business description information of each interface field defined in the interface management of the interface test system, general business fields and special business fields are extracted.
[0069] After that, the present invention establishes an interface function library in combination with the interface information. In a specific embodiment of the present invention, the construction of the interface function library mainly places common business data such as general business fields and special business fields defined in existing test projects, as well as special data, into dictionary values, and continuously accumulates dictionary values during the test process. Then, by defining and implementing different interface function libraries, parameter test data for generating test scripts is called.
[0070] In the embodiment of the present invention, the general business fields include: account information, account registration network point information, institutional financial risk level; the special business fields include: email, SIM card number, date, boolean value, and name.
[0071] It can be understood that in the present invention, the construction of the function library mainly puts the common business data such as the interface common business fields, special business fields, etc. defined in the existing test projects, as well as special data into the dictionary values, and continuously accumulates the dictionary values during the testing process. Then, by defining and implementing different function libraries, the parameter test data for generating test scripts is called.
[0072] For example, the interface function libraries for commonly obtaining business field values include:
[0073] The function for obtaining the bank card number: getBankNo();
[0074] The function for obtaining the bank branch: getBankOutlet();
[0075] The function for obtaining the institutional financial risk level: getRiskLevel();
[0076] The function for obtaining the suspicious model type: getModelType();
[0077] The function for obtaining the repayment type: getRepayType().
[0078] The interface function libraries for commonly obtaining special field values include:
[0079] The function for obtaining the email: genEmail();
[0080] The function for obtaining the mobile phone number: genBirthday();
[0081] The function for obtaining the date: getDate();
[0082] The function for obtaining the boolean value: getBoolean();
[0083] The function for obtaining the name: getName();
[0084] The function for obtaining the age: getAge().
[0085] In some embodiments, as Figure 3 shown, the method further includes:
[0086] S4: During the test operation, obtain the test data generated during the test process and import it into the historical database;
[0087] S5: Update the historical database based on the usage times of the test data in the historical database.
[0088] In the embodiments of the present application, in combination with Figure 7 and Figure 8, during the entire testing process, a process of continuously accumulating and updating table data is carried out. Finally, during the generation of the use case script in the interface testing system, the push logic is called to push the business test data associated with this script through the push call function library or the historical build table, complete the generation of the entire test script, display it in the use case list of the interface testing system, and then execute it.
[0089] In a specific embodiment, as Figure 4 shown, step S5 specifically includes:
[0090] S51: For the test data imported into the historical database, according to the parameter names, parameter types in the corresponding historical data build table, and the test item identifiers corresponding to each test data, query the corresponding effective push times in the historical data build table;
[0091] S52: Use a counter to update the corresponding effective push times in the historical data build table;
[0092] S53: Sort the test data in the historical database according to the effective push times to obtain a test data push sequence, retain the test data before the set position in the test data push sequence, and then update the historical database.
[0093] In this embodiment, by sorting the effective push times of the test data and deleting the historical data with a lower effective push times ranking, the historical database is continuously updated, making the subsequent test data push more and more accurate.
[0094] It can be understood that the effective push times in this application can be considered as the push times of the test data confirmed by the tester or the computer program, that is, during the early debugging process of the tester or during the testing process, for the test results of the selected test data, the test data that the tester believes meets the standard can be used. For example, if the pushed test data is confirmed by the tester, the corresponding effective push times is incremented by 1.
[0095] The historical database is described in detail below. The historical database is constructed through a historical data build table, and the table field design of the historical data build table is as follows:
[0096] param_key: Parameter name
[0097] param_type: Parameter type
[0098] param_value: Test data identifier
[0099] total_freq: The total frequency used in the test system. There are multiple test products in the system, and each product has multiple sub-test items. This field is the sum of all test products and test items.
[0100] prod_freq: The frequency used in this product. Each product has multiple sub-items.
[0101] proj_freq: The frequency used in this project. The project belongs to the product.
[0102] proj_id: The project ID corresponding to this parameter param_key, param_value, param_type.
[0103] prod_id: The product ID corresponding to this parameter param_key, param_value, param_type.
[0104] In this embodiment, the test data corresponding to the specific sub-items of each product is different. Therefore, each project ID corresponds to a historical database, or the test data of each project corresponding to all products is stored in a historical database. This application is not limited to this. However, it can be understood that the test data identifier on the historical data construction table of the present invention is the test data. The param_value column in the table corresponds to the test data identifier of the interface, that is, the test data to be pushed. For example, "suspicious model" and "audit model" are all test data. The Param_key column corresponds to the reference key of the interface. For example, modelType is one of the parameter names defined in a certain interface.
[0105] The above embodiments are only used as examples for illustration. In the actual historical data construction table, the values in the param_value column will have many other parameter corresponding values. For example, when param_key is unitType, the values in the param_value column are "union members", "project branches", and other test data.
[0106] In the above embodiment, the test data identifier corresponds to a set of test data. For example, when the test data identifier is "suspicious model" as described above, it corresponds to a set of multiple suspicious models as the test data. The present invention will not elaborate on this.
[0107] In the embodiment of the present invention, as Figure 5 shown, step S2 specifically includes:
[0108] S21: Search for the test data identifier of the corresponding parameter name in the historical data construction table according to the service field in the interface function;
[0109] S22: Identify the corresponding historical database according to the test data identifier, and use the test data in the table corresponding to the historical database whose test data push sequence is arranged before the preset position as the push data.
[0110] Specifically, during the process of automatically generating test scripts by the interface test system using corresponding algorithms, the push logic will be called to push test data to the test scripts. First, the data_recommend_history table will be queried according to param_key, param_type, proj_id, and prod_id. When business test data is queried and the qualified param_value for automatic push is used, the values of total_sys_freq, prod_freq, and proj_freq of this data will be updated simultaneously.
[0111] Secondly, the data_recommend_history table will be queried according to param_key, param_type, and prod_id. When data is queried and the qualified param_value for push is used, the values of total_sys_freq and prod_freq of this data will be updated simultaneously, that is, when the test data is successfully pushed, total_sys_freq and prod_freq corresponding to the test data identifier will be incremented by 1.
[0112] Then, the data_recommend_history table will be queried according to param_key and param_type. When data is queried and the qualified param_value for push is used, the values of total_sys_freq, prod_freq, and proj_freq of this data will be updated simultaneously.
[0113] In addition, in some embodiments, as Figure 6 shown, the method of the present invention further includes:
[0114] S6: The interface function library includes multiple general service field functions and at least one special service field function. If the fields in the interface information do not include any general service field or special service field, a random string function is established;
[0115] S7: Perform an iterative operation to generate an original random string. If the fields in the interface information do not include the random string, a new random string is regenerated and replaces the original random string until the fields in the interface information include the current random string, and the final random string function is added to the interface function library.
[0116] In this embodiment, when there is no corresponding field in the function library and the historical database, a random string is generated using the random string function, and the random string is screened and compared according to the interface information to find the corresponding field, and the random string function is used as the interface function. In this embodiment, the test data of the test script is generated according to a random function, so that when the business requirements cannot be met by the test, the tester can manually construct test data for the parameters of the test script according to the actual situation.
[0117] The present invention will be described in detail below with reference to specific cases.
[0118] First, it is necessary to determine which data construction method should be called for the parameters in the generated test script; then, when the interface test system generates a test script, it calls the push logic to push the test data identifier of the test script field, and pushes the test data from the historical data construction table, mainly including the following two methods:
[0119] The push logic of the test data identifier when the parameter name of the test case script field parameter is the same as param_key and param_type in the historical table. At this time, it is necessary to query the data in the data_recommend_history table according to param_key, param_type, proj_id, and prod_id. For example, the following data is queried:
[0120] At this time, three pushable data are found for the field parameter modelType of the test case script from the historical table, but finally, they will be sorted according to the value of total_sys_freq, and the value of param_value corresponding to the maximum value of 20, which is "audit model", will be pushed to the parameter of the test case script.
[0121] If no data is queried according to the above param_key, param_type, proj_id, and prod_id, then query according to param_key, param_type, and prod_id at this time
[0122] When the following data is queried:
[0123] If the maximum total_sys_freq corresponding to modelType under this product is queried at this time, then the corresponding "suspicious model" can be pushed to the parameter of the test case script.
[0124] If no data is queried based on the above param_key, param_type, and prod_id, then query according to param_key and param_type at this time. If the test data corresponding to the maximum value 56 of total_sys_freq corresponding to modelType in the interface test system is queried, then the parameters can be pushed to the test case script. The test data obtained by the automatic push method in the finally generated test script will be displayed in the case management list of the interface test system. When the tester executes each test script and encounters test data pushed according to a random function and having no association with the project business, a test data with business meaning will be manually constructed, and the above historical data construction process will be repeated to construct and accumulate historical data.
[0125] It can be seen that an interface test data push method provided by the present application selects at least one interface function during the process of generating a test script in an interface test system, and then selects historical data from a historical database as push data. At the same time, in the test operation process of the present invention, the interface function library is updated by accumulating the fields generated during the test process, and then the function library is continuously updated in combination with the feedback of the test process. Thus, on the one hand, automatic push of test data can be realized, on the other hand, the quality of test data and the efficiency of test scripts can be guaranteed, the time for manually constructing test data alone is saved, and the quality and efficiency of interface testing are also improved. At the same time, the function library is continuously self-updated, and thus the pushed data is more and more accurate.
[0126] From a software level, the present application provides an embodiment of an interface test data push device for executing all or part of the content in the interface test data push method. Refer to Figure 9 , and the interface test data push device specifically includes the following content:
[0127] An interface function selection module 1, during the process of generating a test script in an interface test system, selects at least one interface function from multiple interface function libraries according to the interface information of the generated test project; where each interface function corresponds to a historical database one by one;
[0128] A push data determination module 2, after the test script is generated, calls the corresponding historical database according to the interface function, selects the historical data in the historical database as push data, and sends the push data and the test case script to the interface test system for test operation; and
[0129] An interface function library update module 3, during the test operation process, updates the interface function library by accumulating the fields generated during the test process.
[0130] As can be seen from the above description, the interface test data pushing device provided by the present invention selects at least one interface function during the process of generating a test script in the interface test system, and then selects historical data from the historical database as the pushing data. At the same time, during the test operation, the present invention updates the interface function library by accumulating the fields generated during the test process, and then continuously updates the function library in combination with the feedback of the test process. Thus, on the one hand, it can realize the automatic pushing of test data, and on the other hand, it can ensure the quality of test data and the efficiency of test scripts, saving the time of manually constructing test data only, improving the quality and efficiency of interface testing, and continuously self-updating the function library, so that the pushed data is more and more accurate.
[0131] In some embodiments, developers define interface information such as interface field names, Chinese descriptions of fields, field types, field business descriptions, etc. in the interface test platform. It can be seen that the interface information includes the names, business descriptions, and business description information of each interface field.
[0132] Based on the same inventive concept, in some embodiments of the present invention, the interface information includes the names, business descriptions, and business description information of each interface field; as Figure 10 shown, the interface function selection module 1 includes:
[0133] A business field extraction unit 11 extracts a plurality of business fields from the names, business descriptions, and business description information of the interface fields;
[0134] An interface function selection unit 12 selects corresponding interface functions from the interface function library according to each business field.
[0135] In this embodiment, first in data construction, according to the names, business descriptions, and business description information of each interface field defined in the interface management of the interface test system, general business fields and special business fields are extracted.
[0136] After that, the present invention establishes an interface function library in combination with the interface information. In a specific embodiment of the present invention, the construction of the interface function library mainly places common business data such as general business fields and special business fields defined in existing test projects, as well as special data, into dictionary values, and continuously accumulates the dictionary values during the test process. Then, by defining and implementing different interface function libraries, the parameter test data for generating test scripts is called.
[0137] In the embodiments of the present invention, the general business fields include: account information, account registration network point information, institutional financial risk level; the special business fields include: email, SIM card number, date, boolean value, and name.
[0138] It can be understood that in the present invention, the function library construction mainly places common business data such as the general business fields and special business fields defined in the existing test projects, as well as special data, into the dictionary values, and continuously accumulates the dictionary values during the testing process. Then, different function libraries are defined and implemented to call the parameter test data for generating test scripts.
[0139] In an embodiment of the present invention, as Figure 11 shown, the device further includes:
[0140] A test data import module 4, which acquires the test data generated during the test operation and imports it into the historical database;
[0141] A historical database update module 5, which updates the historical database based on the usage times of the test data in the historical database.
[0142] In the embodiment of the present application, during the entire test process, the process of continuously accumulating and updating table data is carried out. Finally, during the generation of the use case script in the interface test system, the push logic is called to push and call the function library or the historical construction table to push the business test data associated with this script, complete the generation of the entire test script, and display it in the use case list of the interface test system and then execute it.
[0143] In a preferred embodiment, each historical database corresponds to a historical data construction table. As Figure 12 shown, the historical database update module 5 includes:
[0144] A valid push times query unit 51, which queries the corresponding valid push times in the historical data construction table according to the parameter name, parameter type, and the test project identifier corresponding to each test data for the test data imported into the historical database;
[0145] A valid push times update unit 52, which updates the corresponding valid push times in the historical data construction table by using a counter;
[0146] A historical database update unit 53, which sorts the test data in the historical database according to the valid push times to obtain a test data push sequence, retains the test data before the set position in the test data push sequence, and further updates the historical database.
[0147] In this embodiment, by sorting the valid push times of the test data and deleting the historical data with a lower valid push times ranking, the historical database is continuously updated, making the subsequent test data push more and more accurate.
[0148] It can be understood that the effective push times in the present application can be regarded as the push times of test data confirmed by testers or computer programs. That is, during the preliminary debugging process by testers or during the testing process, for the test results of the selected test data, if the testers consider that the test data meets the standards and can be used, for example, after the pushed test data is confirmed by the testers, the corresponding effective push times are incremented by 1.
[0149] Based on the same inventive concept, in a preferred embodiment, as Figure 13 shown, the push data determination module 2 includes:
[0150] The test data identifier search unit 21 searches for the test data identifier corresponding to the parameter name in the historical data construction table according to the service field in the interface function;
[0151] The push data determination unit 22 calls the corresponding historical database according to the test data identifier, and uses the test data whose push sequence in the historical database is arranged before the preset position in the historical data construction table as the push data.
[0152] Specifically, during the process of the interface test system automatically generating test scripts using corresponding algorithms, the push logic will be called to push test data to the test scripts. First, the data_recommend_history table will be queried according to param_key, param_type, proj_id, and prod_id. When the business test data is queried and the satisfied param_value for automatic push is used, the values of total_sys_freq, prod_freq, and proj_freq of this data will be updated simultaneously.
[0153] Secondly, the data_recommend_history table will be queried according to param_key, param_type, and prod_id. When the data is queried and the satisfied param_value for push is used, the values of total_sys_freq and prod_freq of this data will be updated simultaneously. That is, when the test data is successfully pushed, total_sys_freq and prod_freq corresponding to the test data identifier are incremented by 1.
[0154] Then, the data_recommend_history table will be queried according to param_key and param_type. When the data is queried and the satisfied param_value for push is used, the values of total_sys_freq, prod_freq, and proj_freq of this data will be updated simultaneously.
[0155] Based on the same inventive concept, in a preferred embodiment, as Figure 14 shown, it further includes:
[0156] A random string creation module 6, where the interface function library includes multiple general service field functions and at least one special service field function. If the fields in the interface information do not include any general service field or special service field, a random string function is created;
[0157] An iteration module 7 that performs an iteration operation to generate an original random string. If the fields in the interface information do not include the random string, a new random string is regenerated and replaces the original random string until the fields in the interface information include the current random string, and the final random string function is added to the interface function library.
[0158] In this embodiment, when there is no corresponding field in the function library and the historical database, a random string is generated using the random string function, and the random string is screened and compared according to the interface information to find the corresponding field, and the random string function is used as the interface function. In this embodiment, the test data of the test script is generated according to a random function so that when the business requirements cannot be met by the test, the tester can manually construct test data for the parameters of the test script according to the actual situation.
[0159] Based on the same inventive concept, in an embodiment of the present invention, the general service fields include: account information, account registration network point information, and institutional financial risk level; the special service fields include: email, SIM card number, date, boolean value, and name.
[0160] From a hardware level, the present application provides an embodiment of an electronic device for implementing all or part of the content in the interface test data push method. The electronic device specifically includes the following content:
[0161] Figure 15 It is a schematic block diagram of the system composition of the electronic device 9600 in an embodiment of the present application. As Figure 15 shown, the electronic device 9600 may include a central processing unit 9100 and a memory 9140; the memory 9140 is coupled to the central processing unit 9100. It should be noted that this Figure 15 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0162] In one embodiment, the interface test data push method function may be integrated into the central processing unit. Among them, the central processing unit may be configured to perform the following controls:
[0163] S1: During the process of generating a test script in the interface testing system, select at least one interface function from multiple interface function libraries according to the interface information of the generated test project; where each interface function corresponds to a historical database one by one;
[0164] S2: After the test script is generated, call the corresponding historical database according to the interface function, select the historical data in the historical database as the push data, and send the push data and the test case script to the interface testing system for testing operations together; and
[0165] S3: During the testing operation, update the interface function library by accumulating the fields generated during the testing process.
[0166] As can be seen from the above description, the electronic device provided by the embodiments of the present application selects at least one interface function during the process of generating a test script in the interface testing system, and then selects historical data from the historical database as the push data. At the same time, in the present invention, during the testing operation, the interface function library is updated by accumulating the fields generated during the testing process, and then the function library is continuously updated in combination with the feedback of the testing process. Thus, on the one hand, automatic push of test data can be realized, and on the other hand, the quality of the test data and the efficiency of the test script can be guaranteed, saving the time of manually constructing test data only, improving the quality and efficiency of interface testing, and at the same time, the function library is continuously self-updated, and thus the push data is more and more accurate.
[0167] In another embodiment, the interface test data push device can be separately configured from the central processing unit 9100. For example, the interface test data push device can be configured as a chip connected to the central processing unit 9100, and the function of the interface test data push method is realized through the control of the central processing unit.
[0168] As Figure 15 shown, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It should be noted that the electronic device 9600 does not necessarily have to include Figure 15 all the components shown in Figure 15 ; in addition, the electronic device 9600 may further include
[0169] As Figure 15 shown, the central processing unit 9100 is sometimes also called a controller or an operation control, and may include a microprocessor or other processor devices and / or logic devices. The central processing unit 9100 receives inputs and controls the operations of the various components of the electronic device 9600.
[0170] Among them, the memory 9140 can be, for example, one or more of a buffer, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory, or other suitable devices. The above-mentioned information related to failures can be stored, and in addition, a program for executing relevant information can also be stored. And the central processing unit 9100 can execute the program stored in the memory 9140 to achieve information storage or processing, etc.
[0171] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to supply power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display can be, for example, an LCD display, but is not limited thereto.
[0172] The memory 9140 can be a solid-state memory. For example, it can be a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It can also be a memory that stores information even when power is off, can be selectively erased, and has more data. An example of this memory is sometimes referred to as an EPROM, etc. The memory 9140 can also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 can include an application / function storage unit 9142, which is used to store application programs and function programs or the processes for operating the electronic device 9600 through the central processing unit 9100.
[0173] The memory 9140 can also include a data storage unit 9143, which is used to store data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 can include various drivers of the electronic device for communication functions and / or for executing other functions of the electronic device (such as a messaging application, an address book application, etc.).
[0174] The communication module 9110 is a transmitter / receiver 9110 that transmits and receives signals via the antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processing unit 9100 to provide input signals and receive output signals, which can be the same as in the case of a conventional mobile communication terminal.
[0175] Based on different communication technologies, in the same electronic device, multiple communication modules 9110 can be provided, such as a cellular network module, a Bluetooth module, and / or a wireless local area network module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby implementing normal telecommunication functions. The audio processor 9130 can include any suitable buffers, decoders, amplifiers, etc. Additionally, the audio processor 9130 is also coupled to a central processor 9100, enabling recording on the device through the microphone 9132 and playing back the sounds stored on the device through the speaker 9131.
[0176] Embodiments of the present application also provide a computer-readable storage medium capable of implementing all steps in the interface test data push method in the above embodiments. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, all steps of the interface test data push method with the execution subject being a server or a client in the above embodiments are implemented. For example, when the processor executes the computer program, the following steps are implemented:
[0177] S1: During the process of generating a test script in the interface test system, select at least one interface function from multiple interface function libraries according to the interface information of the generated test items; where each interface function corresponds to a historical database one by one;
[0178] S2: After the test script is generated, call the corresponding historical database according to the interface function, select the historical data in the historical database as the push data, and send the push data and the test case script to the interface test system for test operations together; and
[0179] S3: During the test operation process, update the interface function library by accumulating the fields generated during the test.
[0180] As can be seen from the above description, for the computer-readable storage medium provided by the embodiments of the present application, by selecting at least one interface function during the process of generating a test script in the interface test system, and then selecting historical data from the historical database as the push data. At the same time, in the process of the test operation of the present invention, the interface function library is updated by accumulating the fields generated during the test. Furthermore, the function library is continuously updated in combination with the feedback of the test process. Thus, on the one hand, automatic push of test data can be achieved, and on the other hand, the quality of the test data and the efficiency of the test script can be ensured, saving the time of simply constructing test data manually, improving the quality and efficiency of interface testing, and continuously self-updating the function library, thereby making the pushed data more and more accurate.
[0181] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, apparatus, or computer program product. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0182] The present invention is described with reference to the flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0183] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0184] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0185] Specific embodiments are applied in the present invention to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. An interface test data pushing method, characterized in that, the interface test data pushing method includes: During the process of generating a test script in an interface test system, at least one interface function is selected from multiple interface function libraries according to the interface information of the generated test project; wherein each interface function corresponds to a historical database one by one; After the test script is generated, the corresponding historical database is called according to the interface function, historical data in the historical database is selected as pushing data, and the pushing data and the test case script are jointly sent to the interface test system for test operations; and During the test operation process, the interface function library is updated by accumulating fields generated during the test; The method further includes: during the test operation process, obtaining test data generated during the test and importing it into the historical database; updating the historical database based on the usage times of the test data in the historical database; Each historical database corresponds to a historical data construction table, and the updating the historical database based on the usage times of the test data in the historical database includes: for the test data imported into the historical database, querying the corresponding effective pushing times in the historical data construction table according to the parameter name, parameter type in the corresponding historical data construction table and the test project identifier corresponding to each test data; updating the corresponding effective pushing times in the historical data construction table by using a counter; sorting each test data in the historical database according to the effective pushing times to obtain a test data pushing sequence, and retaining the test data before the set position in the test data pushing sequence, thereby updating the historical database; The method further includes: the interface function library includes multiple general business field functions and at least one special business field function. If the fields in the interface information do not include any general business field or special business field, a random string function is established; an iterative operation is performed to generate an original random string. If the fields in the interface information do not include the random string, a new random string is regenerated and replaces the original random string until the fields in the interface information include the current random string, and the final random string function is added to the interface function library; wherein, the general business fields include: account information, account registration network point information, and institutional financial risk level; the special business fields include: email, SIM card number, date, boolean value, and name.
2. An interface test data pushing method according to claim 1, characterized in that, the interface information includes the names, business descriptions, and business description information of each interface field; the selecting at least one interface function from multiple interface function libraries according to the interface information of the generated test project includes: extracting multiple business fields from the names, business descriptions, and business description information of the interface fields; selecting the corresponding interface function from the interface function library according to each business field.
3. An interface test data pushing method according to claim 1, characterized in that, Call the corresponding historical database according to the interface function, and select historical data in the historical database as push data, including: Search for test data identifiers of corresponding parameter names in the historical data construction table according to the service fields in the interface function; Call the corresponding historical database according to the test data identifier, and use the test data whose arrangement in the test data push sequence in the historical data construction table is before the preset position as the push data.
4. An interface test data push device Characterized in that The interface test data push device includes: An interface function selection module, which selects at least one interface function from multiple interface function libraries according to the interface information of the generated test project during the process of generating a test script in the interface test system; where each interface function corresponds to a historical database one by one; A push data determination module, after the test script is generated, calls the corresponding historical database according to the interface function, selects historical data in the historical database as push data, and sends the push data and the test case script to the interface test system for test operations together; and An interface function library update module, during the test operation, updates the interface function library by accumulating the fields generated during the test; The device further includes: A test data import module, during the test operation, obtains the test data generated during the test and imports it into the historical database; A historical database update module, which updates the historical database based on the usage times of the test data in the historical database; The historical database update module includes: An effective push times query unit, for the test data imported into the historical database, queries the corresponding effective push times in the historical data construction table according to the parameter names, parameter types in the corresponding historical data construction table, and the test project identifiers corresponding to each test data; An effective push times update unit, which updates the corresponding effective push times in the historical data construction table by using a counter; A historical database update unit, sorts each test data in the historical database according to the effective push times to obtain a test data push sequence, retains the test data before the set position in the test data push sequence, and further updates the historical database; The device further includes: A random string creation module, the interface function library includes multiple general service field functions and at least one special service field function, if the fields in the interface information do not include any general service field or special service field, create a random string function; An iteration module, performs an iteration operation to generate an original random string, if the fields in the interface information do not include the random string, regenerates a new random string and replaces the original random string until the fields in the interface information include the current random string, and adds the final random string function to the interface function library; Among them, the general service fields include: account information, account registration network point information, and institutional financial risk level; the special service fields include: email, SIM card number, date, boolean value, and name.
5. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, when the processor executes the program, the interface test data pushing method described in any one of claims 1 to 3 is implemented.
6. A computer-readable storage medium, on which a computer program is stored, characterized in that, when the computer program is executed by a processor, the interface test data pushing method described in any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Method and system for generating test script and test suite
CN102023861A
Software testing method and device based on automatic testing tool and electronic equipment
CN110162463A