CN116414675A - Model generation method applied to interface test, interface test method and device - Google Patents

Model generation method applied to interface test, interface test method and device Download PDF

Info

Publication number
CN116414675A
CN116414675A CN202111655978.8A CN202111655978A CN116414675A CN 116414675 A CN116414675 A CN 116414675A CN 202111655978 A CN202111655978 A CN 202111655978A CN 116414675 A CN116414675 A CN 116414675A
Authority
CN
China
Prior art keywords
defect
mutation
test data
data
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111655978.8A
Other languages
Chinese (zh)
Inventor
林晓升
高玉军
刘璐辰
邹意林
卢凯旋
曹紫光
张天泽
杨萍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202111655978.8A priority Critical patent/CN116414675A/en
Publication of CN116414675A publication Critical patent/CN116414675A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the disclosure provides a model generation method, an interface test method and equipment applied to interface test, wherein the historical defect data is used for representing coding defects of at least one defect type of a target application interface by acquiring the historical defect data; generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types; and generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating mutation test data, the mutation test data is input data of the target application interface, and the mutation test data is used for triggering coding defects of the defect type corresponding to the target application interface. Because the historical defect data can represent the defect type of the coding defect which appears on the target application interface, the online learning model generated based on the historical defect data can generate variation test data matched with the historical defect data, and the interface test efficiency and effectiveness are improved.

Description

Model generation method applied to interface test, interface test method and device
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a model generation method applied to interface test, an interface test method and equipment.
Background
Interface testing in the application development process is an important link for ensuring the quality of application programs, and currently, the testing mode of application results is usually realized based on a fuzzy testing technology, namely, the application is input through random data generated automatically or semi-automatically, and possible program defects are found according to the result that the application calls a corresponding interface to process the random data.
However, due to the complexity of the application program, in the prior art, the interface in the program is tested by random data, which results in larger randomness of the test result, difficulty in testing the program defect, or longer time consumption, so that the problems of low test efficiency and poor effectiveness in the interface test process are caused.
Disclosure of Invention
The embodiment of the disclosure provides a model generation method, an interface test method and equipment applied to interface test, so as to solve the problems of low test efficiency and poor effectiveness in the interface test process.
In a first aspect, an embodiment of the present disclosure provides a model generating method applied to an interface test, including:
Acquiring historical defect data, wherein the historical defect data represents coding defects of at least one defect type of a target application interface; generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types; and generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating mutation test data, the mutation test data is input data of the target application interface, and the mutation test data is used for triggering coding defects of the defect type corresponding to the target application interface.
In a second aspect, an embodiment of the present disclosure provides an interface testing method, including:
acquiring initial test data, wherein the initial test data is input data of a target application interface; performing mutation on the initial test data based on a preset online learning model to generate mutation test data, wherein the mutation test data is used for triggering the coding defects of the defect types corresponding to the target application interfaces, and the online learning model is generated based on the model generation method applied to interface test according to the first aspect and various possible designs of the first aspect; and testing the target application interface through the variation test data to obtain a test result.
In a third aspect, an embodiment of the present disclosure provides a model generating apparatus applied to an interface test, including:
the acquisition module is used for acquiring historical defect data, wherein the historical defect data represents coding defects of at least one defect type of the target application interface;
the first generation module is used for generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types;
the second generation module is used for generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating mutation test data, the mutation test data are input data of the target application interface, and the mutation test data are used for triggering coding defects of the defect types corresponding to the target application interface.
In a fourth aspect, an embodiment of the present disclosure provides an interface test apparatus, including:
the acquisition module is used for acquiring initial test data, wherein the initial test data is input data of a target application interface;
the generation module is used for mutating the initial test data based on a preset online learning model to generate mutation test data, wherein the mutation test data is used for triggering the coding defects of the defect types corresponding to the target application interfaces, and the online learning model is generated based on the model generation method applied to the interface test according to the first aspect and various possible designs of the first aspect;
And the test module is used for testing the target application interface through the variation test data to obtain a test result.
In a fifth aspect, embodiments of the present disclosure provide an electronic device, including:
a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored in the memory to implement the model generation method applied to the interface test as described in the first aspect and the various possible designs of the first aspect, or to implement the interface test method as described in the second aspect and the various possible designs of the second aspect.
In a sixth aspect, embodiments of the present disclosure provide a computer readable storage medium, where computer executable instructions are stored, when executed by a processor, to implement a model generating method applied to an interface test as described in the first aspect and the various possible designs of the first aspect, or implement an interface test method as described in the second aspect and the various possible designs of the second aspect.
In a seventh aspect, embodiments of the present disclosure provide a computer program product comprising a computer program which, when executed by a processor, implements the model generation method applied to interface testing as described in the first aspect and the various possible designs of the first aspect, or implements the interface testing method as described in the second aspect and the various possible designs of the second aspect.
According to the model generation method, the interface test method and the device applied to the interface test, historical defect data are obtained, and the historical defect data represent coding defects of at least one defect type of a target application interface; generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types; generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating variant test data, the variant test data are input data of the target application interface, the variant test data are used for triggering coding defects of the corresponding defect types of the target application interface, and the online learning model is used for testing the coding defects of the target application interface. Because the historical defect data can represent the defect types of the coding defects which occur to the target application interface, the online learning model generated based on the historical defect data can generate variation test data matched with the historical defect data, so that the coding defects of the target application interface can be triggered more effectively when the target application interface is tested based on the variation test data, and the interface test efficiency and effectiveness are improved.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the solutions in the prior art, a brief description will be given below of the drawings that are needed in the embodiments or the description of the prior art, it being obvious that the drawings in the following description are some embodiments of the present disclosure, and that other drawings may be obtained from these drawings without inventive effort to a person of ordinary skill in the art.
Fig. 1 is an application scenario diagram of an interface testing method provided in an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of an application interface for detecting data through mutation testing according to an embodiment of the disclosure;
fig. 3 is a flowchart of a model generating method applied to interface testing according to an embodiment of the present disclosure;
FIG. 4 is a flowchart showing an implementation of step S103 in the embodiment shown in FIG. 3;
FIG. 5 is a schematic diagram of a defect probability matrix according to an embodiment of the present disclosure;
FIG. 6 is a schematic diagram of another defect probability matrix provided by an embodiment of the present disclosure;
fig. 7 is a schematic flow chart diagram II of a model generating method applied to interface testing according to an embodiment of the present disclosure;
FIG. 8 is a schematic diagram of determining a defect probability matrix from a plurality of defect record groups according to an embodiment of the present disclosure;
Fig. 9 is a flowchart of a first interface testing method according to an embodiment of the disclosure;
FIG. 10 is a schematic diagram of variation test data generated by an online learning model provided by an implementation of the present disclosure;
fig. 11 is a second flowchart of an interface testing method according to an embodiment of the disclosure;
FIG. 12 is a schematic diagram of a variation strategy set according to an embodiment of the present disclosure;
FIG. 13 is a flowchart showing an implementation of step S404 in the embodiment shown in FIG. 11;
FIG. 14 is a schematic diagram of a process for generating test results according to an embodiment of the present disclosure;
fig. 15 is a flowchart of a third embodiment of an interface testing method according to the present disclosure;
FIG. 16 is a schematic diagram of another process for generating test results provided by embodiments of the present disclosure;
FIG. 17 is a block diagram of a model generating device for interface testing according to an embodiment of the present disclosure;
FIG. 18 is a block diagram of an interface test apparatus provided by an embodiment of the present disclosure;
fig. 19 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure;
fig. 20 is a schematic hardware structure of an electronic device according to an embodiment of the disclosure.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some embodiments of the present disclosure, but not all embodiments. All other embodiments, which can be made by one of ordinary skill in the art without inventive effort, based on the embodiments in this disclosure are intended to be within the scope of this disclosure.
The application scenario of the embodiments of the present disclosure is explained below:
fig. 1 is an application scenario diagram of an interface testing method provided by an embodiment of the present disclosure, where the interface testing method provided by the embodiment of the present disclosure and a model generating method applied to interface testing may be applied to a scenario of performing a fuzzy test on an application interface of an application program. Specifically, as shown in fig. 1, the method provided by the embodiment of the disclosure may be applied to a test terminal, where the test terminal is respectively in communication connection with a server and a terminal device, the server is in communication connection with the terminal device, a server side of a target application is running in the server, and a client side of the target application is running in the terminal device. And a plurality of application interfaces are respectively arranged in the server side and the client side of the target application and used for realizing corresponding functions. The test terminal judges whether the service end and/or the client of the target application have coding defects or not by sending test data to an application interface of the service end and/or the client and monitoring the program running condition of the service end and/or the client. Of course, in another possible implementation manner, both the server side and the client side of the target application run in the test terminal, where the server side and the client side communicate inside the test terminal, and the test terminal implements generation of a model and testing of the server side and the client side based on the model by using the interface test method and the model generation method for interface test provided in the embodiment.
In the prior art, the testing of an application interface is generally implemented based on a fuzzy testing technology, that is, by automatically or semi-automatically generating random data to be input into an application, whether an abnormality occurs according to a result of the application after calling the corresponding interface to process the random data, for example, program crash, assertion (Assertion) failure, etc., so as to discover possible program defects. In the process, in order to trigger the abnormality of the program as much as possible, in the related art, by changing the modes of the interface request or the content returned by the interface, and the like, variant test data is generated, and is generally illegal data which cannot be processed by the application interface, therefore, the application interface is tested by the variant test data, and the result of processing the variant test data by the application interface is monitored, namely, whether the program abnormality is caused or not, so that the purpose of detecting the robustness of the application interface can be realized. Fig. 2 is a schematic diagram of an application interface for detecting test Data through mutation, as shown in fig. 2, in original test Data data_1, two fields including a and b, corresponding field values are respectively "1" and "20", i.e. field values of the two fields a and b are respectively a shaping value; the original test Data data_1 can be used as input Data of the application interface A and is normally called by the application interface A; after the original test Data is mutated, mutation test Data data_2 is generated, wherein the mutation test Data comprises an a field and a b field, the corresponding field values are Null and wire respectively, namely the field value of the a field is Null, and the field value of the a field is a Boolean value. After receiving the mutated test Data data_2, the application interface a cannot normally process "Null" and "wire" of the a and b fields, and in normal case, in the program coding of the application interface a, such illegal input is identified by means of assertion and other forms, and a prompt is given. However, when the program code of the application interface a has a defect, which causes program exception problems such as assertion failure, program crash, and the like. Therefore, the robustness test of the application interface can be realized by inputting the mutation test data into the application interface and detecting the test result after the application program calls the application interface to process the mutation test data.
From the above, in the process of testing the application interface, the quality of the mutation test data corresponding to the application interface (i.e. the matching degree between the mutation type of the mutation test data and the application interface) directly affects the probability of triggering the application exception, that is, the higher the quality of the mutation test data, the greater the probability of triggering the coding defect of the application interface, and the higher the number of defects and the test efficiency that can be found. The generation of the variation test data is usually realized based on an online learning model, and the online learning model can adjust the weight value in the model by continuously executing the cycle of test-learning, so that the variation test data with higher quality can be produced after the cycle of test-learning for a period of time passes, and the test efficiency of an application interface is improved.
However, in the prior art, in the initial stage of the construction of the online learning model, since no priori knowledge exists, when the online learning model is put into use for the first time, the weight values of various variation types in the model are randomly generated, and only after one-end time learning, the effect of improving the test effect can be achieved. The embodiment of the disclosure provides a model generation method applied to interface test to solve the problems.
Fig. 3 is a flowchart illustrating a method for generating a model for interface testing according to an embodiment of the present disclosure. The method of the embodiment can be applied to a first terminal device, and the model generating method applied to interface testing comprises the following steps:
step S101, obtaining historical defect data, wherein the historical defect data represents coding defects of at least one defect type of a target application interface.
Illustratively, the historical defect data is data generated during a previous historical test task and a previous historical test, and in one possible implementation, at least statistical information of defects is encoded in the historical defect data, for example, defect types and occurrence times corresponding to the defect types; in another possible implementation, the historical defect data includes more than one defect record, where the defect record is a coded defect detected during a previous test procedure or test task, and the defect record may represent a test result of one interface test. Illustratively, the defect record may include description information such as defect identification, defect type, test time, anomaly information, etc., by which a coded defect of one defect type may be determined.
Further, the defect type of the encoding defect characterized by the historical defect data is the same as the defect type of the encoding defect possibly existing in the target application interface, for example, the defect type A is "the input parameter is an empty string and causes program breakdown", the defect type B is "the input parameter exceeds a boundary value and causes program breakdown", the defect type C is "the input parameter character length is too long and causes program breakdown", the defect type of the encoding defect characterized by the historical defect data comprises the defect type A, the defect type B and the defect type C, and correspondingly, the defect type of the encoding defect possibly existing in the interface a as the target application interface also comprises the defect type A, the defect type B and the defect type C. The defect type recorded in the history defect data may be obtained by testing the interface a in the previous testing process, or may be obtained by testing other application interfaces, such as the interface b and the interface c, or even other application programs, which is not limited herein, so long as the coding defect recorded in the history defect data can be triggered by the target application interface. Therefore, in this embodiment, the test priori knowledge of the target application interface is obtained by obtaining the historical defect data, and in the application scenario of the application interface test, the technical characteristics of the interface test determine that the historical defect data is not limited to the historical test task of the same application interface, so that the problem of lack of test priori knowledge of the application interface which is not tested, such as a newly added application interface, can be solved.
It should be noted that, in the defect type of the coding defect described in this embodiment, by taking the defect type a as an example, when the input parameter is an empty string and the program crashes, it may be due to the fact that when the application interface processes the input parameter, the input parameter is an empty character, and the program is not provided with a correct assertion, so that the method corresponding to the application interface cannot be correctly called, and further, the method is wrongly reported and the program crashes, so that the defect type X may also be described as "the input parameter of the type X is not provided with a correct assertion". Therefore, in the present embodiment, the encoding defects of different defect types refer to defects caused by different types of input data. The specific representation and description modes of the defect types can be set according to requirements, and specific details and limitations are not repeated here.
Step S102, generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types.
For example, for coding defects in an application program, due to coding habits of different developers and the common degree of types of input data, the occurrence probability of the different types of coding defects is caused, and the coding defects are not uniformly distributed, for example, for a target application interface, the input data of a data type #1 (such as boundary value data) is one common type of input data, therefore, in the development process of the application program, the developer usually sets corresponding detection and assertion for the input data of the data type #1, so as to avoid program breakdown; whereas for data type #2 (e.g., an ultralong string), it is a rare type of input data, and thus the developer often forgets to set the corresponding detection and assertion. Meanwhile, for different developers, coding defects corresponding to the defect types can be generated correspondingly due to different coding habits in the development process.
Through the historical defect data, defect records or defect statistics can be obtained in the previous testing process and used as priori knowledge, a defect probability matrix representing the occurrence probability of the coding defects of different defect types is constructed, the probability of the coding defects of different defect types can be evaluated through the defect probability matrix, and further, the purpose of finding the coding defects can be achieved rapidly through the probability of the coding defects of different defect types.
In this example, the history defect data includes at least one defect record, and the defect record characterizes the detected coding defect during the history test, as shown in fig. 4, and step S102 includes two specific implementation steps of steps S1021 and S1022:
step S1021, determining the number of defect records corresponding to different defect types according to the defect records in the history defect data.
Step S1022, generating a defect probability matrix according to the number of defect records corresponding to different defect types.
Illustratively, the defect records in the historical defect data may characterize the test results of the last interface test historically. For example, the defect records may include description information such as defect identification, defect type, test time, and anomaly information, and the statistical number of defect records corresponding to different defect types may be determined by classifying and counting the description information in the defect records, and then the defect probability matrix may be generated by performing normalization processing according to the statistical number of defect records corresponding to each defect type.
Fig. 5 is a schematic diagram of a defect probability matrix provided by an embodiment of the present disclosure, referring to fig. 5, the defect probability matrix is a 1*N matrix, N is an integer greater than 1, each element in the defect probability matrix corresponds to a defect type, each element value represents an occurrence probability of a coding defect corresponding to the defect type, and as shown in fig. 5, the occurrence probability corresponding to the defect type a is 0.2; the occurrence probability corresponding to the defect type B is 0.1; the occurrence probability corresponding to the defect type C is 0.04.
Fig. 6 is a schematic diagram of another defect probability matrix provided in an embodiment of the present disclosure, referring to fig. 6, the defect probability matrix is a matrix of m×n, M is an integer greater than 1, where a row in the defect probability matrix represents occurrence probability of a coding defect of different defect types corresponding to a developer, and a column in the defect probability matrix represents occurrence probability of a coding defect of one defect type. As shown in fig. 6, according to the defect probability matrix, for the developer user_1, the occurrence probability of the coding defect of the defect type a is 0.2, and the occurrence probability of the coding defect of the defect type B is 0.1; for developer user_2, the probability of occurrence of the encoding defect of defect type a is 0.12, and the probability of occurrence of the encoding defect of defect type B is 0.08. In this embodiment, the defect probability matrix formed by the data of two dimensions of the developer and the coding type can further improve the evaluation fineness and accuracy of the occurrence probability of the coding defects of different defect types, thereby improving the test efficiency. The developer dimension data may also be obtained from description information of defect records in the historical defect data, which is not described herein.
Step S103, generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating mutation test data, the mutation test data is input data of a target application interface, and the mutation test data is used for triggering coding defects of the defect type corresponding to the target application interface.
First, a simple introduction is made on an online learning (online learning) model, also called as a multi-arm betting Machine (MBA) model, which is a technology for updating a model by using feedback information, and the whole feedback training process of the online learning model can be converted into solving the problems of exploration and utilization (Exploration vs Exploitation). In the initial stage of model operation, the online learning model needs to continuously explore and collect data in the feedback process due to lack of priori knowledge, and then the weight matrix in the model is continuously optimized to complete training by utilizing the collected data. For a traditional online learning model, an initial weight matrix in the model is generally constructed based on an equal probability (equal weight) mode, so that in the initial stage of operation of the online learning model, data output based on the online learning model is also random data or traversal data correspondingly.
In the application scenario provided by the embodiment of the disclosure, the online learning model is used for generating mutation test data of a specific defect type, the online learning model comprises a mutation weight matrix, and the online learning model generates a mutation test matrix of a corresponding mutation type based on the mutation weight matrix. Further, the mutation test data is input data of a target application interface, after the mutation test data is input into the target application interface, the target application interface is called, a corresponding method is called to process the mutation test data, when the target application interface has coding defects, the mutation test data can be triggered to cause program breakdown and other anomalies, and therefore the detection of the robustness of the target application interface is achieved.
Wherein, illustratively, generating the online learning model according to the defect probability matrix comprises: determining an initial variation weight matrix according to the defect probability matrix, wherein the initial variation weight matrix represents the generation probability of variation test data of different variation types when the online learning model runs for the first time; and generating an online learning model according to the initial variation weight matrix. The defect probability matrix has a corresponding relation with the initial variation weight matrix (one state of the variation weight matrix), and elements in the defect probability matrix correspond to elements in the initial variation weight matrix one by one. Further, the elements in the defect probability matrix correspond to defect types, the elements in the initial mutation weight matrix correspond to mutation types, and the defect types and the mutation types have a corresponding relationship, for example, the defect type a is "the input parameter is an empty string and causes program breakdown", the corresponding mutation type is "the input parameter is mutated to an empty character", the defect type B is "the input parameter exceeds the boundary value and causes program breakdown", and the corresponding mutation type is "the input parameter is set to a value exceeding the boundary value". From the above, the mutation type corresponding to the defect type is the type of mutation test data of the coding defect capable of triggering the defect type. Therefore, the initial variation weight matrix (variation weight matrix) can be correspondingly determined through the defect probability matrix, so that the online learning model can generate variation test data matched with the defect probability matrix, and further, coding defects of high probability defect types in the defect probability matrix can be triggered when the subsequent test is performed based on the variation test data.
In this embodiment, since the online learning model is generated based on the defect probability matrix, more specifically, the initial variation weight matrix of the online learning model is generated based on the defect probability matrix, and the defect probability matrix is generated by using the historical defect data, so that the information of occurrence probability of the coding defects of different defect types can be represented, the variation test data with better quality can be generated based on the initial variation weight matrix generated by the defect probability matrix, and compared with the scheme of using the initial variation weight matrix with equal weight in the traditional online learning model, the method can enable the online model to converge more quickly, so that the coding defects can be detected more quickly when the target application interface is tested based on the online learning model in the initial stage of model operation, and the detection efficiency is improved.
Further, the online learning model is used for testing coding defects of the target application interface. After the online learning model is generated, variant test data are generated to test the target application interface based on the online learning model, so that a test result can be obtained, and the test result comprises the defect type of the coding defect of the target application interface. And then, updating a variation weight matrix in the online learning model according to the defect type of the coding defect of the target application interface, so that the online learning model can be continuously optimized, and the variation test data generated by the online learning model can be further improved along with the continuous progress of a test task, thereby further improving the test efficiency and the test effect.
According to the model generation method, the interface test method and the device applied to the interface test, the historical defect data are obtained, and the historical defect data represent coding defects of at least one defect type of a target application interface; generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types; and generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating mutation test data, the mutation test data is input data of a target application interface, the mutation test data is used for triggering coding defects of the corresponding defect types of the target application interface, and the online learning model is used for testing the coding defects of the target application interface. Because the historical defect data can represent the defect types of the coding defects which occur to the target application interface, the online learning model generated based on the historical defect data can generate variation test data matched with the historical defect data, so that the coding defects of the target application interface can be triggered more effectively when the target application interface is tested based on the variation test data, and the interface test efficiency and effectiveness are improved.
Fig. 7 is a schematic flow chart diagram of a model generation method applied to interface testing according to an embodiment of the present disclosure. In this embodiment, steps S101, S102 and S103 are further refined, and a step of updating an online learning model is added, and the model generating method applied to the interface test includes:
step S201, historical defect data is obtained, wherein the historical defect data comprises defect records and user identifiers corresponding to the defect records one by one, and the user identifiers are used for representing developers corresponding to the defect records.
Step S202, classifying the defect records in the history defect data according to the user identification, and generating at least one group of defect record groups, wherein the defect record groups comprise at least one defect record corresponding to the same user identification.
Illustratively, in the historical defect data, each defect record corresponds to a user identifier for characterizing a developer corresponding to the defect record, and more specifically, the user characterization indicates the developer writing the interface corresponding to the defect record. Because different developers have different coding habits and coding levels, each defect record in the historical defect data is classified according to different user identifications, and a defect record group corresponding to each developer is generated.
Step S203, determining the number of defect records corresponding to different defect types in each defect record group according to the defect records in each defect record group.
Step S204, generating a defect probability matrix according to the number of defect records corresponding to different defect types in each defect record group, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types corresponding to each user identifier.
For example, fig. 8 is a schematic diagram of determining a defect probability matrix according to a plurality of defect record groups according to an embodiment of the present disclosure, as shown in fig. 8, defect records (shown as record_1 to record_30 in the drawings) corresponding to the same developer (shown as user_1, user_2, user_3 in the drawings) in the history defect data in the defect record groups (shown as #1, #2, #3 in the drawings), and the defect records in each defect record group are counted to determine the number of defect records corresponding to different defect types. Further, a defect probability matrix is generated according to the number of defect records corresponding to different defect types, wherein the defect probability matrix can be referred to as a defect probability matrix shown in fig. 6, each row of elements of the defect probability matrix corresponds to the same developer, and each column of the defect probability matrix corresponds to one defect type. The probability of occurrence of the coding defect can be determined from two dimensions of a developer and a defect type through the defect probability matrix generated in the steps of the embodiment, so that the accuracy of the subsequently generated mutation test data is improved.
Step S205, determining a defect probability array corresponding to at least one user identifier according to the defect probability matrix, wherein the user identifier is used for indicating a developer, and the defect probability array is used for representing occurrence probabilities of coding defects of different defect types.
Step S206, determining an initial variation weight array corresponding to each user identifier according to each defect probability array, wherein the initial variation weight array represents the generation probability of variation test data of different variation types when the online learning model runs for the first time.
Step S207, generating an initial variation weight matrix according to the initial variation weight array corresponding to each user identifier, wherein the initial variation weight matrix characterizes the generation probability of variation test data of different variation types corresponding to each user identifier when the online learning model runs for the first time.
Step S208, generating an online learning model according to the initial variation weight matrix.
Illustratively, the defect probability matrix determined in the above step is a matrix of m×n, M, N is an integer greater than 1, where the row identifier of the defect probability matrix corresponds to the user identifier, and more specifically, for example, the defect probability matrix is a 5*7 matrix, and the matrix characterizes occurrence probabilities of 7 coding defects of defect types corresponding to 5 developers, and according to the user identifier, the first row, the second row, and the fourth row of the defect probability matrix correspond to elements, so as to generate defect probability arrays corresponding to the user identifier; further, according to the correspondence between the defect type and the variation type (refer to the description in the above embodiment), an initial variation weight array corresponding to the defect probability array is determined, and then an initial variation weight matrix is generated according to a plurality of initial variation weight arrays corresponding to the user identifier. The initial variation weight matrix generated in the step of the embodiment can characterize the generation probability of variation test data of different variation types corresponding to different user identifications when the online learning model runs for the first time, thereby realizing the refinement of the data variation direction of the user dimension, enabling the online learning model generated based on the initial variation weight array to generate the variation test data of different variation directions corresponding to interfaces developed by different developers in the initial stage of running, and further improving the test efficiency.
Step S209, obtaining a test result aiming at the target application interface, wherein the test result comprises a defect type of the coding defect of the target application interface and a user identifier corresponding to the coding defect of the target application interface.
Step S210, updating weight values corresponding to the user identifications in a variation weight matrix of the online learning model according to the user identifications corresponding to the coding defects and the defect types of the coding defects of the target application interface, wherein the variation weight matrix characterizes the generation probability of variation test data of different variation types corresponding to the user identifications.
Illustratively, after the online learning model is generated, variant test data may be generated and the target application interface may be tested to obtain a test result. The test result is used for representing mutation test data of a specific mutation type, and whether abnormality and breakdown of the application program are triggered or not. The test result includes a defect type of the coding defect of the target application interface and a user identifier corresponding to the coding defect of the target application interface, the corresponding user identifier of the variation weight matrix and the weight value of the corresponding variation type in the online learning model are updated according to the information in the test result, the weight value of the corresponding user identifier and the weight value of the corresponding variation type are improved, and based on the concept that the same coding defect possibly appears for many times in the test scene of the application interface, the probability of variation test data of the variation type generated by the online learning model next time is higher, so that the abnormality of the application program is triggered with higher probability, and the test effect and the test efficiency are improved.
Fig. 9 is a flowchart of an interface testing method according to an embodiment of the disclosure. The method of the embodiment can be applied to the second terminal equipment, and the interface testing method comprises the following steps:
step S301, acquiring initial test data, where the initial test data is input data of a target application interface.
Illustratively, the initial test data is test data capable of being input data of the target application interface, having a data format that matches the input format requirements of the target application interface. In one possible implementation manner, the initial data format may be data which is randomly generated and meets the data format requirement of the target application interface based on the definition information of the preset target application interface, or test case data which is preset in advance.
Step S302, based on a preset online learning model, the initial test data is mutated to generate mutated test data.
The mutation test data is used for triggering the coding defects of the defect types corresponding to the target application interfaces, and the online learning model is generated based on the method provided by any one of the embodiments corresponding to fig. 3-8.
Step S303, testing the target application interface by mutating the test data to obtain a test result.
By way of example, the content of the online learning model described with reference to fig. 3-8, by which some or all of the initial test data may be mutated, the data content therein may be changed, thereby generating mutated test data. FIG. 10 is a schematic diagram of generating variant test Data through an online learning model according to an embodiment of the present disclosure, where, as shown in FIG. 10, the initial test Data data_1 is processed through the online learning model to generate variant test Data data_2; wherein, there are a plurality of pieces of Data in the form of key value pairs in data_1, wherein the value "20" corresponding to "a" in data_1 is mutated to the value "None" corresponding to "a" in data_2. Because the online learning model generated by the defect probability model matrix can output variation test Data capable of triggering the coding defects with high probability, after the variation test Data data_2 is generated, the target should interface is tested by the variation test Data data_2, and the test result can be obtained by monitoring the running condition of the application program, wherein the variation test Data can trigger the corresponding coding defects with high probability, such as program crash, abnormality and the like. In the process of mutating the initial test data through the online learning model, one key value in the initial test data can be mutated, a plurality of key values in the initial test data can be mutated at the same time, and the selection of the mutation points can be determined based on the size of the weight coefficient in the online learning model.
In the embodiment of the disclosure, initial test data is acquired, wherein the initial test data is input data of a target application interface; performing mutation on the initial test data based on a preset online learning model to generate mutation test data, wherein the mutation test data is used for triggering coding defects of the defect type corresponding to the target application interface, and the online learning model is generated based on the method provided by any embodiment corresponding to fig. 3-8; and testing the target application interface through variation test data to obtain a test result. The online learning model generated by the defect probability model matrix can output variation test data capable of triggering the coding defects with high probability, so that the variation test data are used for testing, and correspondingly the variation defects can be triggered with high probability, and the test effect and the test efficiency of the target application interface are improved.
Fig. 11 is a second flowchart of an interface testing method according to an embodiment of the disclosure. The present embodiment further refines steps S302 and S303 on the basis of the embodiment shown in fig. 9, and the target application interface includes, illustratively, a first interface, where the first interface is disposed at the server side of the target application. The model generation method applied to the interface test comprises the following steps:
Step S401, initial test data is acquired, wherein the initial test data is input data of a target application interface.
Step S402, a preset mutation policy set is obtained, wherein the mutation policy set comprises at least two data mutation policies, the data mutation policies are used for representing rules for generating mutation test data with different mutation types, and the mutation test data with different mutation types are used for triggering coding defects with corresponding defect types.
Illustratively, after step S402, further includes: and acquiring an online learning model, wherein the online learning model comprises a variation weight matrix, and the variation weight matrix characterizes the generation probability of variation test data of different variation types.
Step S403, determining a target mutation strategy in the mutation strategy set according to the mutation weight matrix in the online learning model, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with a probability larger than a threshold value generated in the mutation weight matrix.
Illustratively, a mutation policy set is a piece of information, data, or file of mutation rules that characterize mutation test data. The mutation policy set may be preset by a user or generated after analysis and feature extraction according to historical defect data. The mutation policy set includes at least two data mutation policies, wherein the data mutation policies are information representing rules for generating mutation test data, namely mutation rules. Fig. 12 is a schematic diagram of a mutation policy set according to an embodiment of the disclosure. Referring to fig. 12, illustratively, in the mutation policy set, a mutation rule represented by the data mutation policy a is "set None value", a mutation rule represented by the data mutation policy B is "set blank string", a mutation rule represented by the data mutation policy C is "set ultralong string", and the like. Each mutation rule is used for correspondingly generating mutation test data of one mutation type, namely, mutation strategies are in one-to-one correspondence with the mutation types.
Further, according to the variation weight matrix in the online learning model, determining a variation strategy corresponding to the variation type with the generation probability larger than the threshold value in the variation weight matrix as a target variation strategy, and further performing data variation according to a variation rule corresponding to the target variation strategy to generate variation test data of the corresponding variation type.
In one possible implementation manner, as shown in fig. 13, step S403 includes three specific implementation steps of steps S4031, S4032 and S4033:
in step S4031, a first user identification is obtained, the first user representation being used to indicate the developer of the target interface.
Step S4032, determining a target variation weight array according to the first user identifier and the variation weight matrix in the online learning model, wherein the target variation weight array is used for representing the generation probability of variation test data of different variation types corresponding to the first user identifier.
Step S4033, determining a target mutation strategy in the mutation strategy set according to the target mutation weight array, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with the highest probability generated in the target mutation weight array.
In an exemplary process of mutating test data according to a target mutation policy, a first user identifier for indicating a developer of a target interface is obtained, where the first user identifier may be obtained through a log of a preset target application interface, and is not described herein.
Further, according to the first user identifier and the variation weight matrix in the online learning model, locating an element row (or element column) corresponding to the first user identifier in the variation weight matrix, and further determining a target variation weight array, where the target variation weight array is used to characterize the generation probabilities of variation test data of different variation types corresponding to the first user identifier, that is, the generation probabilities of various variation test data corresponding to a developer writing a target application interface. Further, in the target mutation weight array, a target mutation policy in the mutation policy set is determined, for example, N mutation policies with the highest probability are determined as target mutation policies, and N is an integer greater than 0.
In this embodiment, by acquiring the first user identifier and generating variant test data corresponding to the developer, the probability of triggering the coding defect can be further improved, so that the test efficiency and the test effect are improved.
Step S404, mutating the test data based on the target mutation strategy to generate mutation test data.
Step S405, a first request is sent to the server, where the first request includes mutation test data, and the first request is used to instruct the server to call the first interface and process the mutation test data.
Step S406, receiving a first processing result returned by the server.
In one possible implementation, after step S406, the method includes:
step S407, generating a test result according to the first processing result.
The method for testing the interface is used for testing the first interface located at the server side of the target application. After the mutation data are generated, a first request for including the mutation test data is sent to the server side, and the server side is requested to call the first interface to the mutation test data.
And then, generating a test result according to a first processing result returned by the server, such as whether program breakdown, abnormality and the like occur. The test results can represent a direct mapping relationship between the defect type of the coding defect aiming at the target application interface and whether the program is abnormal or not. Thereafter, the online learning model may be further updated according to the test result, and this process is described in the above embodiment, which will not be described herein.
In another possible implementation manner, the target application interface further includes a second interface, where the second interface is disposed at the client of the target application, and after step S406, includes:
Step S408, a second request is sent to the client, the second request comprises a first processing result, and the second request is used for indicating the client to call a second interface and process the first processing result;
step S409, receiving a second processing result returned by the client, and generating a test result according to the second processing result.
Fig. 14 is a schematic diagram of a process of generating test results according to an embodiment of the present disclosure, and referring to fig. 14, a function of generating variant test data by an online learning model is implemented in a model service form, after a second test terminal sends a first request including variant test data to a server, the second test terminal receives a first processing result returned by the server, and the variant test data sent to the server before is illegal data (unexpected input data), so that the first processing result returned by the server may also be unexpected input data when the first processing result returned by the server is input data of a client, and in order to further test the code robustness of an application interface on the client side of a target application, a second request including the first processing result is sent to the client of the target application, and the second processing result returned by the client is received, and the test result is generated according to the second processing result, so as to implement a joint test on the server and the application interface of the target application.
Fig. 15 is a flowchart illustrating a third embodiment of an interface testing method according to the present disclosure. In this embodiment, steps S302 and S303 are further refined in this embodiment on the basis of the embodiment shown in fig. 9, and the target application interface includes, illustratively, a third interface, where the first interface is disposed at the server side of the target application.
The model generation method applied to the interface test comprises the following steps:
step S501, initial test data is acquired, where the initial test data is input data of the target application interface.
Step S502, obtaining a preset mutation policy set including at least two data mutation policies for characterizing rules for generating mutation test data of different mutation types, wherein the mutation test data of different mutation types are used for triggering coding defects of corresponding defect types
Step S503, determining a target mutation strategy in the mutation strategy set according to the mutation weight matrix in the online learning model, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with a probability larger than a threshold value generated in the mutation weight matrix.
Illustratively, the variance weight matrix in the online learning model characterizes the probability of generation of variance test data for different variance types.
Step S504, mutating the test data based on the target mutation strategy to generate mutation test data.
In step S505, a third request sent by the server is obtained, where the third request includes preset test data, and the third request is used to instruct the client to call a third interface to process the preset test data.
Step S506, the preset test data in the third request is replaced by the variant test data, and a fourth request is generated, wherein the fourth request is used for indicating the client to call the third interface to process the variant test data.
Step S507, receiving a third processing result returned by the client, and generating a test result according to the third processing result.
The third interface is illustratively provided on the client side for implementing the functional results of the client-server communication and data interaction, and therefore, triggering and invoking the third interface requires an invocation request on the server side. Fig. 16 is a schematic diagram of another process of generating test results provided in the embodiment of the present disclosure, and referring to fig. 16, a function of generating variant test data by an online learning model is implemented in a model service form, after the variant test data is generated by a second test terminal, in order to test a third interface, first, a third request sent by a server is received, then, for example, a mode of simulating man-in-the-middle attack by a proxy is adopted, preset test data in the third request is replaced with variant test data, a fourth request is generated, and the fourth request is sent to a client, after the client responds to the fourth request, a third processing result is returned, and then, a test result is generated according to the third processing result, so that a test of an application interface that can be invoked only by a server request on a client side of a target application is implemented, and a test coverage is improved.
The implementation and the beneficial effects of steps S501-S504 in this embodiment are the same as those of steps S401-S404 in the embodiment shown in fig. 11, and are not described here again.
Corresponding to the method for generating a model applied to an interface test in the above embodiment, fig. 17 is a block diagram of a structure of a model generating device applied to an interface test according to an embodiment of the present disclosure. For ease of illustration, only portions relevant to embodiments of the present disclosure are shown. Referring to fig. 17, the model generating apparatus 6 applied to the interface test includes:
an obtaining module 61, configured to obtain historical defect data, where the historical defect data characterizes coding defects of at least one defect type of the target application interface;
a first generation module 62, configured to generate a defect probability matrix according to the historical defect data, where the defect probability matrix is used to characterize occurrence probabilities of coding defects of different defect types;
the second generating module 63 is configured to generate an online learning model according to the defect probability matrix, where the online learning model is configured to generate mutation test data, where the mutation test data is input data of the target application interface, and the mutation test data is configured to trigger a coding defect of a defect type corresponding to the target application interface.
In one embodiment of the present disclosure, the historical defect data includes at least one defect record therein, the defect record characterizing the code defect detected during the historical test; the first generation module 62 is specifically configured to: determining the number of defect records corresponding to different defect types according to the defect records in the historical defect data; and generating a defect probability matrix according to the number of defect records corresponding to different defect types.
In one embodiment of the present disclosure, the historical defect data further includes user identifiers corresponding to the defect records one by one, and the user identifiers are used for characterizing developers corresponding to the defect records;
the first generation module 62 is specifically configured to, when generating the defect probability matrix according to the number of defect records corresponding to different defect types: classifying the defect records in the historical defect data according to the user identification to generate at least one group of defect record groups, wherein the defect record groups comprise at least one defect record corresponding to the same user identification; determining the number of defect records corresponding to different defect types in each defect record group according to the defect records in each defect record group; generating a defect probability matrix according to the number of defect records corresponding to different defect types in each defect record group, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types corresponding to each user identifier.
In one embodiment of the present disclosure, the second generating module 63 is specifically configured to: determining an initial variation weight matrix according to the defect probability matrix, wherein the initial variation weight matrix represents the generation probability of variation test data of different variation types when the online learning model runs for the first time; and generating an online learning model according to the initial variation weight matrix.
In one embodiment of the present disclosure, the second generating module 63 is specifically configured to, when determining the initial variation weight matrix according to the defect probability matrix: determining a defect probability array corresponding to at least one user identifier according to the defect probability matrix, wherein the user identifier is used for indicating a developer, and the defect probability array is used for representing the occurrence probability of coding defects of different defect types; determining an initial variation weight array corresponding to each user identifier according to each defect probability array, wherein the initial variation weight array represents the generation probability of variation test data of different variation types when the online learning model runs for the first time; and generating an initial variation weight matrix according to the initial variation weight array corresponding to each user identifier, wherein the initial variation weight matrix represents the generation probability of variation test data of different variation types corresponding to each user identifier when the online learning model runs for the first time.
In one embodiment of the present disclosure, the second generating module 63 is further configured to: obtaining a test result aiming at a target application interface, wherein the test result comprises a defect type of a coding defect of the target application interface; and updating a variation weight matrix in the online learning model according to the defect type of the coding defect of the target application interface, wherein the variation weight matrix characterizes the generation probability of variation test data of different variation types.
In one embodiment of the present disclosure, the test result further includes a user identifier corresponding to the coding defect of the target application interface, and the second generating module 63 is specifically configured to, when updating the variation weight matrix in the online learning model according to the defect type of the target application interface: updating weight values corresponding to the user identifications in a variation weight matrix of the online learning model according to the user identifications corresponding to the coding defects and the defect types of the coding defects of the target application interface, wherein the variation weight matrix represents the generation probability of variation test data of different variation types corresponding to the user identifications.
The acquisition module 61, the first generation module 62, and the second generation module 63 are sequentially connected. The model generating device 6 applied to interface testing provided in this embodiment may execute the technical scheme of the method embodiment, and its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
Corresponding to the interface testing method of the above embodiment, fig. 18 is a block diagram of the structure of the interface testing device provided in the embodiment of the present disclosure. For ease of illustration, only portions relevant to embodiments of the present disclosure are shown.
Referring to fig. 18, the interface test device 7 includes:
the acquiring module 71 is configured to acquire initial test data, where the initial test data is input data of the target application interface;
the generating module 72 is configured to mutate the initial test data based on a preset online learning model, and generate mutated test data, where the mutated test data is used to trigger the coding defect of the defect type corresponding to the target application interface, and the online learning model is generated based on the method provided by any embodiment corresponding to fig. 9-16;
and the test module 73 is configured to test the target application interface by mutating the test data to obtain a test result.
In one embodiment of the disclosure, the online learning model includes a variation weight matrix, where the variation weight matrix characterizes the generation probability of variation test data of different variation types; the generating module 72 is specifically configured to: acquiring a preset mutation strategy set, wherein the mutation strategy set comprises at least two data mutation strategies, the data mutation strategies are used for representing rules for generating mutation test data of different mutation types, and the mutation test data of the different mutation types are used for triggering coding defects of corresponding defect types; determining a target mutation strategy in a mutation strategy set according to a mutation weight matrix in the online learning model, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with the probability larger than a threshold value generated in the mutation weight matrix; and mutating the test data based on the target mutation strategy to generate mutation test data.
In one embodiment of the present disclosure, the generating module 72 is specifically configured to, when determining the target mutation policy in the mutation policy set according to the mutation weight matrix in the online learning model: acquiring a first user identification, wherein the first user identification is used for indicating a developer of a target interface; determining a target variation weight array according to the first user identifier and a variation weight matrix in the online learning model, wherein the target variation weight array is used for representing the generation probability of variation test data of different variation types corresponding to the first user identifier; and determining a target mutation strategy in the mutation strategy set according to the target mutation weight array, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with the maximum generation probability in the target mutation weight array.
In one embodiment of the disclosure, the target application interface includes a first interface, where the first interface is disposed at a server side of the target application; the test module 73 is specifically configured to: a first request is sent to a server, wherein the first request comprises mutation test data, and the first request is used for indicating the server to call a first interface and process the mutation test data; and receiving a first processing result returned by the server side, and generating a test result according to the first processing result.
In one embodiment of the present disclosure, the target application interface further includes a second interface, where the second interface is disposed at a client of the target application; the test module 73 is specifically configured to, when generating a test result according to the first processing result: sending a second request to the client, wherein the second request comprises a first processing result, and the second request is used for indicating the client to call a second interface and process the first processing result; and receiving a second processing result returned by the client, and generating a test result according to the second processing result.
In one embodiment of the present disclosure, the target application interface includes a third interface, the third interface being provided at a client of the target application; the test module 73 is specifically configured to: acquiring a third request sent by the server, wherein the third request comprises preset test data and is used for indicating the client to call a third interface to process the preset test data; replacing the preset test data in the third request with variant test data to generate a fourth request, wherein the fourth request is used for indicating the client to call the third interface to process the variant test data; and receiving a third processing result returned by the client, and generating a test result according to the third processing result.
Fig. 19 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure, as shown in fig. 19, the electronic device 8 includes
A processor 81, and a memory 82 communicatively connected to the processor 81;
memory 82 stores computer-executable instructions;
processor 81 executes computer-executable instructions stored in memory 82 to implement the model generation method applied to interface testing in the embodiment shown in fig. 3-8, or to implement the interface testing method in the embodiment shown in fig. 9-16.
Wherein optionally the processor 81 and the memory 82 are connected by a bus 83.
The relevant descriptions and effects corresponding to the steps in the embodiments corresponding to fig. 3 to 16 may be understood correspondingly, and are not repeated here.
Referring to fig. 20, there is shown a schematic structural diagram of an electronic device 900 suitable for use in implementing embodiments of the present disclosure, where the electronic device 900 may be a terminal device or a server. The terminal device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a personal digital assistant (Personal Digital Assistant, PDA for short), a tablet (Portable Android Device, PAD for short), a portable multimedia player (Portable Media Player, PMP for short), an in-vehicle terminal (e.g., an in-vehicle navigation terminal), and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 20 is merely an example, and should not impose any limitation on the functionality and scope of use of the embodiments of the present disclosure.
As shown in fig. 20, the electronic apparatus 900 may include a processing device (e.g., a central processor, a graphics processor, or the like) 901, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 902 or a program loaded from a storage device 908 into a random access Memory (Random Access Memory, RAM) 903. In the RAM 903, various programs and data necessary for the operation of the electronic device 900 are also stored. The processing device 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to the bus 904.
In general, the following devices may be connected to the I/O interface 905: input devices 906 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 907 including, for example, a liquid crystal display (Liquid Crystal Display, LCD for short), a speaker, a vibrator, and the like; storage 908 including, for example, magnetic tape, hard disk, etc.; and a communication device 909. The communication means 909 may allow the electronic device 900 to communicate wirelessly or by wire with other devices to exchange data. While fig. 20 shows an electronic device 900 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via the communication device 909, or installed from the storage device 908, or installed from the ROM 902. When executed by the processing device 901, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above-described embodiments.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a local area network (Local Area Network, LAN for short) or a wide area network (Wide Area Network, WAN for short), or it may be connected to an external computer (e.g., connected via the internet using an internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The name of the unit does not in any way constitute a limitation of the unit itself, for example the first acquisition unit may also be described as "unit acquiring at least two internet protocol addresses".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In a first aspect, according to one or more embodiments of the present disclosure, there is provided a model generation method applied to an interface test, including:
acquiring historical defect data, wherein the historical defect data represents coding defects of at least one defect type of a target application interface; generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types; and generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating mutation test data, the mutation test data is input data of the target application interface, and the mutation test data is used for triggering coding defects of the defect type corresponding to the target application interface.
According to one or more embodiments of the present disclosure, the historical defect data includes at least one defect record therein, the defect record characterizing the coded defects detected during the historical testing process; generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix comprises the following components: determining the number of defect records corresponding to different defect types according to the defect records in the historical defect data; and generating the defect probability matrix according to the number of defect records corresponding to the different defect types.
According to one or more embodiments of the present disclosure, the historical defect data further includes user identifiers corresponding to the defect records one by one, where the user identifiers are used to characterize developers corresponding to the defect records; generating the defect probability matrix according to the number of defect records corresponding to the different defect types, wherein the defect probability matrix comprises the following steps: classifying the defect records in the historical defect data according to the user identification to generate at least one group of defect record groups, wherein the defect record groups comprise at least one defect record corresponding to the same user identification; determining the number of defect records corresponding to different defect types in each defect record group according to the defect records in each defect record group; and generating the defect probability matrix according to the number of defect records corresponding to different defect types in each defect record group, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types corresponding to each user identifier.
According to one or more embodiments of the present disclosure, generating an online learning model from the defect probability matrix includes: determining an initial variation weight matrix according to the defect probability matrix, wherein the initial variation weight matrix characterizes the generation probability of variation test data of different variation types when the online learning model runs for the first time; and generating the online learning model according to the initial variation weight matrix.
According to one or more embodiments of the present disclosure, determining an initial variation weight matrix from the defect probability matrix includes: determining a defect probability array corresponding to at least one user identifier according to the defect probability matrix, wherein the user identifier is used for indicating a developer, and the defect probability array is used for representing the occurrence probability of coding defects of different defect types; determining an initial variation weight array corresponding to each user identifier according to each defect probability array, wherein the initial variation weight array represents the generation probability of variation test data of different variation types when the online learning model runs for the first time; and generating an initial variation weight matrix according to the initial variation weight array corresponding to each user identifier, wherein the initial variation weight matrix represents the generation probability of variation test data of different variation types corresponding to each user identifier when the online learning model runs for the first time.
According to one or more embodiments of the present disclosure, the method further comprises: obtaining a test result aiming at the target application interface, wherein the test result comprises a defect type of a coding defect of the target application interface; and updating a variation weight matrix in the online learning model according to the defect type of the coding defect of the target application interface, wherein the variation weight matrix represents the generation probability of variation test data of different variation types.
According to one or more embodiments of the present disclosure, the test result further includes a user identifier corresponding to the coding defect of the target application interface, and updating the variation weight matrix in the online learning model according to the defect type of the target application interface includes: updating weight values corresponding to the user identifications in a variation weight matrix of the online learning model according to the user identifications corresponding to the coding defects and the defect types of the coding defects of the target application interface, wherein the variation weight matrix represents the generation probability of variation test data of different variation types corresponding to the user identifications.
In a second aspect, according to one or more embodiments of the present disclosure, there is provided an interface testing method, including:
acquiring initial test data, wherein the initial test data is input data of a target application interface; performing mutation on the initial test data based on a preset online learning model to generate mutation test data, wherein the mutation test data is used for triggering the coding defects of the defect types corresponding to the target application interfaces, and the online learning model is generated based on the model generation method applied to interface test according to the first aspect and various possible designs of the first aspect; and testing the target application interface through the variation test data to obtain a test result.
According to one or more embodiments of the present disclosure, the online learning model includes a variation weight matrix, where the variation weight matrix characterizes the generation probabilities of variation test data of different variation types; and mutating the initial test data based on a preset online learning model to generate mutation test data, wherein the mutation test data comprises the following steps: acquiring a preset mutation strategy set, wherein the mutation strategy set comprises at least two data mutation strategies, the data mutation strategies are used for representing rules for generating mutation test data of different mutation types, and the mutation test data of different mutation types are used for triggering coding defects of corresponding defect types; determining a target mutation strategy in the mutation strategy set according to a mutation weight matrix in the online learning model, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with a probability larger than a threshold value generated in the mutation weight matrix; and mutating the test data based on the target mutation strategy to generate mutation test data.
According to one or more embodiments of the present disclosure, determining a target variation strategy in the variation strategy set according to a variation weight matrix in the online learning model includes: acquiring a first user identification, wherein the first user identification is used for indicating a developer of the target interface; determining a target variation weight array according to the first user identifier and a variation weight matrix in the online learning model, wherein the target variation weight array is used for representing the generation probability of variation test data of different variation types corresponding to the first user identifier; and determining a target mutation strategy in the mutation strategy set according to the target mutation weight array, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with the largest generation probability in the target mutation weight array.
According to one or more embodiments of the present disclosure, the target application interface includes a first interface, where the first interface is disposed at a server side of a target application; and testing the target application interface according to the variation test data to obtain a test result, wherein the test result comprises the following steps: sending a first request to the server, wherein the first request comprises the mutation test data, and the first request is used for indicating the server to call the first interface and process the mutation test data; and receiving a first processing result returned by the server side, and generating a test result according to the first processing result.
According to one or more embodiments of the present disclosure, the target application interface further includes a second interface, where the second interface is disposed at a client of the target application; generating a test result according to the first processing result, including: sending a second request to the client, wherein the second request comprises the first processing result, and the second request is used for indicating the client to call the second interface and process the first processing result; and receiving a second processing result returned by the client, and generating a test result according to the second processing result.
According to one or more embodiments of the present disclosure, the target application interface includes a third interface, which is disposed at a client of the target application; and testing the target application interface according to the variation test data to obtain a test result, wherein the test result comprises the following steps: acquiring a third request sent by a server, wherein the third request comprises preset test data and is used for indicating a client to call a third interface to process the preset test data; replacing preset test data in the third request with the variant test data to generate a fourth request, wherein the fourth request is used for indicating a client to call the third interface to process the variant test data; and receiving a third processing result returned by the client, and generating a test result according to the third processing result.
In a third aspect, according to one or more embodiments of the present disclosure, there is provided a model generating apparatus applied to an interface test, including:
the acquisition module is used for acquiring historical defect data, wherein the historical defect data represents coding defects of at least one defect type of the target application interface;
the first generation module is used for generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types;
The second generation module is used for generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating mutation test data, the mutation test data are input data of the target application interface, and the mutation test data are used for triggering coding defects of the defect types corresponding to the target application interface.
According to one or more embodiments of the present disclosure, the historical defect data includes at least one defect record therein, the defect record characterizing the coded defects detected during the historical testing process; the first generation module is specifically configured to: determining the number of defect records corresponding to different defect types according to the defect records in the historical defect data; and generating the defect probability matrix according to the number of defect records corresponding to the different defect types.
According to one or more embodiments of the present disclosure, the historical defect data further includes user identifiers corresponding to the defect records one by one, where the user identifiers are used to characterize developers corresponding to the defect records; the first generation module is specifically configured to, when generating the defect probability matrix according to the number of defect records corresponding to the different defect types: classifying the defect records in the historical defect data according to the user identification to generate at least one group of defect record groups, wherein the defect record groups comprise at least one defect record corresponding to the same user identification; determining the number of defect records corresponding to different defect types in each defect record group according to the defect records in each defect record group; and generating the defect probability matrix according to the number of defect records corresponding to different defect types in each defect record group, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types corresponding to each user identifier.
According to one or more embodiments of the present disclosure, the second generating module is specifically configured to: determining an initial variation weight matrix according to the defect probability matrix, wherein the initial variation weight matrix characterizes the generation probability of variation test data of different variation types when the online learning model runs for the first time; and generating the online learning model according to the initial variation weight matrix.
According to one or more embodiments of the present disclosure, the second generating module is specifically configured to, when determining an initial variation weight matrix according to the defect probability matrix: determining a defect probability array corresponding to at least one user identifier according to the defect probability matrix, wherein the user identifier is used for indicating a developer, and the defect probability array is used for representing the occurrence probability of coding defects of different defect types; determining an initial variation weight array corresponding to each user identifier according to each defect probability array, wherein the initial variation weight array represents the generation probability of variation test data of different variation types when the online learning model runs for the first time; and generating an initial variation weight matrix according to the initial variation weight array corresponding to each user identifier, wherein the initial variation weight matrix represents the generation probability of variation test data of different variation types corresponding to each user identifier when the online learning model runs for the first time.
According to one or more embodiments of the present disclosure, the second generating module is further configured to: obtaining a test result aiming at the target application interface, wherein the test result comprises a defect type of a coding defect of the target application interface; and updating a variation weight matrix in the online learning model according to the defect type of the coding defect of the target application interface, wherein the variation weight matrix represents the generation probability of variation test data of different variation types.
According to one or more embodiments of the present disclosure, the test result further includes a user identifier corresponding to the coding defect of the target application interface, and the second generating module is specifically configured to, when updating the variation weight matrix in the online learning model according to the defect type of the target application interface: updating weight values corresponding to the user identifications in a variation weight matrix of the online learning model according to the user identifications corresponding to the coding defects and the defect types of the coding defects of the target application interface, wherein the variation weight matrix represents the generation probability of variation test data of different variation types corresponding to the user identifications.
In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided an interface test apparatus comprising:
the acquisition module is used for acquiring initial test data, wherein the initial test data is input data of a target application interface;
the generation module is used for mutating the initial test data based on a preset online learning model to generate mutation test data, wherein the mutation test data is used for triggering the coding defects of the defect types corresponding to the target application interfaces, and the online learning model is generated based on the model generation method applied to the interface test according to the first aspect and various possible designs of the first aspect;
and the test module is used for testing the target application interface through the variation test data to obtain a test result.
According to one or more embodiments of the present disclosure, the online learning model includes a variation weight matrix, where the variation weight matrix characterizes the generation probabilities of variation test data of different variation types; the generating module is specifically configured to: acquiring a preset mutation strategy set, wherein the mutation strategy set comprises at least two data mutation strategies, the data mutation strategies are used for representing rules for generating mutation test data of different mutation types, and the mutation test data of different mutation types are used for triggering coding defects of corresponding defect types; determining a target mutation strategy in the mutation strategy set according to a mutation weight matrix in the online learning model, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with a probability larger than a threshold value generated in the mutation weight matrix; and mutating the test data based on the target mutation strategy to generate mutation test data.
According to one or more embodiments of the present disclosure, the generating module is specifically configured to, when determining the target mutation policy in the mutation policy set according to the mutation weight matrix in the online learning model: acquiring a first user identification, wherein the first user identification is used for indicating a developer of the target interface; determining a target variation weight array according to the first user identifier and a variation weight matrix in the online learning model, wherein the target variation weight array is used for representing the generation probability of variation test data of different variation types corresponding to the first user identifier; and determining a target mutation strategy in the mutation strategy set according to the target mutation weight array, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with the largest generation probability in the target mutation weight array.
According to one or more embodiments of the present disclosure, the target application interface includes a first interface, where the first interface is disposed at a server side of a target application; the test module is specifically configured to: sending a first request to the server, wherein the first request comprises the mutation test data, and the first request is used for indicating the server to call the first interface and process the mutation test data; and receiving a first processing result returned by the server side, and generating a test result according to the first processing result.
According to one or more embodiments of the present disclosure, the target application interface further includes a second interface, where the second interface is disposed at a client of the target application; the test module is specifically configured to, when generating a test result according to the first processing result: sending a second request to the client, wherein the second request comprises the first processing result, and the second request is used for indicating the client to call the second interface and process the first processing result; and receiving a second processing result returned by the client, and generating a test result according to the second processing result.
According to one or more embodiments of the present disclosure, the target application interface includes a third interface, which is disposed at a client of the target application; the test module is specifically configured to: acquiring a third request sent by a server, wherein the third request comprises preset test data and is used for indicating a client to call a third interface to process the preset test data; replacing preset test data in the third request with the variant test data to generate a fourth request, wherein the fourth request is used for indicating a client to call the third interface to process the variant test data; and receiving a third processing result returned by the client, and generating a test result according to the third processing result.
In a fifth aspect, embodiments of the present disclosure provide an electronic device, including:
a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes the computer-executable instructions stored in the memory to implement the model generation method applied to the interface test as described in the first aspect and the various possible designs of the first aspect, or to implement the interface test method as described in the second aspect and the various possible designs of the second aspect.
In a sixth aspect, embodiments of the present disclosure provide a computer readable storage medium, where computer executable instructions are stored, when executed by a processor, to implement a model generating method applied to an interface test as described in the first aspect and the various possible designs of the first aspect, or implement an interface test method as described in the second aspect and the various possible designs of the second aspect.
In a seventh aspect, embodiments of the present disclosure provide a computer program product comprising a computer program which, when executed by a processor, implements the model generation method applied to interface testing as described in the first aspect and the various possible designs of the first aspect, or implements the interface testing method as described in the second aspect and the various possible designs of the second aspect.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (15)

1. A model generation method applied to interface testing, comprising:
acquiring historical defect data, wherein the historical defect data represents coding defects of at least one defect type of a target application interface;
generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types;
generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating variant test data, the variant test data are input data of the target application interface, the variant test data are used for triggering coding defects of the corresponding defect types of the target application interface, and the online learning model is used for testing the coding defects of the target application interface.
2. The method according to claim 1, wherein the historical defect data comprises at least one defect record and user identifications corresponding to the defect records one by one, the defect records are used for representing the detected coding defects in the historical test process, and the user identifications are used for representing developers corresponding to the defect records;
Generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix comprises the following components:
determining the number of defect records corresponding to different defect types according to the defect records in the historical defect data;
classifying the defect records in the historical defect data according to the user identification to generate at least one group of defect record groups, wherein the defect record groups comprise at least one defect record corresponding to the same user identification;
determining the number of defect records corresponding to different defect types in each defect record group according to the defect records in each defect record group;
and generating the defect probability matrix according to the number of defect records corresponding to different defect types in each defect record group, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types corresponding to each user identifier.
3. The method of claim 1, wherein generating an online learning model from the defect probability matrix comprises:
determining a defect probability array corresponding to at least one user identifier according to the defect probability matrix, wherein the user identifier is used for indicating a developer, and the defect probability array is used for representing the occurrence probability of coding defects of different defect types;
Determining an initial variation weight array corresponding to each user identifier according to each defect probability array, wherein the initial variation weight array represents the generation probability of variation test data of different variation types when the online learning model runs for the first time;
generating an initial variation weight matrix according to the initial variation weight array corresponding to each user identifier, wherein the initial variation weight matrix represents the generation probability of variation test data of different variation types corresponding to each user identifier when the online learning model runs for the first time;
and generating an online learning model according to the initial variation weight matrix.
4. A method according to any one of claims 1-3, wherein the method further comprises:
obtaining a test result aiming at the target application interface, wherein the test result comprises a defect type of the coding defect of the target application interface and a user identifier corresponding to the coding defect of the target application interface;
updating weight values corresponding to the user identifications in a variation weight matrix of the online learning model according to the user identifications corresponding to the coding defects and the defect types of the coding defects of the target application interface, wherein the variation weight matrix represents the generation probability of variation test data of different variation types corresponding to the user identifications.
5. An interface testing method, comprising:
acquiring initial test data, wherein the initial test data is input data of a target application interface;
performing mutation on the initial test data based on a preset online learning model to generate mutation test data, wherein the mutation test data is used for triggering coding defects of a defect type corresponding to the target application interface, and the online learning model is generated based on the method as set forth in any one of claims 1-4;
and testing the target application interface through the variation test data to obtain a test result.
6. The method of claim 5, wherein the online learning model includes a variation weight matrix, wherein the variation weight matrix characterizes the probability of generating variation test data of different variation types;
and mutating the initial test data based on a preset online learning model to generate mutation test data, wherein the mutation test data comprises the following steps:
acquiring a preset mutation strategy set, wherein the mutation strategy set comprises at least two data mutation strategies, the data mutation strategies are used for representing rules for generating mutation test data of different mutation types, and the mutation test data of different mutation types are used for triggering coding defects of corresponding defect types;
Determining a target mutation strategy in the mutation strategy set according to a mutation weight matrix in the online learning model, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with a probability larger than a threshold value generated in the mutation weight matrix;
and mutating the test data based on the target mutation strategy to generate mutation test data.
7. The method of claim 6, wherein determining a target variation strategy in the set of variation strategies based on a variation weight matrix in the online learning model comprises:
acquiring a first user identification, wherein the first user identification is used for indicating a developer of the target interface;
determining a target variation weight array according to the first user identifier and a variation weight matrix in the online learning model, wherein the target variation weight array is used for representing the generation probability of variation test data of different variation types corresponding to the first user identifier;
and determining a target mutation strategy in the mutation strategy set according to the target mutation weight array, wherein the target mutation strategy is a mutation strategy corresponding to a mutation type with the largest generation probability in the target mutation weight array.
8. The method of claim 5, wherein the target application interface comprises a first interface, the first interface being disposed at a server side of the target application;
and testing the target application interface according to the variation test data to obtain a test result, wherein the test result comprises the following steps:
sending a first request to the server, wherein the first request comprises the mutation test data, and the first request is used for indicating the server to call the first interface and process the mutation test data;
and receiving a first processing result returned by the server side, and generating a test result according to the first processing result.
9. The method of claim 8, wherein the target application interface further comprises a second interface, the second interface disposed at a client of the target application;
generating a test result according to the first processing result, including:
sending a second request to the client, wherein the second request comprises the first processing result, and the second request is used for indicating the client to call the second interface and process the first processing result;
and receiving a second processing result returned by the client, and generating a test result according to the second processing result.
10. The method according to any of claims 5-9, wherein the target application interface comprises a third interface, the third interface being provided at a client of the target application;
and testing the target application interface according to the variation test data to obtain a test result, wherein the test result comprises the following steps:
acquiring a third request sent by a server, wherein the third request comprises preset test data and is used for indicating a client to call a third interface to process the preset test data;
replacing preset test data in the third request with the variant test data to generate a fourth request, wherein the fourth request is used for indicating a client to call the third interface to process the variant test data;
and receiving a third processing result returned by the client, and generating a test result according to the third processing result.
11. A model generating device applied to interface test, characterized by comprising:
the acquisition module is used for acquiring historical defect data, wherein the historical defect data represents coding defects of at least one defect type of the target application interface;
the first generation module is used for generating a defect probability matrix according to the historical defect data, wherein the defect probability matrix is used for representing the occurrence probability of coding defects of different defect types;
The second generation module is used for generating an online learning model according to the defect probability matrix, wherein the online learning model is used for generating mutation test data, the mutation test data are input data of the target application interface, the mutation test data are used for triggering coding defects of the target application interface corresponding to defect types, and the online learning model is used for testing the coding defects of the target application interface.
12. An interface testing apparatus, comprising:
the acquisition module is used for acquiring initial test data, wherein the initial test data is input data of a target application interface;
the generation module is used for mutating the initial test data based on a preset online learning model to generate mutation test data, wherein the mutation test data is used for triggering the coding defects of the defect types corresponding to the target application interfaces, and the online learning model is generated based on the method as set forth in any one of claims 1-4;
and the test module is used for testing the target application interface through the variation test data to obtain a test result.
13. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
The memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 1 to 10.
14. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor implement the method of any one of claims 1 to 10.
15. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1 to 10.
CN202111655978.8A 2021-12-31 2021-12-31 Model generation method applied to interface test, interface test method and device Pending CN116414675A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111655978.8A CN116414675A (en) 2021-12-31 2021-12-31 Model generation method applied to interface test, interface test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111655978.8A CN116414675A (en) 2021-12-31 2021-12-31 Model generation method applied to interface test, interface test method and device

Publications (1)

Publication Number Publication Date
CN116414675A true CN116414675A (en) 2023-07-11

Family

ID=87056662

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111655978.8A Pending CN116414675A (en) 2021-12-31 2021-12-31 Model generation method applied to interface test, interface test method and device

Country Status (1)

Country Link
CN (1) CN116414675A (en)

Similar Documents

Publication Publication Date Title
KR20190109427A (en) Ongoing Learning for Intrusion Detection
CN110392046B (en) Method and device for detecting abnormity of network access
CN111240876A (en) Fault positioning method and device for microservice, storage medium and terminal
CN115061874A (en) Log information verification method, device, equipment and medium
CN109635993A (en) Operation behavior monitoring method and device based on prediction model
CN113419971B (en) Android system service vulnerability detection method and related device
CN112291121B (en) Data processing method and related equipment
CN116225886A (en) Test case generation method, device, equipment, storage medium and program product
CN110083529A (en) Automated testing method, device, medium and electronic equipment
CN110704773A (en) Abnormal behavior detection method and system based on frequent behavior sequence mode
CN117240632A (en) Attack detection method and system based on knowledge graph
CN112882948A (en) Stability testing method, device and system for application and storage medium
CN109586788B (en) Monitoring system fault diagnosis method and device, computer equipment and storage medium
CN116519095A (en) Instrument state diagnosis and response method, device, equipment and storage medium
CN115906064A (en) Detection method, detection device, electronic equipment and computer readable medium
CN116414675A (en) Model generation method applied to interface test, interface test method and device
CN114726876B (en) Data detection method, device, equipment and storage medium
JP2022126818A (en) Method and apparatus of processing security information, electronic device, storage medium, and computer program
CN115292178A (en) Test data searching method, device, storage medium and terminal
CN116149978A (en) Service interface testing method and device, electronic equipment and storage medium
CN111651761B (en) Black-production electronic equipment detection method and device, server and storage medium
CN113656286A (en) Software testing method and device, electronic equipment and readable storage medium
CN109614137B (en) Software version control method, device, equipment and medium
CN111651753A (en) User behavior analysis system and method
CN113572768B (en) Analysis method for abnormal change of number of botnet family propagation sources

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination