Interface test case generation method and device, equipment and storage medium
By analyzing the initial characteristics and mapping relationships of business information, the problem of low efficiency in generating interface test documents is solved, and efficient and dynamic interface test case generation is achieved.
Patent Information
- Application Number
- CN202510436786.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-07-25
AI Technical Summary
In the prior art, the generation efficiency of interface test documents is low, time-consuming and easy to miss high-risk scenarios, and it is impossible to accurately cover the changes points of this iteration.
By obtaining business information, analyzing the initial features and determining the target features with the greatest distinction, classifying them based on the mapping relationship between features and categories, extracting key information, generating interface test cases, and realizing logical decoupling.
It improves the efficiency of the generation of interface test cases, dynamically adapts to data changes, reduces the need for manual adjustments, and ensures test coverage.
Smart Images

Figure CN120371695A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of interface testing, and is applied to the fields of medical health and fintech, and particularly relates to a method, device, equipment and storage medium for generating interface test cases. Background Art
[0002] Interfaces are widely used in various fields. For example, in the scenario of medical health insurance, preservation operations such as patient information change and insured amount adjustment involve the adaptation of sensitive medical data and medical insurance policies, and it is necessary to ensure the compliance processing of professional parameters such as diagnosis codes and reimbursement ratios by the interface; in the financial insurance scenario, the calculation logic of fund-related interfaces such as policy loans and surrender is complex, which directly affects the asset security of users.
[0003] When generating an interface test document, the tester needs to read the interface document provided by the R & D line by line to understand the interface parameters, request formats and dependencies. Then, for each interface, input parameters (legal values, boundary values, abnormal values) are manually designed, and test scripts are written. On this basis, it is necessary to manually sort out the cross-system call relationships and manually hard-code the dependency logic in the test script. Before each version release, it is necessary to manually screen and execute all historical cases, which is time-consuming and prone to missing high-risk scenarios.
[0004] It can be understood that when using testers to manually generate interface test documents, the testers need to spend a lot of time learning the documents and writing code. In addition, when the interface changes (such as parameter addition, path adjustment), it is necessary to manually modify all related cases, which is prone to omissions. And the full-scale regression test takes too long and cannot accurately cover the change points of this iteration.
[0005] In summary, the efficiency of generating interface test documents in the prior art is low. Summary of the Invention
[0006] The present invention provides a method, device, equipment and storage medium for generating interface test cases to solve the technical problem of low efficiency in generating interface test documents in the prior art.
[0007] In a first aspect, the present invention provides a method for generating interface test cases, including:
[0008] Obtain business information;
[0009] Analyze the business information to obtain initial features corresponding to the business information;
[0010] Analyze the degree of differentiation of each initial feature from the business information, and determine the initial feature with the greatest degree of differentiation from the business information as the target feature;
[0011] Classify the target service information according to the first mapping relationship between the value of the target feature described in the service information and the category of the service information, to obtain the target category of the target service information;
[0012] Extract the key information corresponding to the target category in the target service information;
[0013] Determine the target service interface corresponding to the target category according to the second mapping relationship between the category of the service information and the service interface;
[0014] Generate an interface test case corresponding to the target service interface according to the key information corresponding to the target category.
[0015] In a second aspect, the present invention provides a device for generating an interface test case, including:
[0016] An acquisition module, configured to acquire service information;
[0017] A first analysis module, configured to analyze the service information to obtain the initial features corresponding to the service information;
[0018] A second analysis module, configured to analyze the degree of differentiation of each of the initial features from the service information, and determine the initial feature with the greatest degree of differentiation from the service information as the target feature;
[0019] A classification module, configured to classify the target service information according to the first mapping relationship between the value of the target feature described in the service information and the category of the service information, to obtain the target category of the target service information;
[0020] An extraction module, configured to extract the key information corresponding to the target category in the target service information;
[0021] An interface determination module, configured to determine the target service interface corresponding to the target category according to the second mapping relationship between the category of the service information and the service interface;
[0022] A generation module, configured to generate an interface test case corresponding to the target service interface according to the key information corresponding to the target category.
[0023] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the above method for generating an interface test case are implemented.
[0024] In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method for generating an interface test case are implemented.
[0025] The solution implemented by the method, apparatus, device, and storage medium for generating the above interface test cases can achieve logical decoupling by separately setting the second mapping relationship between categories and interfaces and the first mapping relationship between features and categories. In this way, when the business rules change, only the mapping relationship needs to be adjusted, such as adding a new interface type or modifying the classification threshold, without reconstructing the overall logic, thereby effectively improving the generation efficiency of the interface test cases. Moreover, when determining the target feature, the initial feature with the greatest degree of discrimination for business information is determined as the target feature. In this way, even if the business information changes, the target feature can be obtained immediately, and the target feature will not be unable to be determined due to the change of business information. It can be seen that this way of determining the target feature can dynamically adapt to data changes.
[0026] Furthermore, through the solution of the present application, after obtaining the business information, the interface test cases corresponding to each target business interface can be automatically generated based on a series of steps. In summary, this solution can effectively improve the generation efficiency of the interface test cases. Brief Description of the Drawings
[0027] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0028] Figure 1 is a flowchart of a method for generating interface test cases in an embodiment of the present invention;
[0029] Figure 2 is Figure 1 a flowchart of step S130 in
[0030] Figure 3 is Figure 2 a flowchart of step S132 in
[0031] Figure 4 is Figure 1 a flowchart of step S150 in
[0032] Figure 5 is Figure 1 a flowchart of step S170 in
[0033] Figure 6 is another flowchart of a method for generating interface test cases in an embodiment of the present invention;
[0034] Figure 7It is a schematic structural diagram of a generation device for interface test cases in an embodiment of the present invention;
[0035] Figure 8 It is a schematic structural diagram of a computer device in an embodiment of the present invention;
[0036] Figure 9 It is another schematic structural diagram of a computer device in an embodiment of the present invention. Detailed implementation manners
[0037] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0038] Figure 1 It is a flowchart of a method for generating an interface test case provided by an embodiment of the present invention. As Figure 1 shown, the method for generating an interface test case provided by an embodiment of the present invention includes the following steps.
[0039] Step S110, obtain service information.
[0040] It should be noted that the service information obtained in this step can be obtained according to the application scenario. For example, in the insurance business scenario, underwriting information can be obtained. Underwriting information is data used in the insurance business for risk assessment, underwriting, pricing, and customer management. The underwriting information may include customer information, policy information, and risk information, etc.
[0041] As a specific example, in the medical and health insurance scenario, the underwriting information may include the age, gender, smoking history, past medical history, and family genetic history of the applicant.
[0042] As another specific example, in the financial insurance scenario, the underwriting information may include the income level, occupation type, debt ratio, and investment preference of the applicant.
[0043] Step S120, analyze the service information to obtain initial features corresponding to the service information.
[0044] It should be noted that the initial features are any features that can characterize the service information, and no detailed limitation is provided here.
[0045] For example, in the insurance scenario, if the service information is underwriting information, the initial features of the underwriting information may be the age, gender, ID number, date of birth, contact information, and policy amount of the applicant.
[0046] Step S130: Analyze the degree of discrimination of each of the initial features with respect to the service information, and determine the initial feature with the greatest degree of discrimination with respect to the service information as the target feature.
[0047] It should be noted that in step S130, the degree of discrimination of each initial feature with respect to the service information is the classification of the service information based on the value of the initial feature. The initial feature with the greatest degree of discrimination with respect to the service information, that is, the target feature, is the feature that can classify various types of service information according to their service attributes to the greatest extent.
[0048] Specifically, in step S130, the manner of analyzing the degree of discrimination of each initial feature with respect to the service information can be any achievable manner. For example, statistical analysis methods can be used to analyze the degree of discrimination of each initial feature with respect to the service information, and the statistical analysis methods can include information gain, Gini coefficient, and chi-square test, etc.
[0049] As a specific example, in the medical and health insurance scenario, the correlation between each initial feature and the preservation information of "high medical expenses in the next three years" can be calculated, and it is found that the information gain (related to service attributes) of "the number of chronic diseases" is the highest. Therefore, the number of chronic diseases can be determined as the target feature.
[0050] In the financial insurance scenario, the predictive ability of each initial feature with respect to the preservation information of "policy default risk" can be evaluated, and it is found that the "debt ratio" has the highest correlation with the default rate (related to service attributes). Therefore, the debt ratio can be determined as the target feature.
[0051] In some embodiments of the present invention, as Figure 2 shown, step S130 includes:
[0052] Step S131: Analyze the service information to obtain the expected variable of the service information;
[0053] Step S132: Analyze the correlation between each of the initial features and the expected variable, and determine the initial feature with a correlation greater than a first preset value with respect to the expected variable as the target feature.
[0054] Specifically, in step S131, the expected variable is the variable with the highest degree of correlation with the target of the service information in service analysis, that is, the specific value of the expected variable can measure the degree of achievement of the service information target. It can be understood that the expected variable is the service attribute that the service information needs to reflect.
[0055] As a specific example, in the medical and health insurance scenario, the insurance company mainly focuses on the future medical expenses of the insured (expected variable) and whether major disease claims will occur (expected variable), etc. For this purpose, the insurance company can predict the possible medical expenses of the insured in the next few years by analyzing the target variables such as the age, health status, past medical history, and family medical history of the insured in the preservation information. The insurance company can judge the possibility of major disease claims of the insured during the insurance period through the target variables such as the living habits and physical examination indicators of the insured. For example, for insureds with chronic diseases such as hypertension and diabetes, their future medical expenses will be relatively high.
[0056] As another specific example, in the financial insurance scenario, the insurance company is concerned about the default risk of the insured and the income situation of the insurance product. Therefore, the default risk and the income situation of the insurance product can be set as expected variables. For the default risk, the target variables such as the income level, debt situation, and credit record of the insured in the preservation information can be analyzed to predict whether the insured will have default behaviors such as not paying the insurance premium on time during the insurance period. For example, insureds with unstable income and high debt have a relatively high probability of defaulting on their insurance policies. For the investment return rate of the insurance product, the investment return rate of the sold financial insurance product within a certain period can be predicted according to the target variables such as the investment preference and asset allocation situation of the insured in the preservation information.
[0057] It can be understood that using step S131 can clarify the expected variables, so that the analysis focus can be concentrated on the features directly related to the core goal, avoiding getting stuck in the indiscriminate processing of massive data. Using step S132 to quantify the association strength between the initial features and the expected variables through statistical methods, avoiding subjective judgment, and ensuring that the screening process of the target features is transparent and repeatable.
[0058] In some embodiments of the present invention, as Figure 3 shown, the step S132 includes:
[0059] Step S1321, when the classification variable of the preset univariate feature selection scoring function is the expected variable, determine the score of the univariate feature selection function for each initial feature;
[0060] Step S1322, determine the initial features with scores greater than the second preset value as the target features.
[0061] Specifically, for step S1321, the univariate feature selection function is used to evaluate the degree of association between each initial feature and the expected variable. When the expected variable is used as a categorical variable, each initial feature is scored individually through the univariate feature selection function to measure the discrimination ability or prediction ability of each initial feature for the expected variable. The univariate feature selection function can be any implementable method, such as a chi-square test function or a gain function, etc.
[0062] As a specific example, in the field of medical and health insurance, the expected variable can be "whether suffering from a serious disease (yes / no)", and the initial features can include age, whether smoking, family medical history, and blood pressure level, etc. Suppose the chi-square test is selected as the univariate feature selection scoring function. The chi-square test can test the independence between two categorical variables. In this case, it is to test the degree of association between each initial feature and the expected variable. For the initial feature of "whether smoking", by collecting data of a large number of policyholders, a contingency table can be constructed to count the number of people suffering from serious diseases and not suffering from serious diseases among smokers and non-smokers. Then, according to the chi-square test formula, the chi-square value is calculated, and this chi-square value is the score of this feature. For "family medical history", a contingency table can also be constructed for the chi-square test to obtain its chi-square value. And so on, the scores of each initial feature are calculated.
[0063] As a specific example, in the financial insurance scenario, the expected variable can be "whether the insurance policy defaults", and the initial features can include income level, debt ratio, credit score, and occupation type, etc. Here, the information gain can be selected as the univariate feature selection scoring function. The information gain measures the classification ability of a feature for the data set.
[0064] Specifically, in step S1322, the second preset value is a preset threshold, and this threshold can screen out the initial features with relatively strong correlation with the expected variable. When the score of an initial feature is greater than this threshold, it indicates that this feature has good discrimination ability and prediction ability for the expected variable.
[0065] It can be understood that by using step S1321 and step S1322, the univariate feature selection scoring function only needs to analyze the relationship between features and the expected variable one by one, without considering the complex interactions between features, and the calculation cost is low.
[0066] In some embodiments of the present invention, the preset univariate feature selection scoring function is the f_classif function.
[0067] Specifically, the f_classif function can evaluate the linear correlation between features and the target variable by calculating the F-value and p-value between each feature and the target variable based on the F-test principle of analysis of variance. The F-value reflects the ratio of the between-group variance to the within-group variance. The larger the F-value, the more significant the difference of the feature among different categories, which also means that the feature has a stronger ability to distinguish classification. The p-value is used to measure the significance of this difference. The smaller the p-value, the more significant the correlation between the feature and the target variable. Further, when using the f_classif function to score each initial feature, in order to determine the initial features with scores greater than the second preset value as the features with a strong correlation with the expected variable, the difference between the F-value and p-value of the f_classif function for each initial feature can be used as the final score of the f_classif function for each initial feature.
[0068] Step S140: Classify the target business information according to the first mapping relationship between the value of the target feature described in the business information and the category of the business information, so as to obtain the target category of the target business information.
[0069] Specifically, in step S130, the target feature has been determined. The first mapping relationship can be obtained through the analysis and modeling of historical business information, which describes the corresponding relationship between different value combinations of the target feature and the business information category. In this step, the value of the target feature in the target business information can be substituted into this mapping relationship to determine the category to which the target business information belongs.
[0070] As a specific example, in the field of medical and health insurance, assume that the target features determined in the previous steps are "age", "whether suffering from chronic diseases", and "family medical history". Through the analysis of a large amount of historical medical and health insurance data, the following first mapping relationship can be obtained: Category 1 (low risk): age less than 40 years old, no chronic diseases, no family medical history; Category 2 (medium risk): age between 40 - 60 years old, having one chronic disease, no family medical history; Category 3 (high risk): age greater than 60 years old, having multiple chronic diseases, or having a family medical history. The existing target insurance information is that the insured is 45 years old, suffering from hypertension (one chronic disease), and has no family medical history. According to the above first mapping relationship, it can be known that the target insurance information belongs to Category 2 (medium risk).
[0071] As another specific example, in the field of financial insurance, the target features are set as "income level", "debt ratio", and "credit score". Through historical financial security data, the following first mapping relationship is obtained: Category A (high-quality customers): high income level, debt ratio lower than 30%, credit score greater than 800 points; Category B (ordinary customers): medium income level, debt ratio between 30% and 60%, credit score between 600 - 800 points; Category C (high-risk customers): low income level, debt ratio higher than 60%, credit score less than 600 points. The target security information shows that the policyholder has a medium income level, a debt ratio of 40%, and a credit score of 700 points. According to the first mapping relationship, this target security information belongs to Category B (ordinary customers).
[0072] Step S150, extract the key information corresponding to the target category from the target business information.
[0073] Specifically, after determining the target category corresponding to the target business information, different target categories need to focus on the corresponding key information to generate interface test cases.
[0074] As a specific example, in the medical and health insurance scenario, for Category 1 (low risk), the key information can be basic health examination indicators (such as blood pressure, blood sugar, and blood lipid, etc.) to confirm the basic health condition of the policyholder; for Category 2, in addition to the basic examination indicators, detailed chronic disease treatment records and review situations are also required to evaluate the stability and development trend of the condition; for Category 3 (high risk), in addition to the above information, detailed family medical history information is also required, including the number of family members with diseases, types of diseases, and treatment situations, etc., in order to more comprehensively evaluate the genetic risk. For example, when it is determined that the target security information belongs to Category 2, the basic physical examination indicators such as the policyholder's blood pressure, blood sugar, and blood lipid, as well as the treatment records of hypertension, can be extracted from the target security information.
[0075] As another specific example, in the financial insurance scenario, for Category A, the key information can be the proof of the stability of its income source (such as pay slips or tax certificates, etc.) and investment preference information; for Category B, in addition to the income source proof, a detailed description of the debt situation (such as the repayment plans for mortgages and car loans, etc.) and a detailed report of the credit record are also required to evaluate its repayment ability and credit risk; for Category C, in addition to the above information, additional guarantee information or guarantor materials are also required to reduce the risk of the insurance company.
[0076] In some embodiments of the present invention, as Figure 4 shown, the step S150 includes:
[0077] Step S151: Analyze the target category to obtain the target business scenario corresponding to the target category.
[0078] Step S152: Analyze the target business scenario to obtain the business operation variables corresponding to the target business scenario and the relevant variables involved in the business operation variables.
[0079] Step S153: Extract the values of the business operation variables and the values of the relevant variables from the target business information to obtain the key information of the target category.
[0080] Among them, the key information includes the values of the business operation variables and the values of the relevant variables.
[0081] Specifically, in step S151, the target category is determined based on the mapping relationship between the target characteristic value and the business information category. Different target categories may imply different customer risk characteristics and demand characteristics, etc., and these characteristics will directly lead to different insurance business scenarios. In this step, the meaning represented by the target category can be deeply analyzed, combined with the actual process and requirements of the insurance business, to find out the specific business scenario that matches it, laying a foundation for determining the business operation variables and relevant variables in the follow-up.
[0082] Specifically, in step S152, after the target business scenario is determined, the core variables involved in the business operation in this scenario can be found, that is, the business operation variables. These variables directly affect the business decision-making and execution process. At the same time, the business operation variables often do not exist in isolation, and they will be affected and restricted by other relevant variables. The relevant variables provide the basis and reference for the determination and adjustment of the business operation variables. By analyzing the target business scenario and identifying the business operation variables and relevant variables, it helps to make more accurate business decisions and management.
[0083] Specifically, in step S153, after the business operation variables and relevant variables are clarified, the specific values of these variables need to be extracted from the target business information. The target business information contains various data and materials related to the target customer, such as health examination reports, financial statements, and credit records, etc. By extracting the values of the business operation variables and relevant variables, the key information about the target category can be obtained. These key information are important bases for the insurance company to make business decisions. For example, underwriting decisions, premium calculations, risk assessments, etc. all need to be based on this information.
[0084] As a specific example, in the field of medical and health insurance, assume that in step S140, by analyzing the target preservation information, the target category is obtained as "potential population with high-risk serious diseases". This type of population usually has characteristics such as being older (e.g., over 60 years old), suffering from multiple chronic diseases (such as hypertension, diabetes, coronary heart disease, etc.), and having a family history of major diseases. From the perspective of the insurance company's business, for the "potential population with high-risk serious diseases", the corresponding target business scenario can be set as "in-depth risk assessment and customized protection design scenario". Because the health conditions of this type of population are complex and the probability of future occurrence of serious diseases is relatively high, the insurance company needs to conduct a more in-depth and detailed risk assessment to accurately measure the possible claim risks. Determining the business operation variables corresponding to the above target business scenario may include underwriting decision results, customized premium amounts, and protection scope adjustment items. For the underwriting decision results, the insurance company needs to decide whether to insure the insured according to the risk assessment results of the insured. There are various possibilities for the underwriting decision results, such as acceptance, rejection, conditional acceptance (such as adding special agreements, increasing premiums, etc.). For the customized premium amount, it is necessary to customize the insurance cost according to the risk status of the insured. The determination of the premium amount needs to comprehensively consider various factors, such as the age, health condition, family medical history, and insurance protection scope of the insured. For the protection scope adjustment items, it is necessary to adjust the protection scope of the insurance contract to adapt to the risk status of the insured and the risk tolerance of the insurance company. For example, for certain high-risk diseases, separate claim conditions or claim amount limits can be set. The relevant variables may include physical examination index values, detailed family medical history, and treatment compliance records. The physical examination index values can include various physiological indexes such as blood pressure, blood sugar, blood lipid, liver function, and kidney function. These indexes directly reflect the health condition of the insured and are important bases for risk assessment and premium determination. For example, the premium of a hypertension patient may be relatively high because their risk of suffering from cardiovascular diseases is relatively large. The detailed family medical history can understand information such as the types, onset ages, and disease severity of major diseases in the insured's family. The family medical history has a certain hereditary nature. If there is a family history of a certain major disease, the probability of the insured suffering from that disease may increase, thus affecting the underwriting decision and premium calculation. When the applicant suffers from chronic diseases, their treatment compliance (such as whether to take medicine on time, have regular check-ups, etc.) will affect the control and development of the disease. Good treatment compliance can reduce the risk of future occurrence of serious diseases, and vice versa, it will increase the risk.
[0085] As another specific example, in the field of financial insurance, assume that the target category is "high credit risk investors". The characteristics of such policyholders may include unstable income, an overly high debt ratio (e.g., debt exceeding 80% of income), a low credit score, and a history of multiple overdue repayment records. Therefore, the corresponding target business scenario for the above target category can be "strict credit review and risk mitigation measure formulation scenario". Since the credit risk of such investors is relatively high, insurance companies need to conduct more rigorous credit reviews before underwriting to ensure their ability to fulfill the obligations of the insurance contract. At the same time, in order to reduce the potential loss risk, corresponding risk mitigation measures need to be formulated. For the above target business scenario, the corresponding business operation variables may include whether the credit review is passed, the type and amount of guarantee requirements, and the insurance premium adjustment coefficient. "Whether the credit review is passed" is a key business operation variable that determines whether to provide insurance services to the policyholder. Insurance companies need to make a decision on whether to pass the review based on the results of the credit status review of the policyholder. Regarding the type and amount of guarantee requirements, if the credit risk of the policyholder is relatively high, the insurance company may require it to provide guarantees or collateral. The types of guarantee requirements include suretyship guarantee, mortgage guarantee, pledge guarantee, etc., and the amount of guarantee needs to be determined based on the risk level of the policyholder and the amount of the insurance contract. The insurance premium adjustment coefficient is used to adjust the basic insurance premium according to the credit risk status of the policyholder. The higher the credit risk, the higher the insurance premium adjustment coefficient and the higher the insurance premium. The relevant variables may include income stability indicators, debt structure and amount, and credit default history records, where income stability indicators such as years of work, income fluctuation, and career stability. Policyholders with stable income usually have stronger repayment ability and the ability to fulfill the obligations of the insurance contract, and the credit risk is relatively low. The debt structure and amount can help understand the debt composition of the policyholder, which may include the amounts and repayment terms of mortgage loans, car loans, credit card debts, etc. An overly high debt ratio will increase the repayment pressure of the policyholder, thereby increasing the credit risk. The credit default history record may include information such as the number of overdue repayments, the duration of overdue, and the amount of default. Policyholders with multiple credit default records have relatively high credit risks, and insurance companies need to evaluate their underwriting risks more carefully.
[0086] It can be understood that mapping the target category to a specific business scenario through S151 ensures a strong association between subsequent variable extraction and scenario requirements. S152 constructs a binary structure of "operation variables + relevant variables" through business scenario analysis to form a reusable variable extraction framework. S153 automatically extracts key information based on the scenario variable system to achieve the transformation from unstructured data to structured variables. The extracted key information can directly drive scenario-based decision-making and improve the business response speed. The scenario-variable mapping mechanism can quickly adapt to new business scenarios and reduce the system iteration cost.
[0087] Step S160: Determine the target service interface corresponding to the target category according to the second mapping relationship between the category of the service information and the service interface.
[0088] Specifically, in a service system, different categories of service information need to interact and be processed with their corresponding interfaces and systems to ensure the accuracy and efficiency of the service process. The second mapping relationship can be a pre-established corresponding rule that clarifies the association between each category of service information and a specific service interface. After determining the target category of the target service information, based on this second mapping relationship, the corresponding target service interface can be accurately found, and this interface will be used for subsequent processing and operations on the target service information.
[0089] Specifically, the establishment of the second mapping relationship can classify and define various possible categories of service information according to the requirements and processes of the service, and at the same time determine the corresponding service interfaces. This mapping relationship can be stored in the configuration table of the database or hard-coded in the system in the form of code. For example, for the medical and health insurance business, the following second mapping relationship may be defined: the category of "low-risk healthy population" corresponds to the "regular health information update interface"; the category of "high-risk potential population with serious diseases" corresponds to the "serious disease risk assessment and underwriting interface". According to the target category obtained in the previous steps, the corresponding preservation interface can be searched in the second mapping relationship. This can be achieved in any way, such as through a query operation, querying in the database according to the target category field to find the corresponding interface identifier. Once a matching record is found, the corresponding preservation interface in this record can be determined as the target preservation interface. This interface will be responsible for processing the preservation information related to the target category, including operations such as data reception, verification, processing, and storage.
[0090] As a specific example, in the medical and health insurance scenario, assume the target category is "high-risk potential population with serious diseases". This interface can receive relevant health information of this type of population, such as physical examination reports, family medical history, etc., and perform risk assessment and underwriting processing. In the financial insurance scenario, if the target category is "high-credit-risk investors", the corresponding target preservation interface can be the "high-risk customer credit review interface". This interface will process the financial information, credit records, etc. of the investors to conduct strict credit reviews and risk assessments.
[0091] Step S170: Generate an interface test case corresponding to the target service interface according to the key information corresponding to the target category.
[0092] Specifically, an interface test case is a set of test data and operation steps used to verify the correctness and stability of the target business interface. After determining the target business interface, these test cases can be generated based on the key information corresponding to the target category. The key information includes business operation variables and the values of related variables, which are the core data processed by the interface. By designing reasonable test cases, it can be ensured that the interface can work properly under different input conditions and meet business requirements.
[0093] Specifically, a detailed analysis can be conducted on the key information corresponding to the target category to understand the value ranges, data types, and business rules of each business operation variable and related variable. For example, in the medical health insurance scenario, for the key information of "potential high-risk serious illness population", variables such as age, blood pressure, blood sugar, and family medical history may be included, and it is necessary to clarify the legal value ranges of these variables and the logical relationships between them. According to the key information and business requirements, different test case scenarios can be designed, including normal cases, boundary cases, and abnormal cases. For example, in normal cases, input the key information that conforms to the business rules and value ranges to verify whether the interface can process correctly and return the expected results. For example, test data with an age within a reasonable range, blood pressure and blood sugar values within the normal fluctuation range, and complete and accurate family medical history information can be input to check whether the interface can perform risk assessment and underwriting processing normally. In boundary cases, input the key information close to the boundary of the value range to check the processing ability of the interface under boundary conditions. For example, input test data with the minimum or maximum allowable age value, and blood pressure and blood sugar values close to the critical values to verify whether the interface can correctly judge the risk level. For example, in abnormal cases, input the key information that does not conform to the business rules or value ranges to test the error handling mechanism of the interface. For example, input negative age, unreasonable blood pressure or blood sugar values, and missing necessary family medical history information to check whether the interface can correctly identify and return the corresponding error prompts. Transforming the designed test case scenarios into specific interface test cases can include test case numbers, test case names, input data (values of key information), expected output results, and test steps, etc. Test cases can be managed and executed using specialized test management tools, or automated test scripts can be written for batch testing.
[0094] As a specific example, in the financial insurance scenario, a normal situation test case can be as follows: Test case number: TC-004; Test case name: Normal information test for high credit risk investors; Input data: Monthly income of 3,000 yuan, debt ratio of 85%, credit score of 450 points, with 2 overdue repayment records; Expected output result: The interface returns a credit review result of high risk, and it is recommended to require collateral or increase the premium; Test steps: Call the "Credit review interface for high-risk customers", pass in the above input data, and check whether the result returned by the interface meets the expectations. A boundary situation test case can be as follows: Test case number: TC-005; Test case name: Credit score boundary value test; Input data: Monthly income of 2,500 yuan, debt ratio of 90%, credit score of 300 points, with 3 overdue repayment records; Expected output result: The interface returns a credit review result of extremely high risk, and it is recommended to reject the insurance; Test steps: Call the "Credit review interface for high-risk customers", pass in the above input data, and check whether the result returned by the interface meets the expectations. An abnormal situation test case can be as follows: Test case number: TC-006; Test case name: Abnormal test for negative income; Input data: Monthly income of -500 yuan, debt ratio of 70%, credit score of 500 points, with 1 overdue repayment record; Expected output result: The interface returns an error message indicating that the income input is illegal; Test steps: Call the "Credit review interface for high-risk customers", pass in the above input data, and check whether the error message returned by the interface is correct.
[0095] The solution implemented by the above method, device, equipment, and storage medium for generating interface test cases can achieve logical decoupling by separately setting the second mapping relationship between categories and interfaces, and the first mapping relationship between features and categories. In this way, when the business rules change, only the mapping relationship needs to be adjusted, such as adding a new interface type or modifying the classification threshold, without reconstructing the overall logic, thereby effectively improving the generation efficiency of interface test cases. Moreover, when determining the target feature, the initial feature with the greatest degree of discrimination for business information is determined as the target feature. In this way, even if the business information changes, the target feature can be obtained immediately, and the target feature will not be unable to be determined due to the change of business information. It can be seen that this way of determining the target feature can dynamically adapt to data changes.
[0096] Furthermore, through the solution of the present application, after obtaining the business information, interface test cases corresponding to each target business interface can be automatically generated based on a series of steps. In summary, this solution can effectively improve the generation efficiency of interface test cases.
[0097] In some embodiments of the present invention, as Figure 5 shown, step S170 includes:
[0098] Step S171: Obtain the interface document corresponding to the target business interface and the historical data corresponding to the target category;
[0099] Step S172: Generate an interface request template corresponding to the request format according to the request format;
[0100] Step S173: In the key information and the historical data, match the parameter values that match the request parameters;
[0101] Step S174: Fill the parameter values of the request parameters into the placeholders corresponding to the request parameters in the interface request template;
[0102] Step S175: Generate an interface request according to the request method, request address, and the interface request template;
[0103] Step S176: Request and obtain the interface test cases corresponding to the target business interface according to the interface request.
[0104] Among them, the interface document includes the interface name, request method, request parameters, request format, and request address.
[0105] Specifically, in Step S171, the interface document contains the detailed information required to use the target business interface, which is an important basis for interacting with the interface. Among them, the interface name clarifies the functional direction of the interface; the request method explains the operation method adopted when calling the interface, such as whether it is a request reception or a request sending, etc.; the request parameters are the data items passed to the interface, and different interfaces may have different parameter requirements; the request format stipulates the form of parameter transmission; the request address is the specific network location for calling the interface. The historical data is the relevant information accumulated in the past business processing of the target category. These data can reflect the characteristics and laws of this category in different situations and have important reference value for generating comprehensive interface test cases.
[0106] Specifically, in Step S172, the request format determines the organizational form of data during transmission. Generating an interface request template according to the request format specified in the interface document is to facilitate filling in the specific parameter values in the subsequent steps. Placeholders will be set for each request parameter in the template, and these placeholders will be replaced by the actual parameter values in the subsequent steps.
[0107] Specifically, in Step S173, the key information is the important information corresponding to the target category extracted in the previous steps, and the historical data contains various past situations of this category. Matching the request parameters with this information is to find the specific value corresponding to each request parameter. The parameter value can be preferentially obtained from the key information. If it is not available in the key information, a suitable value is searched for and supplemented from the historical data.
[0108] Specifically, in step S174, after obtaining the specific values of each request parameter, these values are used to replace the placeholders in the interface request template, thereby forming the complete request data.
[0109] Specifically, in step S175, a complete interface request is constructed by combining the request method, request address in the interface document, and the interface request template filled with parameter values. The request method determines how to interact with the interface, the request address specifies the location of the interface, and the filled template is the data content passed to the interface.
[0110] Specifically, in step S176, the generated interface request is sent to the target business interface, and an interface test case is constructed based on the response of the interface. The test case should include detailed information about the request (such as request method, request address, request parameters, etc.), the expected response result, and the actual response result. By comparing the expected result with the actual result, it can be determined whether the interface is working properly, thus completing the test of the interface.
[0111] It can be understood that in step S171, the interface document corresponding to the target business interface and the historical data corresponding to the target category are obtained. The interface document clarifies the various technical specifications of the interface, while the historical data reflects the situation of the target category in the actual business. Generating test cases based on this information can closely fit the actual business scenario, making the test more targeted. For example, in the medical health insurance scenario, by referring to the information of the potential population with high-risk serious diseases in history, various actual possible situations can be accurately simulated for testing. In step S173, parameter values that match the request parameters are matched in the key information and historical data, ensuring that the parameter values used in the test cases conform to the business logic and actual situation. This avoids using random or unreasonable parameters for testing, thereby improving the accuracy of the test cases for verifying the interface function. For example, in the financial insurance scenario, accurately matching parameter values such as the annual income and debt ratio of high-credit-risk investors can more realistically test the credit review function of the interface. In step S172, an interface request template is generated according to the request format, and in step S174, the parameter values are filled into the template. This templated operation method greatly simplifies the process of generating test cases. Once the template is generated, subsequent new test cases can be quickly generated by simply filling in different parameter values, reducing repetitive labor and improving the generation speed of test cases. For example, in the face of test requirements for a large number of different customer information, multiple test cases can be quickly generated using the template. Since the process of generating test cases is more efficient and accurate, it reduces the time and energy occupied by testers, thereby reducing the labor cost. At the same time, accurate test cases can more effectively discover interface problems, avoiding an increase in the cost of fixing later problems caused by insufficient testing. The historical data obtained in step S171 can be reused in multiple test cases, and there is no need to re-collect and organize data for each test case. This not only saves the cost of data collection but also improves the utilization rate of data, further reducing the test cost. Combining historical data and key information can generate test cases covering various normal, abnormal, and boundary situations. In step S176, test cases are obtained according to the interface request. By analyzing the interface responses in different scenarios, the function, performance, and stability of the interface can be comprehensively verified. For example, in the medical health insurance scenario, high-risk populations of different ages and medical histories can be tested to ensure that the interface can handle correctly in various situations. Accurate and comprehensive test cases can discover problems existing in the interface more timely. In the insurance business system, the stability and accuracy of the interface are crucial. Discovering and solving interface problems in a timely manner can avoid errors in the actual business operation and ensure the normal development of the insurance business. When the interface changes, such as changes in the request parameters and request methods in the interface document, only the interface document obtained in step S171 and the corresponding interface request template (step S172) need to be updated, and new test cases can be quickly generated.This flexibility enables the solution to adapt well to interface changes, reducing the testing costs and workloads brought about by interface changes. With the development of insurance business, new target categories and corresponding preservation interfaces may emerge. This solution can generate corresponding test cases according to the established steps by obtaining new interface documents and historical data, thus supporting the testing requirements of new business scenarios and having strong scalability.
[0112] In some embodiments of the present invention, as Figure 6 shown, after step S170, it further includes:
[0113] Step S181, setting an interface test time expression corresponding to the target version;
[0114] Step S182, when the current time meets the interface test time expression, calling the interface test cases of the business interfaces corresponding to the target version pre-generated;
[0115] Step S183, based on the interface test cases, testing each business interface to obtain the test results of each business interface.
[0116] Specifically, in step S181, during the development and maintenance of the business system, different versions of the system may update or optimize the business interfaces. To ensure that these interfaces can work properly in each version, specific test times need to be set. The interface test time expression is a rule for precisely describing the test time arrangement, and it can be defined based on various time units (such as year, month, day, hour, minute, second). By setting such an expression, the test time of the interface can be flexibly arranged, such as conducting comprehensive tests regularly or testing key interfaces at specific time points.
[0117] Specifically, in step S182, the current time can be continuously monitored and compared with the pre-set interface test time expression. When the current time meets the time conditions specified by the expression, the system will automatically call the interface test cases of the business interfaces corresponding to the target version pre-generated in the previous steps. These test cases are generated according to the interface documents, key information, and historical data, and include test cases for various normal, abnormal, and boundary situations, which can comprehensively verify the functions and performances of the interfaces.
[0118] Specifically, in step S183, after invoking the interface test case, the request data in the test case will be sent to the corresponding business interface, and the response information of the interface will be recorded. By comparing the expected result in the test case with the actual response result of the interface, the system can determine whether the interface is working properly. The test results may include information such as whether the interface has successfully responded, whether the response time is within a reasonable range, and whether the returned data meets the expectations. Based on the test results, developers can promptly identify problems with the interface and perform repairs and optimizations.
[0119] As a specific example, in the medical health insurance scenario, assume that a new version of the medical health insurance system is released, in which the "severe disease risk assessment and underwriting interface" is optimized. To ensure that this interface works properly in the new version, the interface test time expression is set to "9:00 on the first working day of each month". This means that at 9 am on the first working day of each month, the test of this interface will be automatically triggered. Such an arrangement can ensure that the key interface is checked at the beginning of each month to promptly detect potential problems. When it is detected that the current time reaches 9 am on the first working day of each month, the interface test cases pre-generated for the new version of the "severe disease risk assessment and underwriting interface" will be automatically invoked. These test cases may include customer information of different ages, different medical histories, and different family medical histories, which are used to simulate various actual situations and comprehensively test the interface. The pre-generated test cases will be sent to the "severe disease risk assessment and underwriting interface" for testing. For example, a test case contains the customer information of a 65-year-old person with a history of hypertension and diabetes and a family history of heart disease inheritance. The expected risk assessment result returned by the interface is "high risk", and corresponding underwriting suggestions are given. After the system sends this case to the interface, the actual response of the interface is recorded. If the actual response is consistent with the expected result, it indicates that the interface works properly under this test case; if not, further investigation of the interface problems is required. Finally, the results of all test cases are summarized to form a test report for this interface.
[0120] As another specific example, in the financial insurance scenario, in a financial insurance system, a new version may have improved the "High-risk Customer Credit Review Interface". To verify the stability of this interface, the interface test time expression is set to "18:00 on Friday every week". Conducting tests at 6 pm every Friday can comprehensively check the interface at the end of a week's work without affecting normal business operations. When the system time reaches 18:00 on Friday every week, according to the time expression of "18:00 on Friday every week", call the interface test cases pre-generated for the new version of the "High-risk Customer Credit Review Interface". The test cases may contain customer data with different income levels, different debt ratios, and different credit scores to verify the accuracy and stability of the interface in various situations. For the "High-risk Customer Credit Review Interface", send the pre-generated test cases to the interface for testing. For example, a test case contains the information of a customer with an annual income of 30,000 yuan, a debt ratio of 80%, and a credit score of 400. It is expected that the interface determines this customer as "high credit risk" and prompts the need for additional guarantee measures. Record the actual response of the interface and compare it with the expected result. Generate a test report for this interface based on the test results of all test cases to provide a basis for the optimization and maintenance of the interface.
[0121] It can be understood that through steps S181 - S183, the interface test can be automatically triggered at a preset time without manual intervention to stop losses in a timely manner. It can regularly detect and quickly discover interface failures, avoid business losses, reduce labor input, reuse test cases, improve test efficiency, ensure that the interface meets the regulatory requirements of the insurance industry, optimize system performance through test data, and support version iteration.
[0122] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention. The non-company software tools or components that appear in the embodiments of this application are only introduced by way of example and do not represent actual use.
[0123] In one embodiment, a device for generating interface test cases is provided, and this generating device corresponds one-to-one with the method for generating interface test cases in the above embodiments. As Figure 7 shown, this generating device includes an acquisition module 710, a first analysis module 720, a second analysis module 730, a classification module 740, an extraction module 750, an interface determination module 760, and a generation module 770. The detailed descriptions of each functional module are as follows:
[0124] The acquisition module 710 is used to acquire business information;
[0125] The first analysis module 720 is configured to analyze the service information to obtain initial features corresponding to the service information;
[0126] The second analysis module 730 is configured to analyze the degree of differentiation of each initial feature with respect to the service information, and determine the initial feature with the greatest degree of differentiation with respect to the service information as the target feature;
[0127] The classification module 740 is configured to classify the target service information according to a first mapping relationship between the value of the target feature in the service information and the category of the service information, to obtain the target category of the target service information;
[0128] The extraction module 750 is configured to extract key information corresponding to the target category from the target service information;
[0129] The interface determination module 760 is configured to determine a target service interface corresponding to the target category according to a second mapping relationship between the category of the service information and the service interface;
[0130] The generation module 770 is configured to generate an interface test case corresponding to the target service interface according to the key information corresponding to the target category.
[0131] In one embodiment, the second analysis module 730 is specifically configured to:
[0132] Analyze the service information to obtain an expected variable of the service information;
[0133] Analyze the correlation between each initial feature and the expected variable, and determine the initial feature with a correlation greater than a first preset value with the expected variable as the target feature.
[0134] In one embodiment, the second analysis module 730 is further configured to:
[0135] When the classification variable of the preset univariate feature selection scoring function is the expected variable, determine the score of the univariate feature selection function for each initial feature;
[0136] Determine the initial feature with a score greater than a second preset value as the target feature.
[0137] In one embodiment, the preset univariate feature selection scoring function is the f_classif function.
[0138] In one embodiment, the extraction module 750 is specifically configured to:
[0139] Analyze the target category to obtain a target service scenario corresponding to the target category;
[0140] Analyze the target business scenario to obtain the business operation variables corresponding to the target business scenario and the relevant variables involved in the business operation variables;
[0141] Extract the values of the business operation variables and the values of the relevant variables in the target business information to obtain the key information of the target category, where the key information includes the values of the business operation variables and the values of the relevant variables.
[0142] In one embodiment, the generation module 770 is specifically configured to:
[0143] Obtain the interface document corresponding to the target business interface and the historical data corresponding to the target category, where the interface document includes the interface name, request method, request parameters, request format, and request address;
[0144] Generate an interface request template corresponding to the request format according to the request format;
[0145] Match the parameter values that match the request parameters in the key information and the historical data;
[0146] Fill the parameter values of the request parameters into the placeholders corresponding to the request parameters in the interface request template;
[0147] Generate an interface request according to the request method, request address, and the interface request template;
[0148] Request to obtain the interface test cases corresponding to the target business interface according to the interface request.
[0149] In one embodiment, the generation module 770 is further configured to:
[0150] Set the interface test time expression corresponding to the target version;
[0151] When the current time satisfies the interface test time expression, call the pre-generated interface test cases of the business interface corresponding to the target version;
[0152] Based on the interface test cases, test each business interface to obtain the test results of each business interface.
[0153] The present invention provides a device for generating interface test cases, which can achieve logical decoupling by separately setting a second mapping relationship between categories and interfaces, and a first mapping relationship between features and categories. In this way, when the business rules change, only the mapping relationship needs to be adjusted, such as adding a new interface type or modifying the classification threshold, without reconstructing the overall logic, thereby effectively improving the efficiency of generating interface test cases. Moreover, when determining the target feature, the initial feature with the greatest degree of discrimination for business information is determined as the target feature. In this way, even if the business information changes, the target feature can be obtained immediately, and the target feature will not be unable to be determined due to the change of business information. It can be seen that the method of determining the target feature in this way can dynamically adapt to data changes.
[0154] Moreover, through the solution of the present application, after obtaining the business information, interface test cases corresponding to each target business interface are automatically generated. In summary, this solution can effectively improve the efficiency of generating interface test cases.
[0155] For the specific limitations on the device for generating interface test cases, reference can be made to the limitations on the method for generating interface test cases in the foregoing text, which will not be elaborated here. Each module in the above-mentioned device for generating interface test cases can be implemented in whole or in part by software, hardware, and their combination. The above-mentioned modules can be embedded in the processor in the computer device in the form of hardware or be independent of the processor, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
[0156] Based on the above method for generating interface test cases, as Figure 8 shown, an embodiment of the present invention further provides a structural schematic diagram of a device for generating interface test cases. The recognition device includes a processor 81 and a memory 82 coupled to the processor 81. The memory 82 stores a computer program. When the computer program is executed by the processor 81, the processor 81 is caused to execute the steps of the method for generating interface test cases in the above-mentioned embodiment.
[0157] For other details of the processor 81 in the above-mentioned device for generating interface test cases to implement the above technical solution, reference can be made to the description in the method for generating interface test cases provided in the above-mentioned embodiment of the invention, which will not be elaborated here.
[0158] Among them, the processor 81 can also be referred to as a CPU (Central Processing Unit). The processor 81 may be an integrated circuit chip with signal processing capabilities. The processor 81 can also be a general-purpose processor, a DSP (Digital Signal Process), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor, or the processor 81 can also be any conventional processor, etc.
[0159] As Figure 9 shown, the embodiment of the present invention also provides a schematic structural diagram of a computer-readable storage medium, on which a readable computer program 91 is stored. Among them, the computer program 91 can be stored in the above storage medium in the form of a software product, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media that can store program codes such as USB flash drives, mobile hard disks, magnetic disks or optical discs, ROM (Read-Only Memory), RAM (Random Access Memory), etc., or terminal devices such as computers, servers, mobile phones, and tablets.
[0160] In several embodiments provided by the present invention, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division. In actual implementation, there may be other division methods. For example, multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces, indirect couplings or communication connections of devices or modules, which can be electrical, mechanical, or other forms.
[0161] The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical modules, that is, they can be located in one place, or they can be distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0162] In addition, in each embodiment of the present invention, each functional module can be integrated into a processing module, or each module can exist physically alone, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0163] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0164] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line) or wirelessly (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium, or a semiconductor medium (such as an SSD (solid state disk)).
[0165] The technical solutions provided by the present invention have been introduced in detail above. Specific examples are used in the present invention to illustrate 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 on the present invention.
[0166] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a system, or a computer program product. Therefore, the present invention can take the form of a complete hardware embodiment, a complete 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, optical storage, etc.) that contain computer-usable program code.
[0167] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and 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 produce a means for implementing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0168] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing devices to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including an instruction means that implements the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0169] These computer program instructions can also be loaded onto a computer or other programmable data processing devices, such that a series of operation steps are executed on the computer or other programmable devices to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable devices 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.
[0170] Obviously, those skilled in the art can make various modifications and variations to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.
Claims
1. A method for generating interface test cases, characterized in that Including: Obtain business information; Analyze the business information to obtain initial features corresponding to the business information; Analyze the degree of discrimination of each initial feature for the business information, and determine the initial feature with the greatest degree of discrimination for the business information as the target feature; Classify the target business information according to the first mapping relationship between the value of the target feature in the business information and the category of the business information, and obtain the target category of the target business information; Extract the key information corresponding to the target category from the target business information; Determine the target business interface corresponding to the target category according to the second mapping relationship between the category of the business information and the business interface; Generate an interface test case corresponding to the target business interface according to the key information corresponding to the target category.
2. The method for generating an interface test case according to claim 1, wherein The analyzing the degree of discrimination of each initial feature for the business information and determining the initial feature with the greatest degree of discrimination for the business information as the target feature includes: Analyze the business information to obtain the expected variable of the business information; Analyze the correlation between each initial feature and the expected variable, and determine the initial feature with a correlation greater than the first preset value with the expected variable as the target feature.
3. The method for generating an interface test case according to claim 2, wherein The analyzing the correlation between each initial feature and the expected variable and determining the initial feature with a correlation greater than the first preset value with the expected variable as the target feature includes: When the classification variable of the preset univariate feature selection scoring function is the expected variable, determine the scores of the univariate feature selection function for each initial feature; Determine the initial feature with a score greater than the second preset value as the target feature.
4. The method for generating an interface test case according to claim 3, wherein The preset univariate feature selection scoring function is the f_classif function.
5. The method for generating an interface test case according to claim 1, wherein The extracting the key information corresponding to the target category from the target business information includes: Analyze the target category to obtain the target business scenario corresponding to the target category; Analyze the target business scenario to obtain the business operation variable corresponding to the target business scenario and the relevant variables involved in the business operation variable; Extract the value of the business operation variable and the value of the relevant variable from the target business information to obtain the key information of the target category, where the key information includes the value of the business operation variable and the value of the relevant variable.
6. The method for generating an interface test case according to claim 1, wherein The generating an interface test case corresponding to the target business interface according to the key information corresponding to the target category includes: Obtain the interface document corresponding to the target business interface and the historical data corresponding to the target category, where the interface document includes the interface name, request method, request parameters, request format, and request address; Generate an interface request template corresponding to the request format according to the request format; Match the parameter values that match the request parameters in the key information and the historical data; Fill the parameter values of the request parameters into the placeholders corresponding to the request parameters in the interface request template; Generate an interface request according to the request method, request address, and the interface request template; Request to obtain the interface test case corresponding to the target business interface according to the interface request.
7. The method for generating an interface test case according to claim 1, wherein After generating the interface test cases corresponding to the target service interface based on the key information corresponding to the target category, the following steps are further included: Set the interface test time expression corresponding to the target version; When the current time meets the interface test time expression, call the pre-generated interface test cases of the service interface corresponding to the target version; Based on the interface test cases, test each service interface to obtain the test results of each service interface.
8. An apparatus for generating interface test cases, characterized in that It includes: An acquisition module for acquiring service information; A first analysis module for analyzing the service information to obtain the initial features corresponding to the service information; A second analysis module for analyzing the degree of discrimination of each initial feature from the service information, and determining the initial feature with the greatest degree of discrimination from the service information as the target feature; A classification module for classifying the target service information according to the first mapping relationship between the value of the target feature in the service information and the category of the service information, to obtain the target category of the target service information; An extraction module for extracting the key information corresponding to the target category from the target service information; An interface determination module for determining the target service interface corresponding to the target category according to the second mapping relationship between the category of the service information and the service interface; A generation module for generating the interface test cases corresponding to the target service interface according to the key information corresponding to the target category.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method for generating the interface test cases according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the method for generating the interface test cases according to any one of claims 1 to 7.