CN112527630B - Test case generation method, device, computer equipment and storage medium - Google Patents

Test case generation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN112527630B
CN112527630B CN202011295103.7A CN202011295103A CN112527630B CN 112527630 B CN112527630 B CN 112527630B CN 202011295103 A CN202011295103 A CN 202011295103A CN 112527630 B CN112527630 B CN 112527630B
Authority
CN
China
Prior art keywords
interface
target
test
case
test case
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.)
Active
Application number
CN202011295103.7A
Other languages
Chinese (zh)
Other versions
CN112527630A (en
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.)
Ping An Consumer Finance Co Ltd
Original Assignee
Ping An Consumer Finance 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 Ping An Consumer Finance Co Ltd filed Critical Ping An Consumer Finance Co Ltd
Priority to CN202011295103.7A priority Critical patent/CN112527630B/en
Publication of CN112527630A publication Critical patent/CN112527630A/en
Application granted granted Critical
Publication of CN112527630B publication Critical patent/CN112527630B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • 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
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computational Linguistics (AREA)
  • Mathematical Physics (AREA)
  • Biophysics (AREA)
  • Health & Medical Sciences (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Biomedical Technology (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to the field of testing, and provides a test case generation method, a device, computer equipment and a storage medium, wherein the method comprises the following steps: receiving an input use case generation request; analyzing the use case generation request, and extracting interface information; inputting interface information into a preset analysis model, outputting and returning to a target interface type through the analysis model; judging whether a target universal test case corresponding to the target interface type exists or not based on the target interface type; if yes, acquiring a target general test case and taking the target general test case as a target test case of a target interface; if not, obtaining an interface class test case corresponding to the target interface type from a case database; and modifying the interface class test cases, and taking the modified interface class test cases as target test cases. The method and the device can improve the generation efficiency of the test case. The method and the device can be applied to the field of blockchains, and data such as target test cases can be stored on the blockchains.

Description

Test case generation method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of testing, and in particular, to a method and apparatus for generating a test case, a computer device, and a storage medium.
Background
The interface test is a part of project test, the main object of which is interface, which is a test for testing interfaces between components of the system. Interface testing requires testing using test cases, which are a set of test inputs, execution conditions, and expected results that are tailored for a particular goal in order to test a program path or verify whether a particular requirement is met.
The test cases required by the existing interface test are manually written by a tester according to different product requirements, and are maintained in an excel table after the writing is completed. The inventor realizes that the test case is often written in a manual writing mode, so that a lot of time of a tester is consumed, the labor is excessively consumed, and the generation efficiency of the test case is low and is easy to make mistakes. In addition, for multiple interfaces of the same or similar types, their test cases are also similar, and if the test cases are rewritten each time, the test efficiency is further reduced.
Disclosure of Invention
The main purpose of the application is to provide a test case generation method, a device, computer equipment and a storage medium, and aims to solve the technical problems that a great amount of time of a tester is often required to be consumed, the labor is excessively consumed, the generation efficiency of the test case is low and errors are prone to occur in the conventional manual writing mode.
The application provides a test case generation method, which comprises the following steps:
receiving a use case generation request input by a user, wherein the use case generation request carries interface information corresponding to a target interface;
analyzing the use case generation request and extracting the interface information;
inputting the interface information into a preset analysis model, and outputting a target interface type corresponding to the interface information through the analysis model;
receiving the target interface type returned by the analysis model;
judging whether a target universal test case corresponding to the target interface type exists or not based on the target interface type;
if the target universal test case corresponding to the target interface type exists, acquiring the target universal test case corresponding to the target interface type, and taking the target universal test case as the target test case of the target interface;
if the target universal test case corresponding to the target interface type does not exist, acquiring an interface type test case corresponding to the target interface type from a preset case database;
and modifying the interface test cases according to preset rules to obtain modified interface test cases, and taking the modified interface test cases as target test cases corresponding to the target interfaces.
Optionally, the case generation request further carries test data, and the step of modifying the interface test case according to a preset rule to obtain a modified interface test case, and using the modified interface test case as a target test case of the target interface includes:
analyzing the use case generation request, and extracting the test data, wherein the test data comprises a test object and parameter data corresponding to the test object;
copying the interface test cases to generate test case copies identical to the interface test cases;
screening out the specified test objects identical to the test objects from the test case copies;
acquiring specified parameter data corresponding to the specified test object in the test case copy;
and carrying out replacement processing on the appointed parameter data in the test case copy by using the parameter data to obtain a replaced test case copy, and taking the replaced test case copy as the target test case.
Optionally, the step of modifying the interface test case according to a preset rule to obtain a modified interface test case, and using the modified interface test case as a target test case of the target interface includes:
Acquiring a preset editable document template;
copying the interface test cases into the editable document template to obtain corresponding case documents;
judging whether the user has the authority of modifying the use case or not;
if the user has the authority of modifying the use case, displaying the use case document on the current page;
and receiving modification processing of the interface class test case in the case document by the user, obtaining a modified case document, and taking the case text data as the target test case.
Optionally, the use case generating request further carries first user information, and the step of determining whether the user has the right to modify the use case includes:
analyzing the use case generation request and extracting the first user information;
calling a preset classification tree model;
determining a user role category corresponding to the first user information through the classification tree model, and determining a designated authority level corresponding to the category of the first user information based on a corresponding relation between a preset category and the authority level;
acquiring a modification authority level corresponding to the service operation of the modification use case based on a preset service operation authority table;
Judging whether the appointed level authority is smaller than the modification authority level;
if the assigned level authority is smaller than the modification authority level, judging that the user does not have the authority of the modification use case;
and if the assigned level authority is not smaller than the modification authority level, judging that the user has the authority of modifying the use case.
Optionally, the step of modifying the interface test case according to a preset rule to obtain a modified interface test case, and using the modified interface test case as the target test case corresponding to the target interface includes:
acquiring interface communication parameters corresponding to the target interface and acquiring an interface address of the target interface;
generating a corresponding interface test request according to the interface communication parameters and the target test case;
acquiring current time, and judging whether the current time is in a preset idle time period, wherein the idle time period is generated after statistical analysis is performed on historical resource consumption data of the target interface;
if the current time is within the idle time period, the interface test request is sent to the interface address, so that the target interface immediately analyzes the interface test request after receiving the interface test request to obtain an input parameter in the interface test request, and processes the input parameter to generate a corresponding test result;
Receiving the test result returned by the target interface;
and comparing the test result with a preset expected test result to generate a corresponding test report.
Optionally, before the step of inputting the interface information into a preset analysis model and outputting, by the analysis model, a target interface type corresponding to the interface information, the method includes:
collecting a preset number of sample data, wherein the sample data comprises interface information samples and interface type results corresponding to the interface information samples;
taking the interface information sample as input of a preset neural network model, taking an interface type result corresponding to the interface information sample as output of the neural network model, and training the neural network model based on a plurality of groups of interface information samples and interface type results corresponding to the interface information samples one by one to obtain a trained initial model;
acquiring preset test data, verifying the initial model based on the test data, and judging whether the initial model passes the verification;
if the verification is passed, the initial model is used as the analysis model;
the analytical model is stored to a blockchain network.
Optionally, before the step of acquiring the interface class test case corresponding to the target interface type from the preset case database if the target universal test case corresponding to the target interface type does not exist, the method includes:
acquiring type information of each test case data, wherein the type information is used for representing the type of an interface applicable to the test case data;
establishing a one-to-one association relation between each type of information and each test case data;
based on the association relation, storing each test case data in a preset database, and generating the case database.
The application also provides a test case generating device, which comprises:
the first receiving module is used for receiving a use case generation request input by a user, wherein the use case generation request carries interface information corresponding to a target interface;
the extraction module is used for analyzing the use case generation request and extracting the interface information;
the analysis module is used for inputting the interface information into a preset analysis model, and outputting a target interface type corresponding to the interface information through the analysis model;
The second receiving module is used for receiving the target interface type returned by the analysis model;
the first judging module is used for judging whether a target universal test case corresponding to the target interface type exists or not based on the target interface type;
the first determining module is used for acquiring a target general test case corresponding to the target interface type if the target general test case corresponding to the target interface type exists, and taking the target general test case as the target test case of the target interface;
the first acquisition module is used for acquiring the interface class test cases corresponding to the target interface types from a preset case database if the target general test cases corresponding to the target interface types do not exist;
and the second determining module is used for modifying the interface class test cases according to preset rules to obtain modified interface class test cases, and taking the modified interface class test cases as target test cases corresponding to the target interfaces.
The application also provides a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of the above method when executing the computer program.
The present application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the above method.
The test case generation method, the device, the computer equipment and the storage medium provided by the application have the following beneficial effects:
according to the test case generation method, the device, the computer equipment and the storage medium, the corresponding target interface type is obtained by inputting the interface information in the received case generation request into the preset classification model, and the target general test case is directly used as the target test case of the target interface under the condition that the target general test case corresponding to the target interface type exists. Meanwhile, under the condition that the target general test case does not exist, the interface type test case corresponding to the target interface type is intelligently modified to generate the target general test case corresponding to the target interface. According to the method and the device for generating the target test cases, the target test cases corresponding to the target interfaces can be generated rapidly and intelligently, test personnel are not required to rewrite the test cases, the generation efficiency of the target test cases is improved, the data accuracy in the target test cases is ensured, and the generation difficulty of the target test cases is also reduced.
Drawings
FIG. 1 is a flow chart of a test case generation method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a test case generating device according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application.
The realization, functional characteristics and advantages of the present application will be further described with reference to the embodiments, referring to the attached drawings.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless expressly stated otherwise, as understood by those skilled in the art. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. The term "and/or" as used herein includes all or any element and all combination of one or more of the associated listed items.
It will be understood by those skilled in the art that all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs unless defined otherwise. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
Referring to fig. 1, a test case generating method according to an embodiment of the present application includes:
s1: receiving a use case generation request input by a user, wherein the use case generation request carries interface information corresponding to a target interface;
s2: analyzing the use case generation request and extracting the interface information;
s3: inputting the interface information into a preset analysis model, and outputting a target interface type corresponding to the interface information through the analysis model;
s4: receiving the target interface type returned by the analysis model;
s5: judging whether a target universal test case corresponding to the target interface type exists or not based on the target interface type;
S6: if the target universal test case corresponding to the target interface type exists, acquiring the target universal test case corresponding to the target interface type, and taking the target universal test case as the target test case of the target interface;
s7: if the target universal test case corresponding to the target interface type does not exist, acquiring an interface type test case corresponding to the target interface type from a preset case database;
s8: and modifying the interface test cases according to preset rules to obtain modified interface test cases, and taking the modified interface test cases as target test cases corresponding to the target interfaces.
As described in steps S1 to S8, the execution subject of the embodiment of the method is a test case generating device. In practical applications, the test case generating device may be implemented by a virtual device, for example, a software code, or may be implemented by an entity device in which related execution codes are written or integrated, and may perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device. The test case generating device in the embodiment can quickly and intelligently generate the target test case corresponding to the target interface, test personnel are not required to rewrite the test case, the generating efficiency of the target test case is improved, and the generating difficulty of the target test case is also reduced. Specifically, firstly, a case generation request input by a user is received, wherein the case generation request can be a request for generating a target test case for a target interface, and interface information corresponding to the target interface is carried in the case generation request. In addition, the use case generation request may also carry other information, for example, may include user information, test information, and so on. Then, the use case generation request is analyzed and processed to extract the interface information. After the interface information is obtained, the interface information is input into a preset analysis model, and a target interface type corresponding to the interface information is output through the analysis model. And receiving the target interface type returned by the analysis model. Wherein the pre-set neural network model may be trained based on pre-acquired sample data to generate the analytical model. The sample data includes a certain number of interface information samples and interface type results corresponding to the interface information samples, and the neural network model may employ a Tensorflow. And then based on the target interface type, judging whether a target universal test case corresponding to the target interface type exists. For different types of interfaces, some special interfaces can use the same general test cases, and the special interfaces and the general test cases with matching relations with the special interfaces can be established in advance to correspond to the preset general test cases and stored in a preset general case library, so that the matched general test cases can be conveniently and quickly called according to the input interface information. In addition, the universal test cases can be written and generated by an automatic test script language, and can be run by a corresponding automatic test device or an automatic test system to complete automatic tests. And if the target universal test case corresponding to the target interface type exists, acquiring the target universal test case corresponding to the target interface type, and taking the target universal test case as the target test case of the target interface. The interface information and the special interface information of each special interface in the preset general case library can be matched, if target special interface information which is successfully matched exists, a target general test case corresponding to the target special interface information can be further queried from the general case library, and the target passing test case is determined to be a target test case corresponding to the target interface. And if the target universal test case corresponding to the target interface type does not exist, acquiring the interface type test case corresponding to the target interface type from a preset case database. The case database may store test case data which is classified based on type information and can be used for different interface types, and the type information is used for indicating the interface type to which the test case data is applicable. The interface type test case is a test case template corresponding to an interface belonging to the same type as the target interface. And the data format of the test object contained in the interface class test case is the same as that of the test object of the target test case corresponding to the target interface to be generated, but the parameter data corresponding to the test object in the interface class test case is different from that of the target test case to be generated. And finally, when the interface test cases are obtained, carrying out modification treatment on the interface test cases according to preset rules to obtain modified interface test cases, and taking the modified interface test cases as target test cases corresponding to the target interfaces. The preset rule is not particularly limited, and the target test case to be generated can be obtained by performing adaptive replacement processing on the parameter data of some test objects based on the interface test case; or the editable case document containing the content of the interface type test case can be displayed to the user, so that the user can modify the interface type test case according to the actual interface test requirement to generate the required target test case, and the like. In the embodiment, the corresponding target interface type is obtained by inputting the interface information in the received case generation request into a preset classification model, and when a target universal test case corresponding to the target interface type exists, the target universal test case is directly used as the target test case of the target interface. Meanwhile, under the condition that the target general test case does not exist, the interface type test case corresponding to the target interface type is intelligently modified to generate the target general test case corresponding to the target interface. According to the method and the device for generating the target test cases, the target test cases corresponding to the target interfaces can be generated rapidly and intelligently, test personnel are not required to rewrite the test cases, the generation efficiency of the target test cases is improved, the data accuracy in the target test cases is ensured, and the generation difficulty of the target test cases is also reduced.
Further, in an embodiment of the present application, the step S8 includes:
s800: analyzing the use case generation request, and extracting the test data, wherein the test data comprises a test object and parameter data corresponding to the test object;
s801: copying the interface test cases to generate test case copies identical to the interface test cases;
s802: screening out the specified test objects identical to the test objects from the test case copies;
s803: acquiring specified parameter data corresponding to the specified test object in the test case copy;
s804: and carrying out replacement processing on the appointed parameter data in the test case copy by using the parameter data to obtain a replaced test case copy, and taking the replaced test case copy as the target test case.
As described in steps S800 to S804, the case generation request further carries test data, and the step of modifying the interface test case according to a preset rule to obtain a modified interface test case, and using the modified interface test case as a target test case for interfacing with the target specifically includes: the use case generation request is analyzed, and the test data is extracted, wherein the test data comprises a test object and parameter data corresponding to the test object. And then, copying the interface type test cases to generate test case copies which are the same as the interface type test cases. The interface class test case is a test case template corresponding to an interface belonging to the same class as the target interface. The data format of the test objects contained in the interface class test cases is the same as that of the test objects of the target test cases corresponding to the target interfaces to be generated, but the parameter data corresponding to the test objects in the interface class test cases are different from that of the target test cases to be generated, so that the target test cases to be generated can be obtained after the parameter data of some test objects are adaptively replaced on the basis of the interface class test cases. And then screening out the specified test objects which are the same as the test objects from the test case copies. And after the specified test object is obtained, obtaining specified parameter data corresponding to the specified test object in the test case copy. And after the specified parameters are obtained, replacing the specified parameter data in the test case copy by using the parameter data to obtain a replaced test case copy. And finally, storing the replaced test case copy, and taking the replaced test case copy as the target test case. After the interface test case is obtained, the embodiment intelligently screens the specified parameter data corresponding to the test object contained in the case generation request from the test case copy, and then uses the parameter data to replace the specified parameter data in the test case copy to generate the required target test case. The required target test case can be intelligently and rapidly generated by adopting direct copying and corresponding replacement of the parameter data in the interface test case, test personnel are not required to rewrite the test case, the generation efficiency of the target test case is improved, and the generation difficulty of the target test case is also reduced.
Further, in an embodiment of the present application, the step S8 includes:
s810: acquiring a preset editable document template;
s811: copying the interface test cases into the editable document template to obtain corresponding case documents;
s812: judging whether the user has the authority of modifying the use case or not;
s813: if the user has the authority of modifying the use case, displaying the use case document on the current page;
s814: and receiving modification processing of the interface class test case in the case document by the user, obtaining a modified case document, and taking the case text data as the target test case.
As described in steps S810 to S814, the step of modifying the interface test case according to a preset rule to obtain a modified interface test case, and using the modified interface test case as a target test case for the target interface may specifically include: first, a preset editable document template is acquired. The editable document template is a document template file in which a user can manually edit content, and may be a word document, for example. And copying the interface type test cases into the editable document template to obtain corresponding case documents. And then judging whether the user has the authority of modifying the use case. The verification method for verifying whether the user has the authority of the modification example is not particularly limited, for example, the specified authority level corresponding to the user may be obtained based on a preset classification tree model, and then the numerical value of the specified authority level is compared with the modification authority level corresponding to the business operation of the modification example, if the specified authority level is smaller than the modification authority level, it is determined that the user does not have the authority of the modification example, otherwise, it is determined that the user has the authority of the modification example. Other verification methods may also be used, and are not described in any great detail herein. And if the user has the authority to modify the use case, displaying the use case document on the current page. And receiving modification processing of the interface class test case in the case document by the user to obtain a modified case document. The interface test case is a test case template corresponding to an interface belonging to the same class as the target interface, so that the target test case to be generated can be obtained based on the adaptive modification of the interface test case. By displaying the editable case document containing the content of the interface type test case to the user, the user can modify the interface type test case according to the actual interface test requirement, for example, simply modify some parameter data related to the target interface at the corresponding data position in the interface type test case, so as to quickly generate the target test case matched with the target interface. And finally, storing the case text data in the modified case document, and taking the case text data as the target test case. After the interface test cases are obtained, the editable case document containing the content of the interface test cases is displayed to the user, so that the user can adaptively modify the interface test cases based on the target interface according to the actual interface test requirements, and the case text data in the case document after the user modification is saved, thereby generating the target test cases. By adopting the method and the device for manually modifying the interface class test cases related to the target interfaces to generate the required target test cases, a tester is not required to rewrite the test cases, the generation efficiency of the target test cases is improved, and the generation difficulty of the target test cases is also reduced.
Further, in an embodiment of the present application, the use case generating request further carries first user information, and step S812 includes:
s8120: analyzing the use case generation request and extracting the first user information;
s8121: calling a preset classification tree model;
s8122: determining a user role category corresponding to the first user information through the classification tree model, and determining a designated authority level corresponding to the category of the first user information based on a corresponding relation between a preset category and the authority level;
s8123: acquiring a modification authority level corresponding to the service operation of the modification use case based on a preset service operation authority table;
s8124: judging whether the appointed level authority is smaller than the modification authority level;
s8125: if the assigned level authority is smaller than the modification authority level, judging that the user does not have the authority of the modification use case;
s8126: and if the assigned level authority is not smaller than the modification authority level, judging that the user has the authority of modifying the use case.
As described in steps S8120 to S8126, the use case generation request further carries first user information, and the step of determining whether the user has the right to modify the use case may specifically include: first, the use case generation request is analyzed, and the first user information is extracted. And then calling a preset classification tree model, determining the user role category corresponding to the first user information through the classification tree model, and determining the appointed authority level corresponding to the category of the user information based on the corresponding relation between the preset category and the authority level. Wherein, a classification tree model is stored in advance, each node except for leaf nodes in the classification tree model corresponds to a classification rule, and each classification rule classifies one type of data in the user information. Therefore, the classification tree model can classify the user information layer by layer, and finally distribute the user information to a leaf node. And then, according to the corresponding relation between the preset leaf node and the authority level parameter, determining the authority level parameter corresponding to the user information. For example, assume that the user information includes: "job level: 8, development team: a, development tasks: 02", the root node of the classification tree model is classified by the" job level ", the second level node is classified by the" development team ", the third level node is classified by the" development task ", then the user information can be distributed to one leaf node by three layers of classification, and then the authority level parameter corresponding to the user information can be determined according to the corresponding relation between the preset leaf node and the authority level parameter. And then, based on a preset service operation authority list, acquiring a modification authority level corresponding to the service operation of the modification use case, and judging whether the authority of the designated level is smaller than the modification authority level. And a service operation authority table is pre-created, wherein authority levels corresponding to each service operation one by one are recorded in the service operation authority table. And if the designated level authority is smaller than the modification authority level, judging that the user does not have the authority of the modification use case. And if the specified level authority is not less than the modification authority level, determining that the user has the authority to modify the use case. According to the embodiment, based on the user information carried in the use case generation request, the authority level corresponding to the user information is quickly obtained through the classification tree model, then the authority level of the user is compared with the modification authority level corresponding to the service operation of the modification use case to obtain a comparison result, and whether the user corresponding to the user information has the authority of the modification use case or not can be accurately and quickly judged according to the comparison result. Only when the user is judged to have the permission to modify the use case, the editable use case document corresponding to the interface type test use case is displayed on the current page for the user to carry out use case modification processing, so that the data security in the test use case generation process is effectively ensured, and adverse effects caused by responding to the use case generation request input by an illegal user are avoided.
Further, in an embodiment of the present application, after the step S8, the method includes:
s820: acquiring interface communication parameters corresponding to the target interface and acquiring an interface address of the target interface;
s821: generating a corresponding interface test request according to the interface communication parameters and the target test case;
s822: acquiring current time, and judging whether the current time is in a preset idle time period, wherein the idle time period is generated after statistical analysis is performed on historical resource consumption data of the target interface;
s823: if the current time is within the idle time period, the interface test request is sent to the interface address, so that the target interface immediately analyzes the interface test request after receiving the interface test request to obtain an input parameter in the interface test request, and processes the input parameter to generate a corresponding test result;
s824: receiving the test result returned by the target interface;
s825: and comparing the test result with a preset expected test result to generate a corresponding test report.
After the target test case is obtained, the target interface may be further tested according to the target test case to generate a corresponding test report as described in steps S820 to S825. Specifically, after the step of modifying the interface test case according to the preset rule to obtain a modified interface test case and using the modified interface test case as the target test case corresponding to the target interface, the method may further include: firstly, obtaining interface communication parameters corresponding to the target interface, and obtaining an interface address of the target interface. The interface communication parameters include an interface communication protocol type, an interface communication mode and an interface data transmission format. The interface communication protocol type is the communication protocol supported by the target interface; the interface communication mode is a communication protocol supported by the target interface; the interface data transmission format is a data transmission format which can be analyzed and supported by the target interface. In addition, the related interface database can be queried according to the interface information corresponding to the target interface to acquire the interface communication parameters and the interface address of the target interface, so as to analyze the acquired interface communication parameters, and extract the interface communication protocol type, the interface communication mode and the interface data transmission format from the interface communication parameters. And then generating a corresponding interface test request according to the interface communication parameters and the target test case. The target test case can be packaged according to the acquired interface communication parameters, namely the interface communication protocol type, the interface communication mode and the interface data transmission format, so that an interface test request supported by the target interface can be obtained through packaging. In addition, the interface communication parameters are used for packaging the target test cases to generate the interface test requests supported by the target interfaces, so that the success rate of testing the target interfaces according to the interface test requests can be ensured. And then acquiring the current time, and judging whether the current time is in a preset idle time period, wherein the idle time period is generated after carrying out statistical analysis on historical resource consumption data of the target interface. The idle time period refers to a time period when the target interface is in an idle state, so that the test processing of the target interface in the idle time period does not influence other work of the target interface, the smoothness of a test process of the target interface test is ensured, and the test intelligence of the target interface is improved. And if the current time is in the idle time period, the interface test request is sent to the interface address, so that the target interface immediately analyzes the interface test request after receiving the interface test request to obtain an input parameter in the interface test request, and processes the input parameter to generate a corresponding test result. After the interface address corresponding to the target interface is acquired, communication connection can be established between the interface address and the target interface, and after the communication connection is established successfully, an interface test request is sent to the target interface through the communication connection, so that the target interface is tested according to the interface test request. In addition, the entering includes the target test case after the encapsulation by using the interface communication parameters. And finally, receiving the test result returned by the target interface, and comparing the test result with a preset expected test result to generate a corresponding test report. And the predicted test result is a test result returned by the target interface, wherein the test is performed on the target interface according to the target test case. In addition, the distinguishing information between the test result returned by the target interface and the expected test result can be determined through comparison, and a corresponding test report can be generated according to the distinguishing information. The test report may include at least the above-mentioned distinguishing information, test results, expected results, etc., and may also include a test start time, a test end time, etc. According to the method and the device, the interface test request for testing is sent to the target interface only when the current time is in the idle time period, so that the test processing of the target interface in the idle time period does not influence other works of the target interface, smoothness of a test process of the target interface test is guaranteed, and the intelligence of the test of the target interface is improved. In addition, in the process of testing the target interface, the test result returned by the target interface based on the interface test request can be directly compared with the expected test result, so that a test report is generated, the feedback result returned by the target interface is not required to be analyzed manually, the test report is not required to be written manually, and the generation efficiency and the accuracy of the test report are improved.
Further, determining the specific implementation process of the idle time period may include; acquiring resource consumption data of the target interface in a specified time period of a preset time period; carrying out statistical analysis on the preset time period, the specified time period and the resource consumption data to generate a corresponding resource consumption statistical table; respectively acquiring a first time period of which the resource consumption data of each day of the target interface in the preset time period is 0 based on the resource consumption statistical table; calculating intersections of all the first time periods to obtain corresponding second time periods; and taking the second time period as the idle time period. The preset time period and the specified time period are not particularly limited, and may be set according to actual requirements. For example, the predetermined time period may be a last week adjacent to the current time. The above specified period is a predetermined rough target interface working idle period, for example, may be 0:00-8:00. in addition, the specified time period can be divided according to each hour as a unit, and the specified time period is filled into the row table heads in the preset table template from small to large; dividing a preset time period according to a unit of each day, and filling the preset time period into list heads in the list template according to the sequence from small to large; and filling the resource consumption data corresponding to the row header and the list header into the cells of the table template in a one-to-one correspondence manner so as to generate the resource consumption statistical table. And the table template is not particularly limited, and may be, for example, an excel table containing no data. In addition, by performing the intersection processing on all the first time periods, the obtained second time period is the same time period in which the resource consumption data of each day of the target interface in the preset time period is 0, that is, the second time period of the target interface in any day of the preset time period is in an idle state, so that the second time period can be used as the idle time period. According to the method and the device for testing the target interface, the idle time period corresponding to the target interface can be generated after the historical resource consumption data of the target interface are subjected to statistical analysis, so that the subsequent test processing of the target interface in the idle time period can not influence other works of the target interface, the smoothness of the test process of the target interface test is ensured, and the test intelligence of the target interface is improved.
Further, in an embodiment of the present application, the use case generating request further carries second user information, and before the step S2, the method includes:
s200: performing living body detection on the user, and judging whether the detection passes or not;
s201: if the detection is passed, acquiring and displaying a plurality of pre-stored picture data, wherein the picture data comprises target picture data corresponding to the second user information;
s202: generating and displaying picture selection reminding information so that the user can select appointed picture data from the plurality of picture data;
s203: calculating a time taken for the user to select the specified picture data;
s204: judging whether the selected spending time is smaller than a preset spending time threshold value or not;
s205: if the selected time is less than the time threshold, judging whether the designated picture data belongs to the target picture data or not;
s206: if the specified picture data belong to the target picture data, judging whether the specified picture data are selected by the user in a voice mode;
s207: if the user selects the specified picture data in a voice mode, extracting a corresponding voiceprint feature vector from the selected voice based on the selected voice corresponding to the user;
S208: obtaining a prestored standard voiceprint feature vector;
s209: calculating the similarity of the voiceprint feature vector and the standard voiceprint feature vector;
s210: judging whether the similarity is larger than a preset similarity threshold value or not;
s211: if the similarity is larger than a preset similarity threshold, the user is judged to pass through identity verification, analysis processing is conducted on the use case generation request, and an extraction instruction of the interface information is extracted.
As described in steps S200 to S211, the use case generation request further carries second user information, and before the step of extracting the interface information, the method may specifically further include: performing living body detection on the user, and judging whether the detection passes or not; and if the detection is passed, acquiring and displaying a plurality of pre-stored picture data, wherein the picture data comprises target picture data corresponding to the second user information. In addition, the living body detection may be a detection operation of determining whether the user is a real living body, and the detailed process of performing the living body detection on the user may be: the user aims at the preset photo frame according to the guidance of the identity verification indication information to finish the combined actions of blinking, mouth opening, head shaking, head nodding and the like, and whether the user operates for a real living body can be verified by using the technologies of face key point positioning, face tracking and the like. Fraud by the user using masks, photos, etc. can be avoided by detecting the user in vivo. And then generating and displaying picture selection reminding information so that the user can select specified picture data from the plurality of picture data. After the user finishes selecting, calculating the time spent for selecting the designated picture data by the user, and judging whether the time spent for selecting is smaller than a preset time spent threshold. Wherein, the calculation process of the time spent for the selection can comprise: acquiring the display time for displaying the picture data; acquiring triggering time for receiving a selection instruction triggered by a user; calculation of The difference between the trigger time and the display time; taking the above difference as the above choice takes time. In addition, the above-mentioned preset time-consuming threshold is used to represent the time that it generally takes to correctly select the target picture data matching the target user from among the plurality of picture data, and the specific value may be set according to the empirical data. If the selected time is less than the time threshold, it is determined whether the specified picture data belongs to the target picture data. If the specified picture data belongs to the target picture data, judging whether the specified picture data is selected by the user through a voice mode. If the user selects the specified picture data by voice, a corresponding voiceprint feature vector is extracted from the selected voice based on the selected voice corresponding to the user. The corresponding voiceprint feature vector can be extracted from the selected voice based on the existing voiceprint extraction algorithm. And then obtaining a prestored standard voiceprint feature vector. And calculating the similarity between the voiceprint feature vector and the standard voiceprint feature vector. Wherein, the selection voice data corresponding to the appointed picture data and input by the target user corresponding to the second user information can be stored in advance, so that the selection voice data can be called to carry out identity authentication processing on the user. After the similarity is calculated, whether the similarity is larger than a preset similarity threshold value is judged. The similarity can be calculated by a preset distance calculation formula. The distance calculation formula may be:
Figure BDA0002785157150000181
a is the feature vector of the voiceprint to be detected, and b is the feature vector of the standard voiceprint. In addition, the above-mentioned similarity threshold is not particularly limited, and may be set according to actual requirements, for example, may be set to 0.9. If the similarity is larger than a preset similarity threshold, the user is judged to pass the authentication, the analysis processing is conducted on the use case generation request, and the extraction instruction of the interface information is extracted. Wherein if the similarity is not greater than the similarity threshold, limiting the use case generation requestAnd responding and returning error information, wherein the error information at least comprises information that the identity verification is not passed. The embodiment realizes accurate identity verification processing for the user by adopting multiple identity verification modes such as living body detection, time length verification for selecting picture data, picture accuracy verification, voiceprint verification and the like, ensures suitability, accuracy and reliability of the identity verification for the user, avoids adverse consequences caused by responding to a use case generation request input by an illegal user, and ensures safety in the request processing process.
Further, in an embodiment of the present application, before the step S3, the method includes:
S300: collecting a preset number of sample data, wherein the sample data comprises interface information samples and interface type results corresponding to the interface information samples;
s301: taking the interface information sample as input of a preset neural network model, taking an interface type result corresponding to the interface information sample as output of the neural network model, and training the neural network model based on a plurality of groups of interface information samples and interface type results corresponding to the interface information samples one by one to obtain a trained initial model;
s302: acquiring preset test data, verifying the initial model based on the test data, and judging whether the initial model passes the verification;
s303: if the verification is passed, the initial model is used as the analysis model;
s304: the analytical model is stored to a blockchain network.
As described in steps S300 to S304, the generation process of the analysis model is further included before the input of the interface information into the preset analysis model and the output of the analysis process of the target interface type corresponding to the interface information by the analysis model. Specifically, before the step of inputting the interface information into a preset analysis model and outputting, by the analysis model, the target interface type corresponding to the interface information, the method may further include: firstly, collecting a preset number of sample data, wherein the sample data comprises interface information samples and interface type results corresponding to the interface information samples. In addition, the preset number is not particularly limited, and may be set according to actual requirements. And then taking the interface information sample as input of a preset neural network model, taking an interface type result corresponding to the interface information sample as output of the neural network model, and training the neural network model based on a plurality of groups of interface information samples and interface type results corresponding to the interface information samples one by one to obtain a trained initial model. The model selection of the neural network model is not particularly limited, the embodiment can be realized by adopting Tensorflow, and the word embedding layer uses a mapping tool carried by Tensorflow to map each word into a vector form; the convolution layer carries out convolution operation on the input vector and carries out feature extraction; the pooling layer extracts the output vector of the convolution layer again to obtain the most important vector; the output layer performs classification calculation by using a softmax classifier, and calculates the probability that the input sentence at this time, namely the interface information respectively belongs to each category, and the category with the highest probability is the final classification category of the input sentence at this time (interface information). And acquiring preset test data, verifying the initial model based on the test data, and judging whether the initial model passes the verification. The data type of the test data is the same as the data form of the sample data, that is, the test data also includes a specified number of test interface information for performing accuracy verification of the model and a corresponding test interface type result, and the specified number is not specifically limited. If the verification is passed, the initial model is used as the analysis model, so that the analysis model can be directly used for accurately outputting the target interface type matched with the input interface information. And finally, after the analysis model is obtained, storing the analysis model into a blockchain network. By using the blockchain to store and manage the analysis model generated by training, the safety and the non-falsification of the analysis model can be effectively ensured.
Further, in an embodiment of the present application, before the step S7, the method includes:
s700: acquiring type information of each test case data, wherein the type information is used for representing the type of an interface applicable to the test case data;
s701: establishing a one-to-one association relation between each type of information and each test case data;
s702: based on the association relation, storing each test case data in a preset database, and generating the case database.
As described in steps S700 to S702, the process of generating the use case database may be further included before the process of obtaining the interface class test use case corresponding to the target interface type from the preset use case database. Specifically, if the target universal test case corresponding to the target interface type does not exist, the step of acquiring the interface type test case corresponding to the target interface type from a preset case database may further include: and obtaining type information of each test case data, wherein the type information is used for representing the type of an interface applicable to the test case data. In addition, each test case data is a test case which is compiled by a tester according to actual requirements in advance and can be correspondingly applicable to different types of interfaces. And then, establishing a one-to-one association relation between each type of information and each test case data. And finally, storing the test case data into a preset database based on the association relation to generate the case database. According to the embodiment, the test case data and the category information are stored in the case database in a one-to-one correspondence manner, so that the interface type test case matched with the target interface type can be quickly and conveniently queried from the case database according to the input target interface type, further, the target test case corresponding to the target interface can be quickly generated by carrying out corresponding modification processing on the interface test, and the generation rate of the target test case of the target interface is effectively improved.
The test case generation method in the embodiment of the application can also be applied to the field of blockchains, for example, the data such as the target test case is stored on the blockchain. By using the blockchain to store and manage the target test cases, the security and the non-falsifiability of the target test cases can be effectively ensured.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. The Blockchain (Blockchain), which is essentially a decentralised database, is a string of data blocks that are generated by cryptographic means in association, each data block containing a batch of information of network transactions for verifying the validity of the information (anti-counterfeiting) and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, an application services layer, and the like.
The blockchain underlying platform may include processing modules for user management, basic services, smart contracts, operation monitoring, and the like. The user management module is responsible for identity information management of all blockchain participants, including maintenance of public and private key generation (account management), key management, maintenance of corresponding relation between the real identity of the user and the blockchain address (authority management) and the like, and under the condition of authorization, supervision and audit of transaction conditions of certain real identities, and provision of rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node devices, is used for verifying the validity of a service request, recording the service request on a storage after the effective request is identified, for a new service request, the basic service firstly analyzes interface adaptation and authenticates the interface adaptation, encrypts service information (identification management) through an identification algorithm, and transmits the encrypted service information to a shared account book (network communication) in a complete and consistent manner, and records and stores the service information; the intelligent contract module is responsible for registering and issuing contracts, triggering contracts and executing contracts, a developer can define contract logic through a certain programming language, issue the contract logic to a blockchain (contract registering), invoke keys or other event triggering execution according to the logic of contract clauses to complete the contract logic, and simultaneously provide a function of registering contract upgrading; the operation monitoring module is mainly responsible for deployment in the product release process, modification of configuration, contract setting, cloud adaptation and visual output of real-time states in product operation, for example: alarms, monitoring network conditions, monitoring node device health status, etc.
Referring to fig. 2, in an embodiment of the present application, there is further provided a test case generating apparatus, including:
the first receiving module 1 is used for receiving a use case generation request input by a user, wherein the use case generation request carries interface information corresponding to a target interface;
the extraction module 2 is used for analyzing the use case generation request and extracting the interface information;
the analysis module 3 is used for inputting the interface information into a preset analysis model, and outputting a target interface type corresponding to the interface information through the analysis model;
the second receiving module 4 is used for receiving the target interface type returned by the analysis model;
the first judging module 5 is used for judging whether a target universal test case corresponding to the target interface type exists or not based on the target interface type;
the first determining module 6 is configured to obtain a target generic test case corresponding to the target interface type if there is the target generic test case corresponding to the target interface type, and take the target generic test case as a target test case for the target interface;
the first obtaining module 7 is configured to obtain, if there is no target universal test case corresponding to the target interface type, an interface class test case corresponding to the target interface type from a preset case database;
The second determining module 8 is configured to modify the interface class test case according to a preset rule, obtain a modified interface class test case, and use the modified interface class test case as a target test case corresponding to the target interface.
In this embodiment, the implementation process of the functions and roles of the first receiving module, the extracting module, the analyzing module, the second receiving module, the first judging module, the first determining module, the first obtaining module and the second determining module in the test case generating device is specifically detailed in the implementation process corresponding to steps S1 to S8 in the test case generating method, and will not be described herein.
Further, in an embodiment of the present application, the second determining module includes:
the extraction unit is used for analyzing the use case generation request and extracting the test data, wherein the test data comprises a test object and parameter data corresponding to the test object;
the first copying unit is used for copying the interface type test cases and generating test case copies identical to the interface type test cases;
the screening unit is used for screening out the specified test objects identical to the test objects from the test case copies;
The first acquisition unit is used for acquiring specified parameter data corresponding to the specified test object in the test case copy;
and the replacing unit is used for replacing the specified parameter data in the test case copy by using the parameter data to obtain a replaced test case copy, and taking the replaced test case copy as the target test case.
In this embodiment, the implementation processes of the functions and actions of the extracting unit, the first copying unit, the screening unit, the first obtaining unit and the replacing unit in the test case generating device are specifically described in the implementation processes corresponding to steps S800 to S804 in the test case generating method, and are not described herein.
Further, in an embodiment of the present application, the second determining module includes:
the second acquisition unit is used for acquiring a preset editable document template;
the second copying unit is used for copying the interface type test cases into the editable document template to obtain corresponding case documents;
the judging unit is used for judging whether the user has the authority of the modification case or not;
the display unit is used for displaying the use case document on the current page if the user has the right to modify the use case;
And the receiving unit is used for receiving the modification processing of the interface class test case in the case document by the user, obtaining a modified case document, and taking the case text data as the target test case.
In this embodiment, the implementation process of the functions and actions of the second obtaining unit, the second copying unit, the judging unit, the displaying unit and the receiving unit in the test case generating device is specifically described in the implementation process corresponding to steps S810 to S814 in the test case generating method, and will not be described herein.
Further, in an embodiment of the present application, the determining unit includes:
the extraction subunit is used for analyzing the use case generation request and extracting the first user information;
a calling subunit, configured to call a preset classification tree model;
the determining subunit is used for determining the user role category corresponding to the first user information through the classification tree model and determining the designated authority level corresponding to the category of the first user information based on the corresponding relation between the preset category and the authority level;
the obtaining subunit is used for obtaining the modification authority level corresponding to the service operation of the modification use case based on a preset service operation authority table;
A judging subunit, configured to judge whether the specified level authority is less than the modification authority level;
a first judging subunit, configured to judge that the user does not have the authority of the modification use case if the specified level of authority is less than the modification authority level;
and the second judging subunit is used for judging that the user has the authority of the modification use case if the authority of the appointed level is not less than the modification authority level.
In this embodiment, the implementation process of the functions and roles of the extracting subunit, the calling subunit, the determining subunit, the obtaining subunit, the judging subunit, the first judging subunit and the second judging subunit in the test case generating device is specifically described in the implementation process corresponding to steps S8120 to S8126 in the test case generating method, and will not be described herein.
Further, in an embodiment of the present application, the test case generating device includes:
the second acquisition module is used for acquiring interface communication parameters corresponding to the target interface and acquiring an interface address of the target interface;
the first generation module is used for generating a corresponding interface test request according to the interface communication parameters and the target test case;
The second judging module is used for acquiring the current time and judging whether the current time is in a preset idle time period or not, wherein the idle time period is generated after statistical analysis is performed on historical resource consumption data of the target interface;
the test module is used for sending the interface test request to the interface address if the current time is in the idle time period, so that the target interface immediately analyzes the interface test request to obtain an input parameter in the interface test request after receiving the interface test request, and processes the input parameter to generate a corresponding test result;
the third receiving module is used for receiving the test result returned by the target interface;
and the second generation module is used for comparing the test result with a preset expected test result to generate a corresponding test report.
In this embodiment, the implementation process of the functions and roles of the second acquisition module, the first generation module, the second judgment module, the test module, the third receiving module and the second generation module in the test case generation device is specifically described in the implementation process corresponding to steps S820 to S825 in the test case generation method, and will not be described herein.
Further, in an embodiment of the present application, the test case generating device includes:
the system comprises an acquisition module, a sampling module and a sampling module, wherein the acquisition module is used for acquiring a preset number of sample data, wherein the sample data comprises interface information samples and interface type results corresponding to the interface information samples;
the training module is used for taking the interface information samples as input of a preset neural network model, taking interface type results corresponding to the interface information samples as output of the neural network model, and training the neural network model based on a plurality of groups of the interface information samples and interface type results corresponding to the interface information samples one by one to obtain a trained initial model;
the verification module is used for acquiring preset test data, verifying the initial model based on the test data and judging whether the initial model passes the verification;
the third determining module is used for taking the initial model as the analysis model if the verification is passed;
and the storage module is used for storing the analysis model to a blockchain network.
In this embodiment, the implementation process of the functions and actions of the acquisition module, the training module, the verification module, the third determination module and the storage module in the test case generating device is specifically described in the implementation process corresponding to steps S300 to S304 in the test case generating method, and will not be described herein.
Further, in an embodiment of the present application, the test case generating device includes:
the third acquisition module is used for acquiring type information of each test case data, wherein the type information is used for representing the type of an interface applicable to the test case data;
the establishing module is used for establishing a one-to-one association relation between each type information and each test case data;
and the third generation module is used for storing the test case data into a preset database based on the association relation to generate the case database.
In this embodiment, the implementation process of the functions and actions of the third obtaining module, the establishing module and the third generating module in the test case generating device is specifically described in the implementation process corresponding to steps S700 to S702 in the test case generating method, and will not be described herein.
Referring to fig. 3, a computer device is further provided in the embodiment of the present application, where the computer device may be a server, and the internal structure of the computer device may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, a display screen, an input device, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a storage medium, an internal memory. The storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the storage media. The database of the computer device is used for storing the case generation request, interface information, analysis model, target interface type and target test case. The network interface of the computer device is used for communicating with an external terminal through a network connection. The display screen of the computer equipment is an indispensable image-text output equipment in the computer and is used for converting digital signals into optical signals so that characters and graphics can be displayed on the screen of the display screen. The input device of the computer equipment is a main device for exchanging information between the computer and a user or other equipment, and is used for conveying data, instructions, certain sign information and the like into the computer. The computer program, when executed by a processor, implements a test case generation method.
Executing the steps of the test case generation method by the processor:
receiving a use case generation request input by a user, wherein the use case generation request carries interface information corresponding to a target interface;
analyzing the use case generation request and extracting the interface information;
inputting the interface information into a preset analysis model, and outputting a target interface type corresponding to the interface information through the analysis model;
receiving the target interface type returned by the analysis model;
judging whether a target universal test case corresponding to the target interface type exists or not based on the target interface type;
if the target universal test case corresponding to the target interface type exists, acquiring the target universal test case corresponding to the target interface type, and taking the target universal test case as the target test case of the target interface;
if the target universal test case corresponding to the target interface type does not exist, acquiring an interface type test case corresponding to the target interface type from a preset case database;
and modifying the interface test cases according to preset rules to obtain modified interface test cases, and taking the modified interface test cases as target test cases corresponding to the target interfaces.
Those skilled in the art will appreciate that the structures shown in fig. 3 are only block diagrams of portions of structures that may be associated with the aspects of the present application and are not intended to limit the scope of the apparatus, or computer devices on which the aspects of the present application may be implemented.
An embodiment of the present application further provides a computer readable storage medium, on which a computer program is stored, where the computer program when executed by a processor implements a test case generating method, specifically:
receiving a use case generation request input by a user, wherein the use case generation request carries interface information corresponding to a target interface;
analyzing the use case generation request and extracting the interface information;
inputting the interface information into a preset analysis model, and outputting a target interface type corresponding to the interface information through the analysis model;
receiving the target interface type returned by the analysis model;
judging whether a target universal test case corresponding to the target interface type exists or not based on the target interface type;
if the target universal test case corresponding to the target interface type exists, acquiring the target universal test case corresponding to the target interface type, and taking the target universal test case as the target test case of the target interface;
If the target universal test case corresponding to the target interface type does not exist, acquiring an interface type test case corresponding to the target interface type from a preset case database;
and modifying the interface test cases according to preset rules to obtain modified interface test cases, and taking the modified interface test cases as target test cases corresponding to the target interfaces.
In summary, in the test case generating method, device, computer equipment and storage medium provided in the embodiments of the present application, the corresponding target interface type is obtained by inputting the interface information in the received case generating request into the preset classification model, and when the target general test case corresponding to the target interface type exists, the target general test case is directly used as the target test case of the target interface. Meanwhile, under the condition that the target general test case does not exist, the interface type test case corresponding to the target interface type is intelligently modified to generate the target general test case corresponding to the target interface. According to the method and the device for generating the target test cases, the target test cases corresponding to the target interfaces can be generated rapidly and intelligently, test personnel are not required to rewrite the test cases, the generation efficiency of the target test cases is improved, the data accuracy in the target test cases is ensured, and the generation difficulty of the target test cases is also reduced.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by hardware associated with a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (8)

1. A test case generation method, comprising:
receiving a use case generation request input by a user, wherein the use case generation request carries interface information corresponding to a target interface;
Analyzing the use case generation request and extracting the interface information;
inputting the interface information into a preset analysis model, and outputting a target interface type corresponding to the interface information through the analysis model;
receiving the target interface type returned by the analysis model;
judging whether a target universal test case corresponding to the target interface type exists or not based on the target interface type;
if the target universal test case corresponding to the target interface type exists, acquiring the target universal test case corresponding to the target interface type, and taking the target universal test case as the target test case of the target interface;
if the target universal test case corresponding to the target interface type does not exist, acquiring an interface type test case corresponding to the target interface type from a preset case database;
modifying the interface class test cases according to preset rules to obtain modified interface class test cases, and taking the modified interface class test cases as target test cases corresponding to the target interfaces;
the case generation request further carries test data, the interface test case is modified according to a preset rule to obtain a modified interface test case, and the step of using the modified interface test case as a target test case of the target interface includes:
Analyzing the use case generation request, and extracting the test data, wherein the test data comprises a test object and parameter data corresponding to the test object;
copying the interface test cases to generate test case copies identical to the interface test cases;
screening out the specified test objects identical to the test objects from the test case copies;
acquiring specified parameter data corresponding to the specified test object in the test case copy;
performing replacement processing on the specified parameter data in the test case copy by using the parameter data to obtain a replaced test case copy, and taking the replaced test case copy as the target test case;
before the step of inputting the interface information into a preset analysis model and outputting the target interface type corresponding to the interface information through the analysis model, the method comprises the following steps:
collecting a preset number of sample data, wherein the sample data comprises interface information samples and interface type results corresponding to the interface information samples;
taking the interface information sample as input of a preset neural network model, taking an interface type result corresponding to the interface information sample as output of the neural network model, and training the neural network model based on a plurality of groups of interface information samples and interface type results corresponding to the interface information samples one by one to obtain a trained initial model;
Acquiring preset test data, verifying the initial model based on the test data, and judging whether the initial model passes the verification;
if the verification is passed, the initial model is used as the analysis model;
the analytical model is stored to a blockchain network.
2. The method for generating test cases according to claim 1, wherein the step of modifying the interface class test cases according to a preset rule to obtain modified interface class test cases, and using the modified interface class test cases as target test cases for the target interfaces includes:
acquiring a preset editable document template;
copying the interface test cases into the editable document template to obtain corresponding case documents;
judging whether the user has the authority of modifying the use case or not;
if the user has the authority of modifying the use case, displaying the use case document on the current page;
and receiving modification processing of the interface class test case in the case document by the user, obtaining a modified case document, and taking case text data in the case document as the target test case.
3. The method for generating test cases according to claim 2, wherein the case generation request further carries first user information, and the step of determining whether the user has the right to modify the case comprises:
analyzing the use case generation request and extracting the first user information;
calling a preset classification tree model;
determining a user role category corresponding to the first user information through the classification tree model, and determining a designated authority level corresponding to the category of the first user information based on a corresponding relation between a preset category and the authority level;
acquiring a modification authority level corresponding to the service operation of the modification use case based on a preset service operation authority table;
judging whether the appointed authority level is smaller than the modification authority level;
if the appointed authority level is smaller than the modification authority level, judging that the user does not have the authority of the modification use case;
and if the designated authority level is not smaller than the modification authority level, judging that the user has the authority of modifying the use case.
4. The method for generating test cases according to claim 1, wherein after the step of modifying the interface class test cases according to the preset rule to obtain modified interface class test cases and using the modified interface class test cases as target test cases corresponding to the target interfaces, the method comprises:
Acquiring interface communication parameters corresponding to the target interface and acquiring an interface address of the target interface;
generating a corresponding interface test request according to the interface communication parameters and the target test case;
acquiring current time, and judging whether the current time is in a preset idle time period, wherein the idle time period is generated after statistical analysis is performed on historical resource consumption data of the target interface;
if the current time is within the idle time period, the interface test request is sent to the interface address, so that the target interface immediately analyzes the interface test request after receiving the interface test request to obtain an input parameter in the interface test request, and processes the input parameter to generate a corresponding test result;
receiving the test result returned by the target interface;
and comparing the test result with a preset expected test result to generate a corresponding test report.
5. The test case generating method according to claim 1, wherein, before the step of acquiring the interface class test case corresponding to the target interface type from the preset case database if the target generic test case corresponding to the target interface type does not exist, the method comprises:
Acquiring type information of each test case data, wherein the type information is used for representing the type of an interface applicable to the test case data;
establishing a one-to-one association relation between each type of information and each test case data;
based on the association relation, storing each test case data in a preset database, and generating the case database.
6. A test case generating device for implementing the method of any one of claims 1 to 5, comprising:
the first receiving module is used for receiving a use case generation request input by a user, wherein the use case generation request carries interface information corresponding to a target interface;
the extraction module is used for analyzing the use case generation request and extracting the interface information;
the analysis module is used for inputting the interface information into a preset analysis model, and outputting a target interface type corresponding to the interface information through the analysis model;
the second receiving module is used for receiving the target interface type returned by the analysis model;
the first judging module is used for judging whether a target universal test case corresponding to the target interface type exists or not based on the target interface type;
The first determining module is used for acquiring a target general test case corresponding to the target interface type if the target general test case corresponding to the target interface type exists, and taking the target general test case as the target test case of the target interface;
the first acquisition module is used for acquiring the interface class test cases corresponding to the target interface types from a preset case database if the target general test cases corresponding to the target interface types do not exist;
and the second determining module is used for modifying the interface class test cases according to preset rules to obtain modified interface class test cases, and taking the modified interface class test cases as target test cases corresponding to the target interfaces.
7. A computer device comprising a memory and a processor, the memory having stored therein a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 5.
8. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
CN202011295103.7A 2020-11-18 2020-11-18 Test case generation method, device, computer equipment and storage medium Active CN112527630B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011295103.7A CN112527630B (en) 2020-11-18 2020-11-18 Test case generation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011295103.7A CN112527630B (en) 2020-11-18 2020-11-18 Test case generation method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112527630A CN112527630A (en) 2021-03-19
CN112527630B true CN112527630B (en) 2023-07-07

Family

ID=74981226

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011295103.7A Active CN112527630B (en) 2020-11-18 2020-11-18 Test case generation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112527630B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220563B (en) * 2021-04-12 2023-11-17 成都安易迅科技有限公司 Test case generation method, system, storage medium and computer equipment
CN113282513B (en) * 2021-06-28 2022-11-29 平安消费金融有限公司 Interface test case generation method and device, computer equipment and storage medium
CN113656324B (en) * 2021-08-31 2023-08-22 中国平安人寿保险股份有限公司 Full-link test method, device, equipment and medium for disease input and decision
CN113779128B (en) * 2021-09-09 2024-04-05 平安科技(深圳)有限公司 Medical data system docking method, device, equipment and storage medium
CN115047836A (en) * 2022-06-27 2022-09-13 中国核动力研究设计院 Test case generation and loading method and system based on DCS system periodic test
CN116192922B (en) * 2023-04-23 2023-08-11 成都华兴汇明科技有限公司 Issuing management method, device and system for test cases
CN117033253A (en) * 2023-10-10 2023-11-10 北京轻松怡康信息技术有限公司 Interface testing method and device, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1890235A1 (en) * 2006-08-02 2008-02-20 Microsoft Corporation Test case management
WO2018010552A1 (en) * 2016-07-12 2018-01-18 博彦科技股份有限公司 Test method and device
CN107766190A (en) * 2017-10-31 2018-03-06 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN109446068A (en) * 2018-09-26 2019-03-08 平安健康保险股份有限公司 Interface test method, device, computer equipment and storage medium
CN110750442A (en) * 2019-09-06 2020-02-04 平安医疗健康管理股份有限公司 Test case generation method, device, equipment and storage medium
CN111459812A (en) * 2020-03-30 2020-07-28 招商局金融科技有限公司 Interface test case generation method, electronic device and storage medium
CN111522741A (en) * 2020-04-14 2020-08-11 北京奇艺世纪科技有限公司 Interface test code generation method and device, electronic equipment and readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040205406A1 (en) * 2000-05-12 2004-10-14 Marappa Kaliappan Automatic test system for testing remote target applications on a communication network

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1890235A1 (en) * 2006-08-02 2008-02-20 Microsoft Corporation Test case management
WO2018010552A1 (en) * 2016-07-12 2018-01-18 博彦科技股份有限公司 Test method and device
CN107766190A (en) * 2017-10-31 2018-03-06 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN109446068A (en) * 2018-09-26 2019-03-08 平安健康保险股份有限公司 Interface test method, device, computer equipment and storage medium
CN110750442A (en) * 2019-09-06 2020-02-04 平安医疗健康管理股份有限公司 Test case generation method, device, equipment and storage medium
CN111459812A (en) * 2020-03-30 2020-07-28 招商局金融科技有限公司 Interface test case generation method, electronic device and storage medium
CN111522741A (en) * 2020-04-14 2020-08-11 北京奇艺世纪科技有限公司 Interface test code generation method and device, electronic equipment and readable storage medium

Also Published As

Publication number Publication date
CN112527630A (en) 2021-03-19

Similar Documents

Publication Publication Date Title
CN112527630B (en) Test case generation method, device, computer equipment and storage medium
CN111506722B (en) Knowledge graph question-answering method, device and equipment based on deep learning technology
CN112347310B (en) Query method, device, computer equipment and storage medium of event processing information
CN109858737B (en) Grading model adjustment method and device based on model deployment and computer equipment
CN109783785B (en) Method and device for generating experiment detection report and computer equipment
CN112329865B (en) Data anomaly identification method and device based on self-encoder and computer equipment
CN113642039B (en) Configuration method and device of document template, computer equipment and storage medium
CN112464117A (en) Request processing method and device, computer equipment and storage medium
CN113434310B (en) Multithreading task allocation method, device, equipment and storage medium
CN113468520A (en) Data intrusion detection method applied to block chain service and big data server
CN112463599A (en) Automatic testing method and device, computer equipment and storage medium
CN111784301A (en) User portrait construction method and device, storage medium and electronic equipment
CN114978968B (en) Micro-service abnormality detection method, micro-service abnormality detection device, computer device and storage medium
CN113327037A (en) Model-based risk identification method and device, computer equipment and storage medium
CN112184003A (en) Bank counter workload assessment method and device, storage medium and electronic equipment
CN113656588B (en) Knowledge graph-based data code matching method, device, equipment and storage medium
CN114817055A (en) Regression testing method and device based on interface, computer equipment and storage medium
CN113435990B (en) Certificate generation method and device based on rule engine and computer equipment
CN113986581A (en) Data aggregation processing method and device, computer equipment and storage medium
CN110569340A (en) Text information verification method and device, computer equipment and storage medium
CN112650659B (en) Buried point setting method and device, computer equipment and storage medium
CN109492095A (en) Claims Resolution data processing method, device, computer equipment and storage medium
CN116453125A (en) Data input method, device, equipment and storage medium based on artificial intelligence
CN115757075A (en) Task abnormity detection method and device, computer equipment and storage medium
CN114036117A (en) Log viewing method and device, computer equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant