Interface testing method, device, equipment and medium based on automatic parameter identification

文档序号:7452 发布日期:2021-09-17 浏览:17次 中文

1. An interface testing method based on automatic parameter identification is characterized by comprising the following steps:

when a trigger instruction aiming at a functional node in a system to be tested is detected, capturing application program interface information generated after the functional node is triggered; wherein, the application program interface information comprises request parameters and request data;

extracting request parameters in the application program interface information;

identifying the request parameters according to a preset parameter analyzer and a pre-trained parameter type identification model and outputting the types of the request parameters; the pre-trained parameter type recognition model is generated based on a first training sample and a second training sample, and the similarity between the first training sample and the second training sample is greater than a preset value;

carrying out parameterization according to the type of the request parameter to generate a parameterization method, and splicing the parameterization method and the request data to generate a parameterized interface program;

and executing the parameterized interface program to obtain a test case, binding the test case with the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result.

2. The method according to claim 1, wherein the capturing, when a trigger instruction for a functional node in the system under test is detected, application program interface information generated after the functional node is triggered comprises:

connecting and accessing a system to be tested;

when a trigger instruction aiming at a functional node in the system to be tested is detected, generating application program interface information according to the trigger instruction;

and capturing the application program interface information by adopting a network packet capturing tool.

3. The method according to claim 1, wherein the capturing, when a trigger instruction for a functional node in the system under test is detected, application program interface information generated after the functional node is triggered comprises:

connecting and accessing a system to be tested;

receiving data information filled in aiming at a current page form in the system to be tested;

when a submission instruction for the current page form is detected, generating application program interface information according to the filled data information;

and capturing the application program interface information by adopting a network packet capturing tool.

4. The method of claim 1, wherein the extracting the request parameter from the application program interface information comprises:

loading a pre-configured regular filter;

inputting the data contained in the application program interface information into the regular filter one by one, and identifying the request parameters contained in the application program interface information;

outputting the request parameter; wherein the content of the first and second substances,

the generating of the pre-configured regularization filter according to the following steps includes:

collecting request parameters used in the field of software programming to generate a data dictionary;

initializing a regular filter;

and associating the data dictionary with the initialized regular filter to generate a pre-configured regular filter.

5. The method of claim 1, wherein the identifying and outputting the type to which the request parameter belongs comprises:

loading a parameter analyzer and a pre-trained parameter type identification model;

inputting the request parameters into the parameter analyzer, and outputting an analysis result;

when the type corresponding to the request parameter exists in the analysis result, outputting the type corresponding to the request parameter;

alternatively, the first and second electrodes may be,

when the type corresponding to the request parameter does not exist in the analysis result, inputting the request parameter into a pre-trained parameter type recognition model;

and outputting the type corresponding to the request parameter.

6. The method of claim 5, wherein the pre-trained parameter type recognition model comprises a representation layer, a BilSTM layer, and a CRF layer;

the inputting the request parameter into a pre-trained parameter type recognition model comprises:

the presentation layer extracts the word vectors of the request parameters to generate a word vector set;

the BilSTM layer carries out label vectorization on each word vector in the word vector set to generate a label vector corresponding to each word vector;

calculating a category value matrix of the label vector corresponding to each word vector by the CRF layer;

and determining the type of the request parameter according to the class value matrix of the label vector corresponding to each word vector.

7. The method of claim 6, wherein generating a pre-trained parameter type recognition model comprises:

establishing a parameter type identification model by adopting a BilSTM-CRF algorithm;

acquiring request parameters used in the field of software programming to generate a first training sample;

preprocessing and expanding the first training sample to generate a second training sample;

receiving a statistical analysis instruction aiming at the first training sample, and generating a plurality of constraint rules based on the statistical analysis instruction;

inputting the first training sample and the second training sample into the parameter type recognition model for training, and outputting a loss value of the model;

when the loss value and the training frequency of the model reach preset values, generating a trained parameter type recognition model;

and adding the multiple constraint rules into a CRF layer in the trained parameter type recognition model to generate a pre-trained parameter type recognition model.

8. An interface testing apparatus based on automatic parameter identification, the apparatus comprising:

the system comprises an application program interface information capturing module, a function node acquiring module and a function node judging module, wherein the application program interface information capturing module is used for capturing application program interface information generated after triggering the function node when a triggering instruction aiming at the function node in a system to be tested is detected; wherein, the application program interface information comprises request parameters and request data;

the request parameter extraction module is used for extracting the request parameters in the application program interface information;

the type identification module is used for identifying the request parameters according to a preset parameter analyzer and a pre-trained parameter type identification model and outputting the types of the request parameters; the pre-trained parameter type recognition model is generated based on a first training sample and a second training sample, and the similarity between the first training sample and the second training sample is greater than a preset value;

the interface program generating module is used for carrying out parameterization according to the type of the request parameter to generate a parameterization method, and splicing the parameterization method and the request data to generate a parameterized interface program;

and the test result generation module is used for executing the parameterized interface program to obtain a test case, binding the test case with the request parameters to generate an interface to be tested, and executing the interface to be tested to generate a test result.

9. An apparatus comprising a memory and a processor, the memory having stored therein computer-readable instructions which, when executed by the processor, cause the processor to perform the steps of the parameter auto-id based interface testing method of any one of claims 1 to 7.

10. A medium having stored thereon computer-readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the parameter auto-id based interface test of any one of claims 1 to 7.

Background

The test of the application programming interface in the software test needs to be carried out according to the test flow of the conventional test, the boundary test, the abnormal test and the fault test, and each unit test of the test flow comprises a plurality of fine categories, so the interface test work is multidimensional, so that a tester needs to carry out analysis before the test and prepare test data in advance to ensure that the coverage is more comprehensive.

In the prior art, when an application programming interface in a software system code needs to be tested, the application programming interface needs to be converted into an executable interface test program capable of performing automatic coverage test, at present, when the application programming interface is converted, a test engineer constructs the executable interface test program of each program programming interface in a parameter-by-parameter filling mode, the program programming interface needing to be constructed is increased explosively with the increasing of functional nodes in the system, and when the test engineer fills parameters for the interface to be tested, a large amount of time is required for constructing and performing parameterization work, so that the software test period is prolonged, and the test efficiency of software test is reduced.

Disclosure of Invention

Therefore, it is necessary to provide an interface testing method, apparatus, device and medium based on automatic parameter identification for solving the problem of low security after a software system is online.

An interface testing method based on automatic parameter identification comprises the following steps: when a trigger instruction aiming at a functional node in a system to be tested is detected, capturing application program interface information generated after the functional node is triggered; wherein, the application program interface information comprises request parameters and request data; extracting request parameters in the application program interface information; identifying the request parameters according to a preset parameter analyzer and a pre-trained parameter type identification model and outputting the types of the request parameters; the pre-trained parameter type recognition model is generated based on a first training sample and a second training sample, and the similarity between the first training sample and the second training sample is greater than a preset value; parameterizing according to the type of the request parameter to generate a parameterization method, and splicing the parameterization method and the request data to generate a parameterized interface program; and executing the parameterized interface program to obtain a test case, binding the test case with the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result.

In one embodiment, when a trigger instruction for a functional node in a system under test is detected, capturing application program interface information generated after the functional node is triggered, including: connecting and accessing a system to be tested; when a trigger instruction aiming at a functional node in a system to be tested is detected, generating application program interface information according to the trigger instruction; and capturing the application program interface information by adopting a network packet capturing tool.

In one embodiment, when a trigger instruction for a functional node in a system under test is detected, capturing application program interface information generated after the functional node is triggered, including: connecting and accessing a system to be tested; receiving data information filled in aiming at a current page form in a system to be tested; when a submission instruction for the current page form is detected, generating application program interface information according to the filled data information; and capturing the application program interface information by adopting a network packet capturing tool.

In one embodiment, extracting the request parameter from the application program interface information includes: loading a pre-configured regular filter; inputting data contained in the application program interface information into a regular filter one by one, and identifying request parameters contained in the application program interface information; outputting the request parameters; the method comprises the following steps of generating a pre-configured regular filter, wherein the method comprises the following steps: collecting request parameters used in the field of software programming to generate a data dictionary; initializing a regular filter; and associating the data dictionary with the initialized regular filter to generate a pre-configured regular filter.

In one embodiment, identifying and outputting the type to which the request parameter belongs includes: loading a parameter analyzer and a pre-trained parameter type identification model; inputting the request parameters into a parameter analyzer, and outputting an analysis result; when the type corresponding to the request parameter exists in the analysis result, outputting the type corresponding to the request parameter; or when the type corresponding to the request parameter does not exist in the analysis result, inputting the request parameter into a parameter type recognition model trained in advance; and outputting the type corresponding to the request parameter.

In one embodiment, the pre-trained parameter type recognition model comprises a representation layer, a BilSTM layer and a CRF layer; inputting request parameters into a pre-trained parameter type recognition model, comprising: the presentation layer extracts the word vectors of the request parameters to generate a word vector set; the BilSTM layer carries out label vectorization on each word vector in the word vector set to generate a label vector corresponding to each word vector; the CRF layer calculates a category value matrix of the label vector corresponding to each word vector; and determining the type of the request parameter according to the class value matrix of the label vector corresponding to each word vector.

In one embodiment, the pre-trained parameter type recognition model is generated according to the following method, comprising: establishing a parameter type identification model by adopting a BilSTM-CRF algorithm; acquiring request parameters used in the field of software programming to generate a first training sample; preprocessing and expanding the first training sample to generate a second training sample; receiving a statistical analysis instruction aiming at a first training sample, and generating a plurality of constraint rules based on the statistical analysis instruction; inputting the first training sample and the second training sample into a parameter type recognition model for training, and outputting a loss value of the model; when the loss value and the training times of the model reach preset values, generating a trained parameter type recognition model; and adding a plurality of constraint rules into a CRF layer in the trained parameter type recognition model to generate a pre-trained parameter type recognition model.

An interface testing device based on automatic parameter identification comprises: the application program interface information capturing module is used for capturing the application program interface information generated after the functional node is triggered when a triggering instruction aiming at the functional node in the system to be tested is detected; wherein, the application program interface information comprises request parameters and request data; the request parameter extraction module is used for extracting request parameters in the application program interface information; the type identification module is used for identifying the request parameters according to a preset parameter analyzer and a pre-trained parameter type identification model and outputting the types of the request parameters; the pre-trained parameter type recognition model is generated based on a first training sample and a second training sample, and the similarity between the first training sample and the second training sample is greater than a preset value; the interface program generating module is used for carrying out parameterization according to the type of the request parameter to generate a parameterization method, and splicing the parameterization method and the request data to generate a parameterized interface program; and the test result generation module is used for executing the parameterized interface program to obtain a test case, binding the test case with the request parameters to generate an interface to be tested, and executing the interface to be tested to generate a test result.

An apparatus comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the above-described parameter auto-identification based interface testing method.

A medium having stored thereon computer-readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the above-described parameter-based automatic identification interface testing method.

The interface testing method, the device, the equipment and the medium based on the parameter automatic identification are characterized in that when a triggering instruction aiming at a functional node in a system to be tested is detected by the interface testing device based on the parameter automatic identification, the interface testing device firstly captures the interface information of an application program generated after the functional node is triggered, extracts a request parameter in the interface information of the application program, then identifies and outputs the type of the request parameter, the type of the request parameter is identified according to a parameter analyzer and a pre-trained parameter type identification model, the pre-trained parameter type identification model is generated based on a first training sample and a second training sample, then carries out parameterization according to the type of the request parameter to generate a parameterization method, splices the parameterization method and the request data to generate a parameterized interface program, and finally executes the interface program to obtain a test case, and binding the test case with the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result. According to the application, the type of the request parameter contained in the application program interface information is identified by adopting the regular filter and the pre-trained parameter type identification model, so that the request parameter contained in the application program interface information can be parameterized automatically, the system test period is shortened, and the test efficiency of software test is reduced. Meanwhile, the correlation is established between the first training sample and the second training sample, so that the identification precision of the trained parameter type identification model is more accurate, and the accuracy of system testing is improved.

Drawings

The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.

FIG. 1 is a diagram of an implementation environment of a method for testing an interface based on automatic parameter identification according to an embodiment of the present application;

FIG. 2 is a schematic diagram of the internal structure of the apparatus according to an embodiment of the present application;

FIG. 3 is a schematic diagram of a method for testing an interface based on automatic parameter identification according to an embodiment of the present application;

FIG. 4 is a process diagram of an interface testing process based on automatic parameter identification provided in an embodiment of the present application;

FIG. 5 is a schematic diagram of a method for training a parameter type recognition model according to another embodiment of the present application;

fig. 6 is a schematic device diagram of an interface testing device based on automatic parameter identification according to an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

It will be understood that, as used herein, the terms "first," "second," and the like may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another.

Fig. 1 is a diagram of an implementation environment of an interface testing method based on automatic parameter identification provided in an embodiment, as shown in fig. 1, in which an apparatus 110 and a client 120 are included.

The device 110 may be a server device, such as a device that caches requested parameters in the parameter analyzer or application program interface information, or a server device that is used to deploy a pre-trained parameter type recognition model. When an interface test based on automatic parameter identification is required, when a triggering instruction for a functional node in a system to be tested is detected by a client 120, capturing application program interface information generated after the functional node is triggered, extracting a request parameter in the application program interface information by the client 120 and caching the request parameter into a device 110, acquiring a pre-trained parameter type identification model from the device 110 by the client 120, identifying and outputting a type to which the request parameter cached in the device 110 belongs according to a parameter analyzer and the pre-trained parameter type identification model by the client 120, carrying out parameterization according to the type to which the request parameter belongs by the client 120 to generate a parameterization method, splicing the parameterization method and request data to generate a parameterized interface program, executing the parameterized interface program by the client 120 to obtain a test case, and binding the test case and the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result.

It should be noted that the client 120 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, and the like. The device 110 and the client 120 may be connected through bluetooth, USB (Universal Serial Bus), or other communication connection methods, which is not limited herein.

Fig. 2 is a schematic diagram of the internal structure of the apparatus in one embodiment. As shown in fig. 2, the device includes a processor, a medium, a memory, and a network interface connected by a system bus. The device comprises a medium, an operating system, a database and computer readable instructions, wherein the database can store control information sequences, and the computer readable instructions can enable a processor to realize an interface testing method based on automatic parameter identification when being executed by the processor. The processor of the device is used to provide computing and control capabilities to support the operation of the entire device. The memory of the device may have stored therein computer readable instructions that, when executed by the processor, cause the processor to perform a method of interface testing based on automatic identification of parameters. The network interface of the device is used for connecting and communicating with the terminal. Those skilled in the art will appreciate that the configuration shown in fig. 2 is a block diagram of only a portion of the configuration associated with the present application and does not constitute a limitation on the devices to which the present application applies, and that a particular device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components. Wherein the medium is a readable storage medium.

The following describes in detail an interface testing method based on automatic parameter identification according to an embodiment of the present application with reference to fig. 3 to 5. The method may be implemented in dependence on a computer program, operable on a von neumann-based interface test device based on automatic parameter identification. The computer program may be integrated into the application or may run as a separate tool-like application.

Referring to fig. 3, a schematic flow chart of an interface testing method based on automatic parameter identification is provided in the embodiment of the present application. As shown in fig. 3, the method of the embodiment of the present application may include the following steps:

s101, when a trigger instruction aiming at a functional node in a system to be tested is detected, capturing application program interface information generated after the functional node is triggered; wherein, the application program interface information comprises request parameters and request data;

the system to be tested is a software system to be tested, and may be a web system, an H5 webpage type webpage, or an application app. The trigger instruction is a signal generated by clicking a relevant function key of the system to be tested by a user. An application Programming interface (api) is a convention for linking different components of a software system. The request parameter is parameter information required by the API, for example, the parameter information may be: { "name": Zhang III "," description ": xxx", "phone": 130xxxxxxxx "," Email ": xxx @ xxx. The request data includes at least a requested path url, header information headers, and a request method.

In the embodiment of the application, the trigger instruction may be a signal generated by a user by clicking a key of a functional node in the system to be tested, or a signal generated by a user by inputting relevant form information on a form filling page of the system to be tested and finally triggering a submit key of the form filling page.

In a possible implementation manner, when interface testing is required, firstly, a system to be tested is connected and accessed, then, a user generates an instruction after triggering aiming at a functional node in the system to be tested, code logic layer processing is performed according to the instruction, application program interface information is generated, and application program interface information is captured by a network capture tool.

In another possible implementation mode, when interface testing is needed, the system to be tested is connected and accessed, then a user fills in form page information in the system to be tested, after the form filling is finished, a trigger instruction is generated by clicking a submission key on the form, code logic layer processing is performed according to the trigger instruction to generate application program interface information, and the application program interface information is captured by a network capture tool.

S102, extracting request parameters in the application program interface information;

generally, the application program interface information includes request parameters, a path url of the request, header information headers, a request method, and the like.

In a possible implementation manner, when the request parameters are extracted, a pre-configured regular filter is loaded first, then data included in the application program interface information are input into the regular filter one by one, whether the data included in the application program interface information are the request parameters is judged, and if the data are the request parameters, the data are output.

Specifically, when a pre-configured regular filter is generated, first, a request parameter used in the field of software programming is collected to generate a data dictionary, then the regular filter is initialized, and finally, the data dictionary is associated with the initialized regular filter to generate the pre-configured regular filter.

In another possible implementation manner, when the request parameter is extracted, the request parameter used in the software programming field is collected to generate a request parameter corpus sample, a word segmentation dictionary is constructed based on the request parameter corpus sample, then word segmentation is performed on the application program interface information according to the word segmentation dictionary to generate a word segmentation result, and finally the word segmentation result is determined as the request parameter to be output. The constructed segmentation dictionary can classify the request parameters included in the application program interface information because the segmentation dictionary is constructed by specially using a large amount of request parameters used in the field of software programming.

S103, identifying the request parameters according to a preset parameter analyzer and a pre-trained parameter type identification model, and outputting the types of the request parameters; the pre-trained parameter type recognition model is generated based on a first training sample and a second training sample, and the similarity between the first training sample and the second training sample is greater than a preset value;

the type of the request parameter is a type set in software programming, for example, the type of data in java programming includes a character type, a boolean type and a numerical type, the byte type includes char, the boolean type includes bootean, and the numerical type includes byte, short, int, long, float and double.

In the embodiment of the application, when the type of the request parameter is identified, the parameter analyzer and the pre-trained parameter type identification model are loaded firstly, then the request parameter is input into the parameter analyzer to obtain the corresponding parameter type through the parameter analyzer, and when the parameter analyzer cannot identify the parameter type, the request parameter is input into the pre-trained parameter type identification model to be identified, and the type to which the request parameter belongs is output.

Further, the pre-trained parameter type recognition model comprises a representation layer, a BilSTM layer and a CRF layer.

Specifically, the request parameters are input into a pre-trained parameter type recognition model for recognition, when the type of the request parameters is output, the request parameters are input into a presentation layer, a word vector set is output, each word vector in the word vector set is input into a BilSTM layer, a label vector corresponding to each word vector is output, the label vector corresponding to each word vector is input into a CRF layer, a category value matrix corresponding to the request parameters is output, and the type of the request parameters is determined according to the category value matrix.

For example, the extracted request parameter is processed through a parameter analyzer and a pre-trained parameter type recognition model to obtain the corresponding parameter value type, if any

The parameters "name": zhang (name) "type," phone ": 130xxxxxxxx (cell phone number)" type,

"Email": xxx. xxx "[ mailbox ] type;

specifically, when a pre-trained parameter type recognition model is generated, firstly, a parameter type recognition model is created by adopting a BilSTM-CRF algorithm, then, a request parameter used in the field of software programming is obtained to generate a first training sample, then, preprocessing and expansion are carried out on the first training sample to generate a second training sample, then, a statistical analysis instruction aiming at the first training sample is received, a plurality of constraint rules are generated based on the statistical analysis instruction, then, the first training sample and the second training sample are input into the parameter type recognition model to be trained, and the damage of the model is output

And (4) losing values, generating a trained parameter type recognition model when the loss values and the training times reach preset values, and finally adding various constraint rules into a CRF layer in the trained parameter type recognition model to generate the pre-trained parameter type recognition model.

Specifically, a first training sample and a second training sample are input into the parameter type identification model for training, when a loss value of the model is output, the first training sample and the second training sample are input into the parameter type identification model, a first loss value of the first training sample and a second loss value of the second training sample are output, and then an average value of the first loss value and the second loss value is determined as the loss value of the model.

S104, carrying out parameterization according to the type of the request parameter to generate a parameterization method, and splicing the parameterization method and the request data to generate a parameterized interface program;

in a possible implementation manner, after obtaining the type of the request parameter, first, a data falsification library is called, then, an automatic parameterization of the type of the request parameter is performed according to the data falsification library to generate a parameterization method, then, request data (for example, url/headers/http method) included in the interface information of the application program in step S101 is obtained, and finally, the parameterization method and the request data are combined to generate a parameterized interface program.

And S105, executing the parameterized interface program to obtain a test case, binding the test case with the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result.

In a possible implementation manner, after the parameterized interface program is generated, when an interface trigger instruction for the parameterized interface program is received, the parameterized interface program is executed to obtain a test case from the forged database, the obtained test case is bound with the request parameter to generate an interface to be tested, and finally the interface to be tested is executed to generate a test result.

Further, the test cases obtained from the data falsification library can be obtained randomly, or can be obtained one by one in an increasing manner of the ID identifier.

For example, the type "name" is automatically parameterized as "name": fake.

Further, after the parameterized interface program is generated, the execution times of the parameterized interface program input by a user can be received, and the parameterized interface program is executed circularly according to the execution times to obtain a plurality of test cases.

For example, as shown in fig. 4, fig. 4 is a schematic process diagram of an interface test process based on automatic parameter identification, which is applied to a scene of filling a form page, and is used to access a form filling page of a system to be tested (the system to be tested may be web/H5/app), fill form information, capture an interface triggered when the system to be tested is accessed through a network capture tool, obtain form request parameter information from the captured interface information through a rule, analyze a value type of a corresponding parameter of each parameter through a parameter analyzer, input the parameter into a model for identification if the parameter analyzer cannot identify the parameter analyzer, execute automatic parameterization of the corresponding type according to the type to which the parameter belongs, and combine the parameterized parameter and request data of the interface to generate a triggerable interface test program.

In the embodiment of the application, when detecting a trigger instruction for a functional node in a system to be tested, an interface testing device based on automatic parameter identification first captures application program interface information generated after triggering the functional node, extracts a request parameter in the application program interface information, then identifies and outputs a type to which the request parameter belongs, the type to which the request parameter belongs is identified according to a parameter analyzer and a pre-trained parameter type identification model, the pre-trained parameter type identification model is generated based on a first training sample and a second training sample, then generates a parameterization method according to the type to which the request parameter belongs, splices the parameterization method and the request data to generate a parameterized interface program, finally executes the interface program to obtain a test case, and binds the test case and the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result. According to the application, the type of the request parameter contained in the application program interface information is identified by adopting the regular filter and the pre-trained parameter type identification model, so that the request parameter contained in the application program interface information can be parameterized automatically, the system test period is shortened, and the test efficiency of software test is reduced.

As shown in fig. 5, fig. 5 is a method for training a parameter type recognition model provided in the present application, including the following steps:

s201, establishing a parameter type identification model by adopting a BilSTM-CRF algorithm;

the CRF is a common sequence labeling algorithm and can be used for tasks such as part-of-speech labeling, word segmentation, named entity identification and the like. BilSTM + CRF is a popular sequence labeling algorithm at present, and the BilSTM and the CRF are combined together, so that the model can not only consider the relevance between the front and the back of the sequence like the CRF, but also has the feature extraction and fitting capability of the LSTM.

In general, BilSTM can predict the probability that each word belongs to a different tag, and then use Softmax to obtain the tag with the highest probability as the predicted value for that location. This ignores the association between tags at the time of prediction.

S202, acquiring request parameters used in the field of software programming to generate a first training sample;

s203, preprocessing and expanding the first training sample to generate a second training sample;

s204, receiving a statistical analysis instruction aiming at the first training sample, and generating a plurality of constraint rules based on the statistical analysis instruction;

s205, inputting the first training sample and the second training sample into a parameter type recognition model for training, and outputting a loss value of the model;

s206, when the loss value and the training frequency of the model reach preset values, generating a trained parameter type recognition model;

and S207, adding a plurality of constraint rules into a CRF layer in the trained parameter type recognition model to generate a pre-trained parameter type recognition model.

In the embodiment of the application, because the correlation is established between the first training sample and the second training sample, the identification precision of the trained parameter type identification model is more accurate, and the accuracy of system testing is improved.

The following are embodiments of the apparatus of the present invention that may be used to perform embodiments of the method of the present invention. For details which are not disclosed in the embodiments of the apparatus of the present invention, reference is made to the embodiments of the method of the present invention.

Referring to fig. 6, a schematic structural diagram of an interface testing apparatus based on automatic parameter identification according to an exemplary embodiment of the present invention is shown, which is applied to a server. The interface testing device based on automatic parameter identification can be realized by software, hardware or a combination of the two to form all or part of equipment. The device 1 comprises an application program interface information capturing module 10, a request parameter extracting module 20, a type identifying module 30, an interface program generating module 40 and a test result generating module 50.

The application program interface information capturing module 10 is configured to capture application program interface information generated after a function node is triggered when a trigger instruction for the function node in the system to be tested is detected; wherein, the application program interface information comprises request parameters and request data;

a request parameter extraction module 20, configured to extract a request parameter from the application program interface information;

the type identification module 30 is configured to identify the request parameter according to a preset parameter analyzer and a pre-trained parameter type identification model, and output the type of the request parameter; the pre-trained parameter type recognition model is generated based on a first training sample and a second training sample, and the similarity between the first training sample and the second training sample is greater than a preset value;

the interface program generating module 40 is used for carrying out parameterization according to the type of the request parameter to generate a parameterization method, and splicing the parameterization method with the request data to generate a parameterized interface program;

and the test result generation module 50 is configured to execute the parameterized interface program to obtain a test case, bind the test case with the request parameter to generate an interface to be tested, and execute the interface to be tested to generate a test result.

The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.

In the embodiment of the application, when detecting a trigger instruction for a functional node in a system to be tested, an interface testing device based on automatic parameter identification first captures application program interface information generated after triggering the functional node, extracts a request parameter in the application program interface information, then identifies and outputs a type to which the request parameter belongs, the type to which the request parameter belongs is identified according to a parameter analyzer and a pre-trained parameter type identification model, the pre-trained parameter type identification model is generated based on a first training sample and a second training sample, then generates a parameterization method according to the type to which the request parameter belongs, splices the parameterization method and the request data to generate a parameterized interface program, finally executes the interface program to obtain a test case, and binds the test case and the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result. According to the application, the type of the request parameter contained in the application program interface information is identified by adopting the regular filter and the pre-trained parameter type identification model, so that the request parameter contained in the application program interface information can be parameterized automatically, the system test period is shortened, and the test efficiency of software test is reduced.

In one embodiment, an apparatus is presented, the apparatus comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program: when a trigger instruction aiming at a functional node in a system to be tested is detected, capturing application program interface information generated after the functional node is triggered; wherein, the application program interface information comprises request parameters and request data; extracting request parameters in the application program interface information; identifying the request parameters according to a preset parameter analyzer and a pre-trained parameter type identification model and outputting the types of the request parameters; the pre-trained parameter type recognition model is generated based on a first training sample and a second training sample, and the similarity between the first training sample and the second training sample is greater than a preset value; parameterizing according to the type of the request parameter to generate a parameterization method, and splicing the parameterization method and the request data to generate a parameterized interface program; and executing the parameterized interface program to obtain a test case, binding the test case with the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result.

In one embodiment, when the processor executes the application program interface information generated after the trigger function node is captured when the trigger instruction for the function node in the system to be tested is detected, the following operations are specifically executed: connecting and accessing a system to be tested; when a trigger instruction aiming at a functional node in a system to be tested is detected, generating application program interface information according to the trigger instruction; and capturing the application program interface information by adopting a network packet capturing tool.

In one embodiment, when the processor executes the application program interface information generated after the trigger function node is captured when the trigger instruction for the function node in the system to be tested is detected, the following operations are specifically executed: connecting and accessing a system to be tested; receiving data information filled in aiming at a current page form in a system to be tested; when a submission instruction for the current page form is detected, generating application program interface information according to the filled data information; and capturing the application program interface information by adopting a network packet capturing tool.

In one embodiment, when the processor extracts the request parameter in the application program interface information, the following operations are specifically performed: loading a pre-configured regular filter; inputting data contained in the application program interface information into a regular filter one by one, and identifying request parameters contained in the application program interface information; outputting the request parameters; the method comprises the following steps of generating a pre-configured regular filter, wherein the method comprises the following steps: collecting request parameters used in the field of software programming to generate a data dictionary; initializing a regular filter; and associating the data dictionary with the initialized regular filter to generate a pre-configured regular filter.

In one embodiment, when the processor identifies and outputs the type to which the request parameter belongs, the following operations are specifically performed: loading a parameter analyzer and a pre-trained parameter type identification model; inputting the request parameters into a parameter analyzer, and outputting an analysis result; when the type corresponding to the request parameter exists in the analysis result, outputting the type corresponding to the request parameter; or when the type corresponding to the request parameter does not exist in the analysis result, inputting the request parameter into a parameter type recognition model trained in advance; and outputting the type corresponding to the request parameter.

In one embodiment, the processor performs the following operations when inputting the request parameter into the pre-trained parameter type recognition model: the presentation layer extracts the word vectors of the request parameters to generate a word vector set; the BilSTM layer carries out label vectorization on each word vector in the word vector set to generate a label vector corresponding to each word vector; the CRF layer calculates a category value matrix of the label vector corresponding to each word vector; and determining the type of the request parameter according to the class value matrix of the label vector corresponding to each word vector.

In one embodiment, the processor generates the pre-trained parameter type recognition model according to the following method, specifically performing the following operations: establishing a parameter type identification model by adopting a BilSTM-CRF algorithm; acquiring request parameters used in the field of software programming to generate a first training sample; preprocessing and expanding the first training sample to generate a second training sample; receiving a statistical analysis instruction aiming at a first training sample, and generating a plurality of constraint rules based on the statistical analysis instruction; inputting the first training sample and the second training sample into a parameter type recognition model for training, and outputting a loss value of the model; when the loss value and the training times of the model reach preset values, generating a trained parameter type recognition model; and adding a plurality of constraint rules into a CRF layer in the trained parameter type recognition model to generate a pre-trained parameter type recognition model.

In the embodiment of the application, when detecting a trigger instruction for a functional node in a system to be tested, an interface testing device based on automatic parameter identification first captures application program interface information generated after triggering the functional node, extracts a request parameter in the application program interface information, then identifies and outputs a type to which the request parameter belongs, the type to which the request parameter belongs is identified according to a parameter analyzer and a pre-trained parameter type identification model, the pre-trained parameter type identification model is generated based on a first training sample and a second training sample, then generates a parameterization method according to the type to which the request parameter belongs, splices the parameterization method and the request data to generate a parameterized interface program, finally executes the interface program to obtain a test case, and binds the test case and the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result. According to the application, the type of the request parameter contained in the application program interface information is identified by adopting the regular filter and the pre-trained parameter type identification model, so that the request parameter contained in the application program interface information can be parameterized automatically, the system test period is shortened, and the test efficiency of software test is reduced. Meanwhile, the correlation is established between the first training sample and the second training sample, so that the identification precision of the trained parameter type identification model is more accurate, and the accuracy of system testing is improved.

In one embodiment, a medium is presented having computer-readable instructions stored thereon which, when executed by one or more processors, cause the one or more processors to perform the steps of: when a trigger instruction aiming at a functional node in a system to be tested is detected, capturing application program interface information generated after the functional node is triggered; wherein, the application program interface information comprises request parameters and request data; extracting request parameters in the application program interface information; identifying the request parameters according to a preset parameter analyzer and a pre-trained parameter type identification model and outputting the types of the request parameters; the pre-trained parameter type recognition model is generated based on a first training sample and a second training sample, and the similarity between the first training sample and the second training sample is greater than a preset value; parameterizing according to the type of the request parameter to generate a parameterization method, and splicing the parameterization method and the request data to generate a parameterized interface program; and executing the parameterized interface program to obtain a test case, binding the test case with the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result.

In one embodiment, when the processor executes the application program interface information generated after the trigger function node is captured when the trigger instruction for the function node in the system to be tested is detected, the following operations are specifically executed: connecting and accessing a system to be tested; when a trigger instruction aiming at a functional node in a system to be tested is detected, generating application program interface information according to the trigger instruction; and capturing the application program interface information by adopting a network packet capturing tool.

In one embodiment, when the processor executes the application program interface information generated after the trigger function node is captured when the trigger instruction for the function node in the system to be tested is detected, the following operations are specifically executed: connecting and accessing a system to be tested; receiving data information filled in aiming at a current page form in a system to be tested; when a submission instruction for the current page form is detected, generating application program interface information according to the filled data information; and capturing the application program interface information by adopting a network packet capturing tool.

In one embodiment, when the processor extracts the request parameter in the application program interface information, the following operations are specifically performed: loading a pre-configured regular filter; inputting data contained in the application program interface information into a regular filter one by one, and identifying request parameters contained in the application program interface information; outputting the request parameters; the method comprises the following steps of generating a pre-configured regular filter, wherein the method comprises the following steps: collecting request parameters used in the field of software programming to generate a data dictionary; initializing a regular filter; and associating the data dictionary with the initialized regular filter to generate a pre-configured regular filter.

In one embodiment, when the processor identifies and outputs the type to which the request parameter belongs, the following operations are specifically performed: loading a parameter analyzer and a pre-trained parameter type identification model; inputting the request parameters into a parameter analyzer, and outputting an analysis result; when the type corresponding to the request parameter exists in the analysis result, outputting the type corresponding to the request parameter; or when the type corresponding to the request parameter does not exist in the analysis result, inputting the request parameter into a parameter type recognition model trained in advance; and outputting the type corresponding to the request parameter.

In one embodiment, the processor performs the following operations when inputting the request parameter into the pre-trained parameter type recognition model: the presentation layer extracts the word vectors of the request parameters to generate a word vector set; the BilSTM layer carries out label vectorization on each word vector in the word vector set to generate a label vector corresponding to each word vector; the CRF layer calculates a category value matrix of the label vector corresponding to each word vector; and determining the type of the request parameter according to the class value matrix of the label vector corresponding to each word vector.

In one embodiment, the processor generates the pre-trained parameter type recognition model according to the following method, specifically performing the following operations: establishing a parameter type identification model by adopting a BilSTM-CRF algorithm; acquiring request parameters used in the field of software programming to generate a first training sample; preprocessing and expanding the first training sample to generate a second training sample; receiving a statistical analysis instruction aiming at a first training sample, and generating a plurality of constraint rules based on the statistical analysis instruction; inputting the first training sample and the second training sample into a parameter type recognition model for training, and outputting a loss value of the model; when the loss value and the training times of the model reach preset values, generating a trained parameter type recognition model; and adding a plurality of constraint rules into a CRF layer in the trained parameter type recognition model to generate a pre-trained parameter type recognition model.

In the embodiment of the application, when detecting a trigger instruction for a functional node in a system to be tested, an interface testing device based on automatic parameter identification first captures application program interface information generated after triggering the functional node, extracts a request parameter in the application program interface information, then identifies and outputs a type to which the request parameter belongs, the type to which the request parameter belongs is identified according to a parameter analyzer and a pre-trained parameter type identification model, the pre-trained parameter type identification model is generated based on a first training sample and a second training sample, then generates a parameterization method according to the type to which the request parameter belongs, splices the parameterization method and the request data to generate a parameterized interface program, finally executes the interface program to obtain a test case, and binds the test case and the request parameter to generate an interface to be tested, and executing the interface to be tested to generate a test result. According to the application, the type of the request parameter contained in the application program interface information is identified by adopting the regular filter and the pre-trained parameter type identification model, so that the request parameter contained in the application program interface information can be parameterized automatically, the system test period is shortened, and the test efficiency of software test is reduced. Meanwhile, the correlation is established between the first training sample and the second training sample, so that the identification precision of the trained parameter type identification model is more accurate, and the accuracy of system testing is improved.

It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer readable medium, and when executed, can include the processes of the embodiments of the methods described above. The medium may be a non-volatile medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).

The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.

The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:测试方法、装置、设备、存储介质及程序产品

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!