Search

CN-122019366-A - Interface offline comparison test method, device, equipment and storage medium

CN122019366ACN 122019366 ACN122019366 ACN 122019366ACN-122019366-A

Abstract

The application belongs to the technical field of intelligent home/smart home, and particularly relates to an interface offline comparison test method, device, equipment and storage medium, which comprise the steps of receiving production record data, wherein the production record data comprises a first request processed by an actual interface in a production environment, a corresponding first actual return value and a second actual return value returned by an external interface called by the actual interface; reading a first request from production record data, calling a corresponding test interface in an acceptance environment according to the first request, so that the test interface directly generates a corresponding first test return value, or generating a corresponding first test return value based on a second actual return value corresponding to an external interface to be called, comparing the first actual return value with the first test return value, and determining whether the test interface is abnormal. The method can comprehensively cover various business scenes, and meanwhile, the offline execution mode avoids the influence on the performance of the production system.

Inventors

  • GUO YANWEN
  • YIN DESHUAI
  • HUANG TAO
  • YIN FEI

Assignees

  • 青岛海尔科技有限公司
  • 海尔优家智能科技(北京)有限公司
  • 青岛海尔智能家电科技有限公司

Dates

Publication Date
20260512
Application Date
20251225

Claims (10)

  1. 1. An off-line interface comparison test method is characterized by comprising the following steps: Receiving production record data, wherein the production record data comprises a first request processed by an actual interface in a production environment, a corresponding first actual return value and a second actual return value returned by an external interface called by the actual interface; Reading a first request from the production record data, and calling a corresponding test interface in an acceptance environment according to the first request, so that the test interface directly generates a corresponding first test return value, or generates a corresponding first test return value based on a second actual return value corresponding to an external interface to be called; and comparing the first actual return value with the first test return value to determine whether the test interface is abnormal.
  2. 2. The method of claim 1, wherein after invoking the corresponding test interface in the acceptance environment in accordance with the first request, the method further comprises: Intercepting a target operation of calling an external interface by the test interface in the process of processing the first request by the test interface; Determining a second actual return value returned by the external interface based on the first request according to the production record data, and simulating the second actual return value into a second test return value returned by the external interface in the acceptance environment; and acquiring a first test return value generated by the test interface based on the second test return value.
  3. 3. The method of claim 1, wherein the production record data further includes scene information corresponding to the first request, and at least one exception return value returned by the external interface based on the first request; the method further comprises the steps of: Determining whether the first request belongs to a target request or not according to scene information corresponding to the first request and a preset trigger rule, wherein the trigger rule is used for indicating the corresponding relation between the scene information and the target request; if yes, carrying out abnormal response test on the test interface based on at least one abnormal return value returned by the external interface in the production environment; if not, the abnormal response test is not carried out on the test interface.
  4. 4. The method of claim 3, wherein the production record data further comprises a third actual return value generated by the actual interface based on each anomaly return value; The performing an abnormal response test on the test interface based on at least one abnormal return value returned by the external interface in the production environment includes: Determining a target abnormal return value corresponding to the scene information according to a preset mapping relation, wherein the mapping relation is used for indicating the corresponding relation between the scene information and the target abnormal return value; The target abnormal return value is simulated into a test abnormal return value returned by the external interface in the acceptance environment; Acquiring a third test return value generated by the test interface based on the test abnormal return value; and comparing the third actual return value with the third test return value to determine whether the abnormal response test of the test interface is normal.
  5. 5. The method of claim 1, wherein the production record data further includes actual process information corresponding to the first request; If the test interface is determined to be abnormal, the method further comprises the following steps: Acquiring test processing procedure information of the test interface for processing the first request; determining a difference root cause analysis result according to the actual processing process information and the test processing process information; determining corresponding repair suggestions according to the difference root cause analysis result; And generating a task work order based on the difference root cause analysis result and the repair suggestion, and sending the task work order to an operation end so as to repair the abnormality of a test interface by the operation end.
  6. 6. The method of claim 1, wherein after receiving production record data, the method further comprises: Determining an identifier corresponding to each group of target data according to the production record data, wherein the target data comprises a first request, a first actual return value corresponding to the first request and a second actual return value; Storing each group of target data in a preset data table structure in a classified mode, wherein the data table structure comprises a request parameter table for storing a first request and a corresponding identifier, a first return table for storing a first actual return value and a corresponding identifier, and a second return table for storing a second actual return value and a corresponding identifier; correspondingly, a first request and a corresponding identifier are read from the request parameter table, the first actual return value is determined from the first return table according to the identifier, and the second actual return value is determined from the second return table.
  7. 7. The method of claim 4, wherein before determining the target abnormal return value corresponding to the scene information according to the preset mapping relationship, further comprises: extracting a complete link record from historical production record data, wherein the complete link record comprises scene information, at least one abnormal return value returned by a corresponding external interface and a corresponding third actual return value generated by the actual interface; Establishing an association knowledge base according to the complete link record, wherein the association knowledge base is used for indicating association relations of scene information, abnormal return values and influence results; And determining at least one target abnormal return value corresponding to each scene information based on the associated knowledge base and a preset test coverage strategy, wherein the test coverage strategy is used for indicating the abnormal return value with high influence level and/or the coverage of the abnormal return value with high frequency.
  8. 8. An interface offline contrast testing device, characterized in that the device comprises: the receiving module is used for receiving production record data, wherein the production record data comprises a first request processed by an actual interface in a production environment, a corresponding first actual return value and a second actual return value returned by an external interface called by the actual interface; The calling module is used for reading a first request from the production record data and calling a corresponding test interface in an acceptance environment according to the first request so that the test interface directly generates a corresponding first test return value or generates a corresponding first test return value based on a second actual return value corresponding to an external interface to be called; And the comparison module is used for comparing the first actual return value with the first test return value and determining whether the test interface is abnormal or not.
  9. 9. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are adapted to carry out the method of any one of claims 1-7.
  10. 10. An electronic device comprising at least one processor and a memory, wherein, The memory stores computer-executable instructions; The at least one processor executing computer-executable instructions stored in the memory causes the at least one processor to perform the method of any one of claims 1-7.

Description

Interface offline comparison test method, device, equipment and storage medium Technical Field The application belongs to the technical field of intelligent home/smart home, and particularly relates to an interface offline comparison test method, device, equipment and storage medium. Background With the acceleration of enterprise digitization process, the complexity and call volume of system functions increase exponentially, and especially the reconstruction requirements of core service interfaces (such as home appliance control interfaces, payment interfaces, data aggregation interfaces, etc.) are increasing frequently. For example, in the field of home electronics control, the same interface may need to be adapted to tens of equipment models such as refrigerators, air conditioners, water heaters, etc., and to be compatible with the differentiated requirements of new models and old models of production stoppage. When the system architecture is upgraded or the code logic is reconfigured, the development team needs to ensure that the new and old interfaces are completely aligned in terms of functional consistency, data processing logic, external system interaction and the like. However, the conventional test method has the problems of high test data preparation cost, long test period, repeated verification of tens of thousands of test cases by a quality department and high test risk, and can cause production environment faults if the test is insufficient. Under the circumstance, a test method which can not only efficiently cover a real service scene, but also does not depend on additional resource investment is needed to ensure the stability of system reconstruction. Disclosure of Invention In order to solve the above problems, the present application provides an offline interface comparison test method, which includes: Receiving production record data, wherein the production record data comprises a first request processed by an actual interface in a production environment, a corresponding first actual return value and a second actual return value returned by an external interface called by the actual interface; Reading a first request from the production record data, and calling a corresponding test interface in an acceptance environment according to the first request, so that the test interface directly generates a corresponding first test return value, or generates a corresponding first test return value based on a second actual return value corresponding to an external interface to be called; and comparing the first actual return value with the first test return value to determine whether the test interface is abnormal. In one possible implementation manner, after the calling the corresponding test interface in the acceptance environment according to the first request, the method further includes: Intercepting a target operation of calling an external interface by the test interface in the process of processing the first request by the test interface; Determining a second actual return value returned by the external interface based on the first request according to the production record data, and simulating the second actual return value into a second test return value returned by the external interface in the acceptance environment; and acquiring a first test return value generated by the test interface based on the second test return value. In one possible implementation manner, the production record data further comprises scene information corresponding to the first request, and at least one abnormal return value returned by the external interface based on the first request; the method further comprises the steps of: Determining whether the first request belongs to a target request or not according to scene information corresponding to the first request and a preset trigger rule, wherein the trigger rule is used for indicating the corresponding relation between the scene information and the target request; if yes, carrying out abnormal response test on the test interface based on at least one abnormal return value returned by the external interface in the production environment; if not, the abnormal response test is not carried out on the test interface. In one possible implementation, the production record data further includes a third actual return value generated by the actual interface based on each anomaly return value; The performing an abnormal response test on the test interface based on at least one abnormal return value returned by the external interface in the production environment includes: Determining a target abnormal return value corresponding to the scene information according to a preset mapping relation, wherein the mapping relation is used for indicating the corresponding relation between the scene information and the target abnormal return value; The target abnormal return value is simulated into a test abnormal return value returned by the external interface in the acceptance env