Search

CN-115878480-B - KNN-based software testing range evaluation method and device

CN115878480BCN 115878480 BCN115878480 BCN 115878480BCN-115878480-B

Abstract

The application provides a KNN-based software testing range evaluation method and device, wherein the method comprises the steps of obtaining first call chain information of a target software platform, which is affected by code modification; and determining respective second call chain information of each automation test scene corresponding to each interface test case of the target software platform, and determining all automation test scenes corresponding to the code modification by adopting a KNN model based on each first call chain information and each second call chain information so as to generate a test range evaluation report aiming at the code modification of the target software platform. The application can effectively improve the automation degree and the intelligent degree of the software testing range evaluation, and can effectively improve the accuracy and the effectiveness of the software testing range evaluation result, thereby improving the reliability and the efficiency of the test according to the software testing range evaluation result.

Inventors

  • LI YIN

Assignees

  • 中企云链(北京)金融信息服务有限公司

Dates

Publication Date
20260505
Application Date
20221215

Claims (9)

  1. 1. The KNN-based software testing range assessment method is characterized by comprising the following steps of: acquiring first call chain information of each code modification influence of a target software platform; determining respective second call chain information of each automation test scene corresponding to each interface test case of the target software platform, wherein the first call chain information and the second call chain information both contain identifiers of each interface corresponding to a call chain; Based on the first call chain information and the second call chain information, determining all automatic test scenes corresponding to the code modification by adopting a KNN model to generate a test range evaluation report aiming at the code modification of the target software platform; based on the first call chain information and the second call chain information, determining all automatic test scenes corresponding to the code modification by adopting a KNN model to generate a test range evaluation report aiming at the code modification of the target software platform, wherein the test range evaluation report comprises: Inputting the first call chain information and the second call chain information into a preset KNN model, so that the KNN model respectively calculates distance values between interfaces and service scenes in the first call chain information and the second call chain information based on a preset Euclidean algorithm to obtain a distance set; Arranging all the distance values in the distance set from small to large, and selecting the first K distance values in the arranged distance set, wherein K is a positive integer equal to or greater than 1; determining second call chain information corresponding to the first K distance values as target second call chain information, and taking an automatic test scene corresponding to each target second call chain information as test range evaluation data for the current code modification of the target software platform; And generating a corresponding test range evaluation report based on the test range evaluation data, and outputting the test range evaluation report.
  2. 2. The KNN-based software testing range evaluation method according to claim 1, wherein the obtaining the first call chain information of the code modification effect of the target software platform includes: Acquiring each call chain data of a target software platform to generate a corresponding call chain model, wherein each call chain data comprises an identifier of each interface corresponding to the call chain; Determining the corresponding relation between each method corresponding to the code modified by the target software platform and each interface so as to generate a corresponding code tree structure model; And generating a corresponding call chain and code tree structure model based on the interfaces in the call chain model and the code tree structure model, and searching the call chain and the corresponding interface identifications influenced by the code modification of the target software platform from the call chain and the code tree structure model to obtain corresponding first call chain information.
  3. 3. The KNN-based software testing scope evaluation method of claim 2, wherein the obtaining the respective call chain data of the target software platform to generate the corresponding call chain model includes: calling all current call chain data of the target software platform from a preset database, wherein the call chain data in the database are collected in advance through an open source call chain client; performing de-duplication processing on each call chain data; and generating a call chain model by adopting the call chain data subjected to the deduplication processing, so that the call chain model is used for storing the corresponding relation between each call chain and a plurality of interfaces.
  4. 4. The KNN-based software testing range evaluation method according to claim 2, wherein determining the correspondence between each method corresponding to the code modified by the target software platform and each interface, respectively, to generate a corresponding code tree structure model includes: Determining each line of codes modified by the target software platform at this time based on a comparison interface of a code warehouse; And respectively determining the corresponding relation between the method corresponding to each code and the interfaces by adopting the open source technology corresponding to the code warehouse so as to generate a code tree structure model for storing the corresponding relation between each method corresponding to each code and a plurality of interfaces.
  5. 5. The KNN-based software testing scope evaluation method of claim 2, wherein the determining the respective second call chain information for each automation testing scenario corresponding to each interface testing case of the target software platform includes: receiving each piece of automatic test scene data respectively representing different service scenes, wherein the automatic test scene data is obtained in advance based on each interface test case of the target software platform, and the interface test cases comprise interface parameters and return values; Generating corresponding test cases and interface case models according to the corresponding relations between each business scene and a plurality of interfaces; And searching the corresponding relation between the service scene and the call chain data based on the call chain model and the interfaces in the test case and interface case model to obtain second call chain information corresponding to the service scene, wherein the second call chain information is used for storing the corresponding relation among the service scene, the call chain and the identifiers of the corresponding interfaces.
  6. 6. The KNN-based software testing scope evaluation method of claim 1, wherein before the determining, using a KNN model, all automation testing scenarios corresponding to the current code modification based on the respective first call chain information and the respective second call chain information to generate a testing scope evaluation report for the current code modification of the target software platform, further comprises: Based on the corresponding relation between each method corresponding to the historical call chain data and the historical modification code of the target software platform and each interface, obtaining each first historical call chain information influenced by the historical modification code of the target software platform; determining second historical call chain information related to an automatic test scene corresponding to each interface test case of the target software platform; And training by adopting the first history call chain information and the second history call chain information to obtain the KNN model.
  7. 7. A KNN-based software testing range evaluation device, comprising: The code influence data acquisition module is used for acquiring first call chain information of the code modification influence of the target software platform; The test scene data acquisition module is used for determining respective second call chain information of each automation test scene corresponding to each interface test case of the target software platform, wherein the first call chain information and the second call chain information both comprise identifiers of each interface corresponding to a call chain; The automatic test range evaluation module is used for determining all automatic test scenes corresponding to the code modification by adopting a KNN model based on the first call chain information and the second call chain information so as to generate a test range evaluation report aiming at the code modification of the target software platform; based on the first call chain information and the second call chain information, determining all automatic test scenes corresponding to the code modification by adopting a KNN model to generate a test range evaluation report aiming at the code modification of the target software platform, wherein the test range evaluation report comprises: Inputting the first call chain information and the second call chain information into a preset KNN model, so that the KNN model respectively calculates distance values between interfaces and service scenes in the first call chain information and the second call chain information based on a preset Euclidean algorithm to obtain a distance set; Arranging all the distance values in the distance set from small to large, and selecting the first K distance values in the arranged distance set, wherein K is a positive integer equal to or greater than 1; determining second call chain information corresponding to the first K distance values as target second call chain information, and taking an automatic test scene corresponding to each target second call chain information as test range evaluation data for the current code modification of the target software platform; And generating a corresponding test range evaluation report based on the test range evaluation data, and outputting the test range evaluation report.
  8. 8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the KNN-based software test range assessment method of any one of claims 1 to 6 when the computer program is executed by the processor.
  9. 9. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the KNN-based software test range evaluation method according to any one of claims 1 to 6.

Description

KNN-based software testing range evaluation method and device Technical Field The application relates to the technical field of data processing, in particular to a KNN-based software testing range evaluation method and device. Background For a software platform of a micro-service architecture such as a cloud chain platform, more service architects design the software platform product, the requirements are designed from the product and the service side, the evaluated scope is also based on service dependence, especially on the design of basic functions, the influence surface is larger, even the adjustment of one interface affects other platforms, and therefore the test scope needs to be evaluated on the whole. Development is generally to track interfaces affected by methods through development tools (eclipse or IDE) for service transformation, and the method is accurate for evaluating the service transformation, but for a micro-service architecture, service is invoked by feign and each micro-service is responsible by each team, so that the problems of low communication efficiency and inaccurate evaluation exist. At present, the evaluation of the functional test on the test range of the software platform mainly comprises the steps of outputting a version of test case range according to the familiarity degree of a requirement design document, a developer and a tester on the cloud chain platform, supplementing the test case in the test process, and frequently generating operation and maintenance problems in production, wherein the result shows that the test case or the test range is incorrectly evaluated to account for the main part according to the analysis on the operation and maintenance problems. Therefore, there is a need to design a method that can improve the automation degree of the software testing range evaluation process and the accuracy of the software testing range evaluation result. Disclosure of Invention In view of this, embodiments of the present application provide a KNN-based software test range evaluation method and apparatus to obviate or ameliorate one or more of the disadvantages of the prior art. One aspect of the present application provides a KNN-based software test range evaluation method, including: acquiring first call chain information of each code modification influence of a target software platform; determining respective second call chain information of each automation test scene corresponding to each interface test case of the target software platform, wherein the first call chain information and the second call chain information both contain identifiers of each interface corresponding to a call chain; And determining all automatic test scenes corresponding to the code modification by adopting a KNN model based on the first call chain information and the second call chain information so as to generate a test range evaluation report aiming at the code modification of the target software platform. In some embodiments of the present application, the obtaining the information of each first call chain affected by the current code modification of the target software platform includes: Acquiring each call chain data of a target software platform to generate a corresponding call chain model, wherein each call chain data comprises an identifier of each interface corresponding to the call chain; Determining the corresponding relation between each method corresponding to the code modified by the target software platform and each interface so as to generate a corresponding code tree structure model; And generating a corresponding call chain and code tree structure model based on the interfaces in the call chain model and the code tree structure model, and searching the call chain and the corresponding interface identifications influenced by the code modification of the target software platform from the call chain and the code tree structure model to obtain corresponding first call chain information. In some embodiments of the present application, the obtaining the call chain data of the target software platform to generate the corresponding call chain model includes: calling all current call chain data of the target software platform from a preset database, wherein the call chain data in the database are collected in advance through an open source call chain client; performing de-duplication processing on each call chain data; and generating a call chain model by adopting the call chain data subjected to the deduplication processing, so that the call chain model is used for storing the corresponding relation between each call chain and a plurality of interfaces. In some embodiments of the present application, the determining the correspondence between each method corresponding to the code modified by the target software platform and each interface to generate a corresponding code tree structure model includes: Determining each line of codes modified by the target software platform at this