CN116841913A - Test case generation method and device, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN116841913A
CN116841913A CN202311111966.8A CN202311111966A CN116841913A CN 116841913 A CN116841913 A CN 116841913A CN 202311111966 A CN202311111966 A CN 202311111966A CN 116841913 A CN116841913 A CN 116841913A
Authority
CN
China
Prior art keywords
test case
target
information
confidence
determining
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.)
Granted
Application number
CN202311111966.8A
Other languages
Chinese (zh)
Other versions
CN116841913B (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.)
Meiyun Zhishu Technology Co ltd
Original Assignee
Meiyun Zhishu Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Meiyun Zhishu Technology Co ltd filed Critical Meiyun Zhishu Technology Co ltd
Priority to CN202311111966.8A priority Critical patent/CN116841913B/en
Publication of CN116841913A publication Critical patent/CN116841913A/en
Application granted granted Critical
Publication of CN116841913B publication Critical patent/CN116841913B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/219Managing data history or versioning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the technical field of software testing, and provides a test case generation method, a test case generation device, electronic equipment and a storage medium. The method comprises the following steps: determining that at least one historical test case is queried from the test case set based on the request information, and determining a target reference test case from the at least one historical test case; determining the target confidence coefficient of the target test case based on the target difference degree calculation result of the target reference test case and the target test case; determining that at least one test case with the confidence coefficient identical to the target confidence coefficient does not exist in the historical test cases, and adding the target test case into the test case set; determining that historical test cases are not queried from the test case set based on the request information, adding the target test case to the test case set, setting the target test case as a reference test case corresponding to the request information, and setting the confidence of the target test case as a reference confidence. The invention can improve the case deduplication efficiency and the test case generation efficiency.

Description

Test case generation method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of software testing technologies, and in particular, to a method and apparatus for generating a test case, an electronic device, and a storage medium.
Background
With the rapid development of computer technology, more and more software systems are being created. In the development of software systems, it is necessary to perform automated testing of the software systems. In the automatic test, a tester needs to input a lot of manpower to design test cases according to a required document, a design scheme and the like, however, the labor cost is wasted, and the tester is too dependent on experience, so that on-line scenes cannot be completely simulated, and the test missing and the like occur, so that software test is not complete, and the reliability of a tested system is reduced, and therefore, the test cases need to be automatically generated to solve the problems.
Currently, a plurality of test cases are automatically generated based on relevant parameter information of request information. However, duplicate test cases may occur among the automatically generated plurality of test cases, resulting in duplicate tests; although the deduplication processing can be performed on the plurality of test cases, the similarity between every two of the plurality of test cases needs to be calculated, the calculated amount is large, the deduplication efficiency is low, and the generation efficiency of the test cases is finally reduced.
Disclosure of Invention
The present invention aims to solve at least one of the technical problems existing in the prior art. Therefore, the invention provides a test case generation method, which only needs to calculate the difference degree calculation result of the target reference test case and the target test case in the case deduplication mode, thereby reducing the calculation amount, further improving the case deduplication efficiency and finally improving the generation efficiency of the test case.
The invention also provides a test case generating device.
The invention further provides electronic equipment.
The invention also proposes a non-transitory computer readable storage medium.
The test case generation method according to the embodiment of the first aspect of the invention comprises the following steps:
generating a target test case based on the request information and response information corresponding to the request information;
determining that at least one historical test case is queried from a test case set based on the request information, and determining a target reference test case from the at least one historical test case;
determining target confidence of the target test case based on a target difference calculation result of the target reference test case and the target test case;
determining that no test case with the confidence identical to the target confidence exists in the at least one historical test case, and adding the target test case to the test case set;
Determining that no historical test cases are queried from a test case set based on the request information, adding the target test case to the test case set, setting the target test case as a reference test case corresponding to the request information, and setting the confidence of the target test case as a reference confidence.
According to the test case generation method provided by the embodiment of the invention, the target test case is automatically generated based on the request information and the corresponding response information, so that the labor cost is reduced, the generation accuracy of the target test case is improved, and the comprehensiveness of the test is improved; if it is determined that at least one historical test case is queried from the test case set based on the request information, determining a target reference test case from the at least one historical test case, determining a target confidence coefficient of the target test case based on a target difference degree calculation result of the target reference test case and the target test case, if it is determined that no test case with the same confidence degree as the target confidence degree exists in the at least one historical test case, adding the target test case to the test case set for subsequent system test based on the added target test case, and correspondingly, if it is determined that a test case with the same confidence degree as the target confidence degree exists in the at least one historical test case, not performing any processing, namely, the same confidence degree indicates that the similarity of the two test cases is high, and further, adding the repeated target test case which is automatically generated for the later to the test case set, and finally realizing the de-duplication of the test case, and the de-duplication mode only needs to calculate the difference degree calculation result of the target reference test case and the target test case, thereby reducing the calculation amount, further improving the de-duplication efficiency and finally improving the generation efficiency of the test case; if it is determined that no historical test case is queried from the test case set based on the request information, adding the target test case to the test case set, namely, directly adding the target test case to the test case set when no historical test case corresponding to the request information exists, and not calculating a difference degree calculation result, so that the calculation amount is reduced, the deduplication efficiency is further improved, the generation efficiency of the test case is further improved finally, the target test case is set as a reference test case corresponding to the request information, and the confidence of the target test case is set as a reference confidence for executing the deduplication processing when a new test case is generated later.
According to an embodiment of the present invention, the determining the target confidence of the target test case based on the target difference calculation result between the target reference test case and the target test case includes:
determining the target confidence coefficient of the target test case based on the ratio of the target difference degree calculation result to the maximum difference degree calculation result corresponding to the target reference test case;
the maximum difference degree calculation result is a difference degree calculation result of the target reference test case and a first test case, the first test case is a test case with the maximum difference degree with the target reference test case, and the larger the target difference degree calculation result is, the larger the difference degree between the target reference test case and the target test case is.
According to one embodiment of the invention, the maximum variance calculation is determined based on the following steps:
acquiring first request body information corresponding to the target reference test case;
extracting the first request body information to obtain a first N-dimensional array;
respectively calculating the maximum sub-difference degree calculation result of each data and 0 in the first N-dimensional array;
And determining the maximum difference degree calculation result based on the first aggregation result of the N maximum sub-difference degree calculation results.
According to one embodiment of the invention, the target variance calculation result is determined based on the following steps:
acquiring first request body information corresponding to the target reference test case and second request body information in the request information;
extracting the first request body information to obtain a first N-dimensional array, and extracting the second request body information to obtain a second N-dimensional array, wherein N represents the field number of the first request body information, and any data in the first N-dimensional array is used for representing any field information in the first request body information;
calculating N difference degree calculation results of the first N-dimensional array and the second N-dimensional array, wherein any difference degree calculation result in the N difference degree calculation results is a difference degree calculation result of first data in the first N-dimensional array and second data corresponding to the first data in the second N-dimensional array;
and determining the target difference degree calculation result based on a second aggregation result of the N difference degree calculation results.
According to one embodiment of the present invention, the determining the target difference degree calculation result based on the second aggregation result of the N difference degree calculation results includes:
Based on the weight value of each field information, carrying out weighted aggregation treatment on the N difference degree calculation results to obtain a second aggregation result;
and determining the target difference degree calculation result based on the second polymerization result.
According to one embodiment of the present invention, the generating a target test case based on the request information and the response information corresponding to the request information includes:
receiving network traffic sent by a requester device, and sending the network traffic to an on-line system which is the same as a system to be tested, so that the on-line system generates response information based on the network traffic, wherein the network traffic comprises request information;
receiving the response information sent by the online system;
and generating a target test case based on the request information and the response information.
According to one embodiment of the present invention, the generating the target test case based on the request information and the response information includes:
and sending the response information to the requester equipment, and generating a target test case asynchronously based on the request information and the response information.
According to one embodiment of the present invention, further comprising:
cloning the environment information of the online system to the system to be tested so that the environment of the online system is the same as that of the system to be tested;
And each test case in the test case set is used for testing the system to be tested.
According to one embodiment of the present invention, the determining of querying at least one historical test case from a set of test cases based on the request information includes:
inquiring at least one historical test case from the test case set based on the unique identification information in the request information;
wherein the unique identification information includes a uniform resource locator URL, a request path, and a request method.
According to an embodiment of the second aspect of the present invention, a test case generating device includes:
the case generation module is used for generating a target test case based on the request information and response information corresponding to the request information;
the case query module is used for determining that at least one historical test case is queried from the test case set based on the request information, and determining a target reference test case from the at least one historical test case;
the confidence coefficient determining module is used for determining the target confidence coefficient of the target test case based on the target difference coefficient calculation result of the target reference test case and the target test case;
the first case adding module is used for determining that no test case with the confidence identical to the target confidence exists in the at least one historical test case, and adding the target test case to the test case set;
The second case adding module is used for determining that no historical test case is queried from the test case set based on the request information, adding the target test case to the test case set, setting the target test case as a reference test case corresponding to the request information, and setting the confidence of the target test case as a reference confidence.
An electronic device according to an embodiment of the third aspect of the present invention includes a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the test case generating method as any one of the above when executing the program.
A non-transitory computer readable storage medium according to an embodiment of the fourth aspect of the present invention has stored thereon a computer program which, when executed by a processor, implements a test case generating method as described in any of the above.
The above technical solutions in the embodiments of the present invention have at least one of the following technical effects:
based on the request information and the corresponding response information, automatically generating a target test case, thereby reducing labor cost, improving the generation accuracy of the target test case and improving the comprehensiveness of the test; if it is determined that at least one historical test case is queried from the test case set based on the request information, determining a target reference test case from the at least one historical test case, determining a target confidence coefficient of the target test case based on a target difference degree calculation result of the target reference test case and the target test case, if it is determined that no test case with the same confidence degree as the target confidence degree exists in the at least one historical test case, adding the target test case to the test case set for subsequent system test based on the added target test case, and correspondingly, if it is determined that a test case with the same confidence degree as the target confidence degree exists in the at least one historical test case, not performing any processing, namely, the same confidence degree indicates that the similarity of the two test cases is high, and further, adding the repeated target test case which is automatically generated for the later to the test case set, and finally realizing the de-duplication of the test case, and the de-duplication mode only needs to calculate the difference degree calculation result of the target reference test case and the target test case, thereby reducing the calculation amount, further improving the de-duplication efficiency and finally improving the generation efficiency of the test case; if it is determined that no historical test case is queried from the test case set based on the request information, adding the target test case to the test case set, namely, directly adding the target test case to the test case set when no historical test case corresponding to the request information exists, and not calculating a difference degree calculation result, so that the calculation amount is reduced, the deduplication efficiency is further improved, the generation efficiency of the test case is further improved finally, the target test case is set as a reference test case corresponding to the request information, and the confidence of the target test case is set as a reference confidence for executing the deduplication processing when a new test case is generated later.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a test case generating method according to an embodiment of the present invention;
FIG. 2 is a second flowchart of a test case generating method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a test case generating device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the embodiments of the present application. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
With the rapid development of computer technology, more and more software systems are being created. In the development of software systems, it is necessary to perform automated testing of the software systems. In the automatic test, for example, in an interface automatic test scene, a tester needs to input a lot of manpower according to a required document, a design scheme and the like, however, the tester needs to input a lot of manpower, the labor cost is wasted, and the experience of the tester is excessively depended, so that the situation of missing test and the like cannot be completely simulated, and the software test is not comprehensive, so that the reliability of a tested system is reduced, and therefore, the test case needs to be automatically generated, so that the problems are solved.
Currently, a plurality of test cases are automatically generated based on relevant parameter information of request information. However, duplicate test cases may occur among the automatically generated plurality of test cases, resulting in duplicate tests; although the deduplication processing can be performed on the multiple test cases, the similarity between every two of the multiple test cases needs to be calculated, for example, M test cases need to be calculated to obtain M (M-1)/2 similarities, the calculated amount is large, the deduplication efficiency is low, the generation efficiency of the test case set after final deduplication is affected, and the generation efficiency of the test cases is reduced finally.
Based on the above problems, the present invention proposes the following embodiments. Embodiments of the present invention are described in further detail below with reference to the accompanying drawings and examples. The following examples are illustrative of the invention but are not intended to limit the scope of the invention.
Fig. 1 is one of the flow diagrams of the test case generating method according to the embodiment of the present invention, and as shown in fig. 1, the test case generating method includes steps 110 to 150.
The execution subject of the test case generating method provided by the embodiment of the invention may be a test device, where the test device may include, but is not limited to: desktop computers, notebook computers, servers, intelligent terminal devices, and the like.
Step 110, generating a target test case based on the request information and response information corresponding to the request information.
Here, the request information is related information corresponding to a request sent by the requester device. In one embodiment, the request information may include, but is not limited to, at least one of: URL (Uniform Resource Locator ), request method (e.g., get, post, put, delete), request path, protocol version, header (Headers), body of request, etc.
Here, the response information is information that the responder device responds to generated based on the request information. In one embodiment, the response information may include, but is not limited to, at least one of: status lines, message Headers (Headers), body of responses (body), etc.
Here, the target test case may be used to perform regression testing on the system under test. It will be appreciated that the target test case may have a corresponding duplicate test case, and thus, it is desirable to implement case deduplication.
In a specific embodiment, analyzing the response information to obtain assertion information related to the test case; and generating a target test case based on the request information, response information corresponding to the request information and the assertion information. Illustratively, the protocol, message body and assertion information associated with the interface are automatically generated based on the request information and the response information corresponding to the request information.
Step 120, determining that at least one historical test case is queried from the test case set based on the request information, and determining a target reference test case from the at least one historical test case.
The test case set comprises at least one test case, and the test case set is used for storing the test cases.
Before the step 120, the test case set is queried based on the request information, so as to query at least one historical test case corresponding to the request information. It can be understood that at least one history test case is a test case related to the request information, that is, not all history test cases are test cases related to the request information, so that the deduplication of the related test cases is realized.
In one embodiment, the test case set is queried based on the unique identification information in the request information to query at least one historical test case corresponding to the unique identification information. It can be understood that at least one historical test case is a test case related to the unique identification information, that is, not all the historical test cases are test cases related to the unique identification information, so that the deduplication of the related test cases is realized. The unique identification information includes a URL, a request path, and a request method.
Here, the target reference test case is used for performing a degree of difference calculation with the automatically generated target test case. The target reference test case is fixed in at least one historical test case corresponding to one request message, namely, only the request message is changed greatly, the target reference test case is changed; in other words, the target reference test case is the reference test case corresponding to the request information.
It can be appreciated that the target reference test case is a test case automatically generated when no historical test case is queried from the test case set based on the request information; the target reference test case is the first test case added to the test case set in at least one historical test case, and is the test case corresponding to the request information. For example, if the test case set is characterized by a database, the target reference test case is the first test case in storage and is the test case corresponding to the request information.
In a specific embodiment, based on the reference confidence, a target reference test case corresponding to the reference confidence is determined from the at least one historical test case, that is, the confidence of the target reference test case is the reference confidence.
And 130, determining the target confidence of the target test case based on the target difference degree calculation result of the target reference test case and the target test case.
Here, the target confidence is used to characterize the degree of difference of the target test case from the target reference test case. The degree of difference may be greater as the target confidence is higher, or may be smaller as the target confidence is higher.
Specifically, the target difference degree calculation result may be directly determined as the target confidence degree, or further data processing may be performed on the target difference degree calculation result to obtain the target confidence degree.
In an embodiment, the target difference calculation result may be normalized to obtain a target confidence coefficient, so as to more accurately represent the difference degree between the target test case and the target reference test case, and further more accurately implement the de-duplication of the case.
In an embodiment, the target difference calculation result may be rounded to obtain a target confidence coefficient, so as to more accurately represent the difference degree between the target test case and the target reference test case, and further more accurately implement the de-duplication of the case.
In some embodiments, the target variance calculation is determined based on the following steps: acquiring first request body information corresponding to a target reference test case and second request body information in the request information; and determining a target difference degree calculation result based on the difference degree calculation result of the first request body information and the second request body information. For example, the first and second requester information are bodies.
In an embodiment, the difference calculation result of the first request body information and the second request body information is directly determined as the target difference calculation result. In another embodiment, the difference degree calculation result of the first request body information and the second request body information is further processed to obtain a target difference degree calculation result.
In an embodiment, extracting first request body information to obtain a first N-dimensional array, extracting second request body information to obtain a second N-dimensional array, and calculating N difference calculation results of the first N-dimensional array and the second N-dimensional array, wherein any difference calculation result in the N difference calculation results is a difference calculation result of first data in the first N-dimensional array and second data corresponding to the first data in the second N-dimensional array; and determining a difference degree calculation result of the first request body information and the second request body information based on a second aggregation result of the N difference degree calculation results. More specifically, the second aggregation result may be directly determined as a difference degree calculation result of the first request body information and the second request body information, or the second aggregation result may be further processed to obtain a difference degree calculation result of the first request body information and the second request body information.
Step 140, determining that no test case with the confidence identical to the target confidence exists in the at least one historical test case, and adding the target test case to the test case set.
It can be understood that each historical test case in at least one historical test case has a corresponding confidence coefficient, and the calculation mode of the confidence coefficient is basically the same as that of the target confidence coefficient, which is not described in detail herein.
For example, the test case set is a database, and then the target test case is inserted into the database. Further, the confidence is a unique key, so that test cases with the same confidence cannot be repeatedly put in storage, and further, duplicate removal of the cases is achieved.
Further, it is determined that a test case with the same confidence as the target confidence exists in the at least one historical test case, and no processing is performed. The same confidence coefficient indicates that the two cases are high in similarity, repeated target test cases which are automatically generated later are not added to the test case set, and finally the duplicate removal of the cases is achieved. In other words, the same confidence level indicates that the two use cases are the same as the difference degree of the target reference test case, and further indicates that the two use cases are high in similarity.
Further, after the above step 140, the target confidence of the target test case is stored, in other words, the confidence of the target test case is set as the target confidence.
Step 150, determining that no historical test case is queried from the test case set based on the request information, adding the target test case to the test case set, setting the target test case as a reference test case corresponding to the request information, and setting the confidence of the target test case as a reference confidence.
Before the step 150, the test case set is queried based on the request information, so as to query whether the historical test case corresponding to the request information exists in the test case set.
In an embodiment, the test case set is queried based on the unique identification information in the request information to query whether a historical test case corresponding to the unique identification information exists in the test case set. The unique identification information includes a URL, a request path, and a request method.
Here, the reference test case is used for performing a degree of difference calculation with the automatically generated target test case. The reference test cases are in one-to-one correspondence with the request information. Further, the reference test cases are in one-to-one correspondence with the unique identification information.
It can be appreciated that the reference test case is the first test case added to the test case set and is the test case corresponding to the request information. For example, if the test case set is characterized by a database, the reference test case is the first test case in storage and is the test case corresponding to the request information.
Each test case in the test case set is used for testing the system to be tested, and the test cases which are not added to the test case set are removed, namely the test cases which are not added to the test case set are not used for testing the system to be tested.
Here, the reference confidence is the confidence of the reference test case. If the confidence coefficient is higher, the difference degree is larger, the reference confidence coefficient is the minimum value, for example, the confidence coefficient interval is 0-100, and the reference confidence coefficient is 0; if the higher the confidence level is, the smaller the difference degree is, the reference confidence level is the maximum value, for example, the confidence interval is 0-100, and the reference confidence level is 100.
According to the test case generation method provided by the embodiment of the invention, the target test case is automatically generated based on the request information and the corresponding response information, so that the labor cost is reduced, the generation accuracy of the target test case is improved, and the comprehensiveness of the test is improved; if it is determined that at least one historical test case is queried from the test case set based on the request information, determining a target reference test case from the at least one historical test case, determining a target confidence coefficient of the target test case based on a target difference degree calculation result of the target reference test case and the target test case, if it is determined that no test case with the same confidence degree as the target confidence degree exists in the at least one historical test case, adding the target test case to the test case set for subsequent system test based on the added target test case, and correspondingly, if it is determined that a test case with the same confidence degree as the target confidence degree exists in the at least one historical test case, not performing any processing, namely, the same confidence degree indicates that the similarity of the two test cases is high, and further, adding the repeated target test case which is automatically generated for the later to the test case set, and finally realizing the de-duplication of the test case, and the de-duplication mode only needs to calculate the difference degree calculation result of the target reference test case and the target test case, thereby reducing the calculation amount, further improving the de-duplication efficiency and finally improving the generation efficiency of the test case; if it is determined that no historical test case is queried from the test case set based on the request information, adding the target test case to the test case set, namely, directly adding the target test case to the test case set when no historical test case corresponding to the request information exists, and not calculating a difference degree calculation result, so that the calculation amount is reduced, the deduplication efficiency is further improved, the generation efficiency of the test case is further improved finally, the target test case is set as a reference test case corresponding to the request information, and the confidence of the target test case is set as a reference confidence for executing the deduplication processing when a new test case is generated later.
Based on any of the above embodiments, the method in step 130 includes:
and determining the target confidence coefficient of the target test case based on the ratio of the target difference degree calculation result to the maximum difference degree calculation result corresponding to the target reference test case.
Specifically, the ratio may be directly determined as the target confidence, or further data processing may be performed on the ratio to obtain the target confidence.
It can be understood that the ratio is calculated, that is, the target difference degree calculation result is normalized, so as to more accurately represent the difference degree between the target test case and the target reference test case, and further more accurately realize the de-duplication of the case. The ratio ranges from 0 to 1.
In an embodiment, the ratio may be rounded to obtain a target confidence coefficient, so as to more accurately represent the difference degree between the target test case and the target reference test case, and further more accurately implement deduplication of the cases. For example, multiplying the ratio by 100 yields the target confidence.
The calculation formula for the target confidence is shown below, for example:
D=d(x,y)/d(x,0)*100;
where D represents the target confidence, D (x, y) represents the target variance calculation result, and D (x, 0) represents the maximum variance calculation result.
The maximum difference degree calculation result is a difference degree calculation result of the target reference test case and a first test case, the first test case is a test case with the maximum difference degree with the target reference test case, and the larger the target difference degree calculation result is, the larger the difference degree between the target reference test case and the target test case is.
Here, the calculation manner of the difference calculation result of the target reference test case and the first test case may refer to the calculation manner of the difference calculation result, which is not described herein in detail.
In this embodiment, if the target confidence is higher, the degree of difference between the target reference test case and the target test case is greater.
According to the test case generation method provided by the embodiment of the invention, the target confidence coefficient of the target test case is determined based on the ratio of the target difference degree calculation result to the maximum difference degree calculation result corresponding to the target reference test case, so that the target difference degree calculation result is normalized to more accurately represent the difference degree of the target test case and the target reference test case, and the confidence coefficient of all the test cases is the normalized value so as to more accurately determine whether the test cases with the same confidence coefficient exist or not, thereby improving the duplicate removal accuracy of the test cases.
Based on any of the above embodiments, in the method, the maximum difference calculation result is determined based on the following steps:
acquiring first request body information corresponding to the target reference test case;
extracting the first request body information to obtain a first N-dimensional array;
respectively calculating the maximum sub-difference degree calculation result of each data and 0 in the first N-dimensional array;
and determining the maximum difference degree calculation result based on the first aggregation result of the N maximum sub-difference degree calculation results.
Illustratively, the first requestor information is a body.
Here, the first N-dimensional array includes N data. For example, the first N-dimensional array is q= (x) 1 , x 2 ,..... x N )。
In one embodiment, the first requestor information is code processed to abstract it into an N-dimensional array.
Specifically, the first aggregate result may be directly determined as the maximum difference calculation result, or further data processing may be performed on the first aggregate result to obtain the maximum difference calculation result.
The calculation formula of the first aggregation result is shown in the following exemplary embodiment:
in the method, in the process of the invention,representing the first aggregate result,/->Representing a first N-dimensional array, N representing the dimensions of the first N-dimensional array.
It can be understood that the first N-dimensional array can be abstracted to be a point in the N-dimensional coordinates, so that the N-dimensional array corresponding to the first test case is abstracted to be the origin of coordinates, the maximum difference degree calculation result can be simply and rapidly determined, the euler distance between the two points can be calculated, and the maximum difference degree calculation result can be simply and rapidly determined.
Further, N represents the number of fields of the first request body information, and any data in the first N-dimensional array is used to characterize any field information in the first request body information.
Further, based on the weight value of each field information, carrying out weighted aggregation on N maximum sub-difference degree calculation results to obtain a first aggregation result; based on the first aggregate result, a maximum variance calculation result is determined.
Specifically, the first aggregate result may be directly determined as the maximum difference calculation result, or further data processing may be performed on the first aggregate result to obtain the maximum difference calculation result.
The calculation formula of the first aggregation result is shown in the following exemplary embodiment:
in the method, in the process of the invention,representing the first aggregate result,/->Representing a first N-dimensional array, N representing the dimensions of the first N-dimensional array,to- >And a weight value representing each field information.
It is understood that the number of weight values is the same as the number of fields of the first request body information, i.e. each field in the first request body information corresponds to a weight value. And carrying out weighted aggregation processing on N maximum sub-difference degree calculation results based on the weight values of the field information, so that the weights of different fields are considered, the maximum difference degree calculation result is further accurately determined, the target confidence degree of the target test case is further accurately determined, the duplicate removal accuracy of the case is further improved, and finally the generation accuracy of the test case is further improved.
According to the test case generation method provided by the embodiment of the invention, the maximum difference degree calculation result is simply and rapidly determined in the mode, so that the target confidence degree of the target test case is more accurately determined based on the ratio of the target difference degree calculation result to the maximum difference degree calculation result corresponding to the target reference test case, the normalization processing is performed on the target difference degree calculation result more accurately, the difference degree between the target test case and the target reference test case is more accurately represented, the confidence degrees of all the test cases are normalization values, and whether the test cases with the same confidence degree exist or not is more accurately determined, so that the duplicate removal accuracy of the test cases is improved, and finally the generation accuracy of the test cases is further improved.
Based on any one of the above embodiments, fig. 2 is a second flowchart of the test case generating method according to the embodiment of the present invention, as shown in fig. 2, where the target variance calculation result is determined based on the following steps:
step 210, obtaining first request body information corresponding to the target reference test case and second request body information in the request information.
Illustratively, the first and second request body information are bodies.
Step 220, extracting the first request body information to obtain a first N-dimensional array, and extracting the second request body information to obtain a second N-dimensional array, where N represents the number of fields of the first request body information, and any data in the first N-dimensional array is used to characterize any field information in the first request body information.
Here, the first N-dimensional array includes N data, and the second N-dimensional array also includes N data. For example, the first N-dimensional array is q= (x) 1 , x 2 ,..... x N ) The second N-dimensional array is p= (y) 1 , y 2 ,..... y N ). N also represents the number of fields of the second requester information, any data in the second N-dimensional array being used to characterize any field information in the second requester information.
In a specific embodiment, the first request body information is subjected to code processing and is abstracted into an N-dimensional array; the second requester information is code processed and abstracted into an N-dimensional array.
It can be understood that the request body information is extracted into an N-dimensional array matched with the field number of the request body information, so that the subsequent difference degree calculation is conveniently performed in a higher dimension, the calculation accuracy of a target difference degree calculation result is improved, the duplicate removal accuracy of the case is further improved, and the generation accuracy of the test case is further improved finally.
Step 230, calculating N difference degree calculation results of the first N-dimensional array and the second N-dimensional array, where any difference degree calculation result of the N difference degree calculation results is a difference degree calculation result of first data in the first N-dimensional array and second data corresponding to the first data in the second N-dimensional array.
Step 240, determining the target variance calculation result based on the second aggregation result of the N variance calculation results.
Specifically, the second polymerization result may be directly determined as the target difference degree calculation result, or further data processing may be performed on the second polymerization result to obtain the target difference degree calculation result.
Illustratively, the second polymerization result is calculated as follows:
in the method, in the process of the invention,representing the second polymerization result,/->Representing a first N-dimensional array, >Representing a second N-dimensional array, N representing the dimensions of the first N-dimensional array, N also representing the dimensions of the second N-dimensional array.
It can be understood that the N-dimensional array can be abstracted to be a point in the N-dimensional coordinates, so that the N-dimensional array is abstracted to be a coordinate origin, and further, the target difference degree calculation result can be simply and rapidly determined, and the euler distance between two points can be calculated, and further, the target difference degree calculation result can be simply and rapidly determined.
According to the test case generation method provided by the embodiment of the invention, the target difference degree calculation result is simply and rapidly determined in the mode, so that the target confidence degree of the target test case is more accurately determined, the accuracy of case duplication removal is further improved, and finally the generation accuracy of the test case is further improved.
Based on any one of the above embodiments, the method further includes the step 240:
based on the weight value of each field information, carrying out weighted aggregation treatment on the N difference degree calculation results to obtain a second aggregation result;
and determining the target difference degree calculation result based on the second polymerization result.
Considering that each interface performs logic calculation according to some fields when being defined, and considering that different fields have different meanings, based on the logic calculation, the weight value of each field information is preset for weighted aggregation processing. The weight values of different field information may be different.
Illustratively, the second polymerization result is calculated as follows:
in the method, in the process of the invention,representing the second polymerization result,/->Representing a first N-dimensional array,>representing a second N-dimensional array, N representing the dimension of the first N-dimensional array, N also representing the dimension of the second N-dimensional array, +.>To->And a weight value representing each field information.
It is understood that the number of weight values is the same as the number of fields of the request body information, i.e. each field in the request body information corresponds to a weight value.
According to the test case generation method provided by the embodiment of the invention, the N difference degree calculation results are subjected to weighted aggregation treatment based on the weight value of each field information, so that the weights of different fields are considered, the target difference degree calculation result is more accurately determined, the target confidence degree of the target test case is more accurately determined, the case duplication eliminating accuracy is further improved, and the generation accuracy of the test case is further improved finally.
Based on any one of the above embodiments, the method in step 110 includes:
receiving network traffic sent by a requester device, and sending the network traffic to an on-line system which is the same as a system to be tested, so that the on-line system generates response information based on the network traffic, wherein the network traffic comprises request information;
Receiving the response information sent by the online system;
and generating a target test case based on the request information and the response information.
Here, the requester device is a caller device, i.e. a device for sending a request to a system to be tested. The network traffic, i.e. online traffic, sent by the requesting device includes request information for sending a request to the system to be tested.
The on-line system is the same as the system to be tested, namely the system to be tested can be cloned to obtain the on-line system, so that the on-line system is utilized to generate the test case, the system to be tested is not influenced while the test case is generated, and the reliability and the stability of the system to be tested are improved. The online system is configured to respond to the request information and generate response information. For the online system, the online system generates response information based on network traffic and sends the response information to the execution subject of the embodiment of the present invention.
In one embodiment, the network traffic sent by the requesting device is obtained according to a cut-flow switch. More specifically, a configuration file related to a tangential switch in the requesting device is modified, and a sending address of the network traffic is modified to be an execution body of the embodiment of the present invention, so that the requesting device sends the network traffic to the execution body. And the execution body has a traffic forwarding function to forward network traffic to the on-line system.
Further, the request information and the response information may be encapsulated, and the target test case may be generated based on the encapsulated information. For example, the request message and the response message are encapsulated.
It can be understood that the online mass flow is beaten to the execution main body of the embodiment, and the test case can be automatically generated.
According to the test case generation method provided by the embodiment of the invention, the network traffic sent by the requester device is received, the network traffic is sent to the on-line system which is the same as the system to be tested, so that the on-line system generates response information based on the network traffic, and the response information sent by the on-line system is received, so that the target test case is generated based on the request information and the response information, the system to be tested is not influenced while the target test case is generated, and the reliability and the stability of the system to be tested are further improved.
Based on any one of the foregoing embodiments, in the method, generating the target test case based on the request information and the response information includes:
and sending the response information to the requester equipment, and generating a target test case asynchronously based on the request information and the response information.
Specifically, the execution process of sending the response information to the requester device and the execution process of generating the target test case based on the request information and the response information do not affect each other, so that the request of the requester device is responded while the target test case can be ensured to be generated.
According to the test case generation method provided by the embodiment of the invention, the response information is sent to the requester equipment, and the target test case is generated asynchronously based on the request information and the response information, so that the normal operation of the requester equipment and the requester equipment is ensured without mutual influence while the target test case can be generated, and the stability and the reliability are improved.
Based on any of the above embodiments, the method further comprises:
cloning the environment information of the online system to the system to be tested so that the environment of the online system is the same as that of the system to be tested;
and each test case in the test case set is used for testing the system to be tested.
Specifically, the on-line environment of the on-line system is cloned to the system to be tested, and the consistency of the on-line system and the off-line system (the system to be tested) is ensured, so that the effectiveness and the accuracy of the test are ensured.
According to the test case generation method provided by the embodiment of the invention, the environment information of the online system is cloned to the system to be tested, so that the environment of the online system is identical to that of the system to be tested, the consistency of the online system and the offline system (the system to be tested) is ensured, and the accuracy of testing the system to be tested based on each test case in the test case set is further ensured, namely the effectiveness and the accuracy of testing are ensured.
Based on any of the foregoing embodiments, in the method, in step 120, the determining, based on the request information, queries at least one historical test case from the test case set, including:
inquiring at least one historical test case from the test case set based on the unique identification information in the request information;
wherein the unique identification information includes a uniform resource locator URL, a request path, and a request method.
Specifically, the request information is analyzed to obtain the corresponding URL, request path and request method.
According to the test case generation method provided by the embodiment of the invention, at least one historical test case is the test case related to the unique identification information in the mode, namely, not all the historical test cases are the test cases related to the unique identification information, so that the de-duplication of the related test cases is realized, the de-duplication accuracy of the cases is further improved, and the generation accuracy of the test cases is finally improved.
The test case generating device provided by the invention is described below, and the test case generating device described below and the test case generating method described above can be referred to correspondingly.
Fig. 3 is a schematic structural diagram of a test case generating device according to an embodiment of the present invention, and as shown in fig. 3, the test case generating device includes:
The case generation module 310 is configured to generate a target test case based on the request information and response information corresponding to the request information;
the case query module 320 is configured to determine that at least one historical test case is queried from the test case set based on the request information, and determine a target reference test case from the at least one historical test case;
the confidence determining module 330 is configured to determine a target confidence of the target test case based on a target difference calculation result between the target reference test case and the target test case;
a first case adding module 340, configured to determine that a test case with a confidence identical to the target confidence does not exist in the at least one historical test case, and add the target test case to the test case set;
the second case adding module 350 is configured to determine that no historical test case is queried from the test case set based on the request information, add the target test case to the test case set, set the target test case as a reference test case corresponding to the request information, and set the confidence of the target test case as a reference confidence.
According to the test case generation device provided by the embodiment of the invention, the target test case is automatically generated based on the request information and the corresponding response information, so that the labor cost is reduced, the generation accuracy of the target test case is improved, and the comprehensiveness of the test is improved; if it is determined that at least one historical test case is queried from the test case set based on the request information, determining a target reference test case from the at least one historical test case, determining a target confidence coefficient of the target test case based on a target difference degree calculation result of the target reference test case and the target test case, if it is determined that no test case with the same confidence degree as the target confidence degree exists in the at least one historical test case, adding the target test case to the test case set for subsequent system test based on the added target test case, and correspondingly, if it is determined that a test case with the same confidence degree as the target confidence degree exists in the at least one historical test case, not performing any processing, namely, the same confidence degree indicates that the similarity of the two test cases is high, and further, adding the repeated target test case which is automatically generated for the later to the test case set, and finally realizing the de-duplication of the test case, and the de-duplication mode only needs to calculate the difference degree calculation result of the target reference test case and the target test case, thereby reducing the calculation amount, further improving the de-duplication efficiency and finally improving the generation efficiency of the test case; if it is determined that no historical test case is queried from the test case set based on the request information, adding the target test case to the test case set, namely, directly adding the target test case to the test case set when no historical test case corresponding to the request information exists, and not calculating a difference degree calculation result, so that the calculation amount is reduced, the deduplication efficiency is further improved, the generation efficiency of the test case is further improved finally, the target test case is set as a reference test case corresponding to the request information, and the confidence of the target test case is set as a reference confidence for executing the deduplication processing when a new test case is generated later.
Based on any of the above embodiments, the confidence determining module 330 is further configured to:
determining the target confidence coefficient of the target test case based on the ratio of the target difference degree calculation result to the maximum difference degree calculation result corresponding to the target reference test case;
the maximum difference degree calculation result is a difference degree calculation result of the target reference test case and a first test case, the first test case is a test case with the maximum difference degree with the target reference test case, and the larger the target difference degree calculation result is, the larger the difference degree between the target reference test case and the target test case is.
Based on any of the above embodiments, the confidence determining module 330 is further configured to:
acquiring first request body information corresponding to the target reference test case;
extracting the first request body information to obtain a first N-dimensional array;
respectively calculating the maximum sub-difference degree calculation result of each data and 0 in the first N-dimensional array;
and determining the maximum difference degree calculation result based on the first aggregation result of the N maximum sub-difference degree calculation results.
Based on any of the above embodiments, the confidence determining module 330 is further configured to:
Acquiring first request body information corresponding to the target reference test case and second request body information in the request information;
extracting the first request body information to obtain a first N-dimensional array, and extracting the second request body information to obtain a second N-dimensional array, wherein N represents the field number of the first request body information, and any data in the first N-dimensional array is used for representing any field information in the first request body information;
calculating N difference degree calculation results of the first N-dimensional array and the second N-dimensional array, wherein any difference degree calculation result in the N difference degree calculation results is a difference degree calculation result of first data in the first N-dimensional array and second data corresponding to the first data in the second N-dimensional array;
and determining the target difference degree calculation result based on a second aggregation result of the N difference degree calculation results.
Based on any of the above embodiments, the confidence determining module 330 is further configured to:
based on the weight value of each field information, carrying out weighted aggregation treatment on the N difference degree calculation results to obtain a second aggregation result;
and determining the target difference degree calculation result based on the second polymerization result.
Based on any of the above embodiments, the use case generation module 310 is further configured to:
receiving network traffic sent by a requester device, and sending the network traffic to an on-line system which is the same as a system to be tested, so that the on-line system generates response information based on the network traffic, wherein the network traffic comprises request information;
receiving the response information sent by the online system;
and generating a target test case based on the request information and the response information.
Based on any of the above embodiments, the use case generation module 310 is further configured to:
and sending the response information to the requester equipment, and generating a target test case asynchronously based on the request information and the response information.
Based on any of the above embodiments, the apparatus further comprises an environmental cloning module for:
cloning the environment information of the online system to the system to be tested so that the environment of the online system is the same as that of the system to be tested;
and each test case in the test case set is used for testing the system to be tested.
Based on any of the above embodiments, the use case query module 320 is further configured to:
Inquiring at least one historical test case from the test case set based on the unique identification information in the request information;
wherein the unique identification information includes a uniform resource locator URL, a request path, and a request method.
Fig. 4 illustrates a physical schematic diagram of an electronic device, as shown in fig. 4, which may include: processor 410, communication interface (Communications Interface) 420, memory 430 and communication bus 440, wherein processor 410, communication interface 420 and memory 430 communicate with each other via communication bus 440. The processor 410 may call logic instructions in the memory 430 to perform the following method: generating a target test case based on the request information and response information corresponding to the request information; determining that at least one historical test case is queried from a test case set based on the request information, and determining a target reference test case from the at least one historical test case; determining target confidence of the target test case based on a target difference calculation result of the target reference test case and the target test case; determining that no test case with the confidence identical to the target confidence exists in the at least one historical test case, and adding the target test case to the test case set; determining that no historical test cases are queried from a test case set based on the request information, adding the target test case to the test case set, setting the target test case as a reference test case corresponding to the request information, and setting the confidence of the target test case as a reference confidence.
Further, the logic instructions in the memory 430 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the related art or a part of the technical solution, or in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In another aspect, embodiments of the present invention disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, are capable of performing the methods provided by the above-described method embodiments, for example comprising: generating a target test case based on the request information and response information corresponding to the request information; determining that at least one historical test case is queried from a test case set based on the request information, and determining a target reference test case from the at least one historical test case; determining target confidence of the target test case based on a target difference calculation result of the target reference test case and the target test case; determining that no test case with the confidence identical to the target confidence exists in the at least one historical test case, and adding the target test case to the test case set; determining that no historical test cases are queried from a test case set based on the request information, adding the target test case to the test case set, setting the target test case as a reference test case corresponding to the request information, and setting the confidence of the target test case as a reference confidence.
In still another aspect, embodiments of the present invention further provide a non-transitory computer readable storage medium having stored thereon a computer program that, when executed by a processor, is implemented to perform the test case generating method provided in the above embodiments, for example, including: generating a target test case based on the request information and response information corresponding to the request information; determining that at least one historical test case is queried from a test case set based on the request information, and determining a target reference test case from the at least one historical test case; determining target confidence of the target test case based on a target difference calculation result of the target reference test case and the target test case; determining that no test case with the confidence identical to the target confidence exists in the at least one historical test case, and adding the target test case to the test case set; determining that no historical test cases are queried from a test case set based on the request information, adding the target test case to the test case set, setting the target test case as a reference test case corresponding to the request information, and setting the confidence of the target test case as a reference confidence.
The apparatus embodiments described above are merely illustrative, wherein elements illustrated as separate elements may or may not be physically separate, and elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on such understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the related art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method of the respective embodiments or some parts of the embodiments.
Finally, it should be noted that the above-mentioned embodiments are merely illustrative of the invention, and not limiting. While the invention has been described in detail with reference to the embodiments, those skilled in the art will appreciate that various combinations, modifications, or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and the present invention is intended to be covered by the scope of the present invention.

Claims (12)

1. A test case generation method, comprising:
generating a target test case based on the request information and response information corresponding to the request information;
determining that at least one historical test case is queried from a test case set based on the request information, and determining a target reference test case from the at least one historical test case;
determining target confidence of the target test case based on a target difference calculation result of the target reference test case and the target test case;
determining that no test case with the confidence identical to the target confidence exists in the at least one historical test case, and adding the target test case to the test case set;
determining that no historical test cases are queried from a test case set based on the request information, adding the target test case to the test case set, setting the target test case as a reference test case corresponding to the request information, and setting the confidence of the target test case as a reference confidence.
2. The test case generation method according to claim 1, wherein the determining the target confidence of the target test case based on the target difference calculation result between the target reference test case and the target test case includes:
determining the target confidence coefficient of the target test case based on the ratio of the target difference degree calculation result to the maximum difference degree calculation result corresponding to the target reference test case;
the maximum difference degree calculation result is a difference degree calculation result of the target reference test case and a first test case, the first test case is a test case with the maximum difference degree with the target reference test case, and the larger the target difference degree calculation result is, the larger the difference degree between the target reference test case and the target test case is.
3. The test case generating method according to claim 2, wherein the maximum difference degree calculation result is determined based on the steps of:
acquiring first request body information corresponding to the target reference test case;
extracting the first request body information to obtain a first N-dimensional array;
respectively calculating the maximum sub-difference degree calculation result of each data and 0 in the first N-dimensional array;
And determining the maximum difference degree calculation result based on the first aggregation result of the N maximum sub-difference degree calculation results.
4. The test case generating method according to claim 1, wherein the target degree of difference calculation result is determined based on the steps of:
acquiring first request body information corresponding to the target reference test case and second request body information in the request information;
extracting the first request body information to obtain a first N-dimensional array, and extracting the second request body information to obtain a second N-dimensional array, wherein N represents the field number of the first request body information, and any data in the first N-dimensional array is used for representing any field information in the first request body information;
calculating N difference degree calculation results of the first N-dimensional array and the second N-dimensional array, wherein any difference degree calculation result in the N difference degree calculation results is a difference degree calculation result of first data in the first N-dimensional array and second data corresponding to the first data in the second N-dimensional array;
and determining the target difference degree calculation result based on a second aggregation result of the N difference degree calculation results.
5. The test case generation method according to claim 4, wherein the determining the target variance calculation result based on the second aggregate result of the N variance calculation results includes:
based on the weight value of each field information, carrying out weighted aggregation treatment on the N difference degree calculation results to obtain a second aggregation result;
and determining the target difference degree calculation result based on the second polymerization result.
6. The test case generation method according to claim 1, wherein the generating the target test case based on the request information and the response information corresponding to the request information includes:
receiving network traffic sent by a requester device, and sending the network traffic to an on-line system which is the same as a system to be tested, so that the on-line system generates response information based on the network traffic, wherein the network traffic comprises request information;
receiving the response information sent by the online system;
and generating a target test case based on the request information and the response information.
7. The test case generation method according to claim 6, wherein the generating the target test case based on the request information and the response information includes:
And sending the response information to the requester equipment, and generating a target test case asynchronously based on the request information and the response information.
8. The test case generation method according to claim 6, further comprising:
cloning the environment information of the online system to the system to be tested so that the environment of the online system is the same as that of the system to be tested;
and each test case in the test case set is used for testing the system to be tested.
9. The test case generation method of claim 1, wherein the determining that at least one historical test case is queried from a test case set based on the request information comprises:
inquiring at least one historical test case from the test case set based on the unique identification information in the request information;
wherein the unique identification information includes a uniform resource locator URL, a request path, and a request method.
10. A test case generating apparatus, comprising:
the case generation module is used for generating a target test case based on the request information and response information corresponding to the request information;
The case query module is used for determining that at least one historical test case is queried from the test case set based on the request information, and determining a target reference test case from the at least one historical test case;
the confidence coefficient determining module is used for determining the target confidence coefficient of the target test case based on the target difference coefficient calculation result of the target reference test case and the target test case;
the first case adding module is used for determining that no test case with the confidence identical to the target confidence exists in the at least one historical test case, and adding the target test case to the test case set;
the second case adding module is used for determining that no historical test case is queried from the test case set based on the request information, adding the target test case to the test case set, setting the target test case as a reference test case corresponding to the request information, and setting the confidence of the target test case as a reference confidence.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the test case generating method according to any one of claims 1 to 9 when executing the program.
12. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the test case generating method according to any of claims 1 to 9.
CN202311111966.8A 2023-08-31 2023-08-31 Test case generation method and device, electronic equipment and storage medium Active CN116841913B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311111966.8A CN116841913B (en) 2023-08-31 2023-08-31 Test case generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311111966.8A CN116841913B (en) 2023-08-31 2023-08-31 Test case generation method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN116841913A true CN116841913A (en) 2023-10-03
CN116841913B CN116841913B (en) 2023-12-29

Family

ID=88172840

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311111966.8A Active CN116841913B (en) 2023-08-31 2023-08-31 Test case generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116841913B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170139819A1 (en) * 2015-11-18 2017-05-18 International Business Machines Corporation Proactive and selective regression testing based on historic test results
CN112783779A (en) * 2021-01-28 2021-05-11 北京达佳互联信息技术有限公司 Test case generation method and device, electronic equipment and storage medium
CN113190434A (en) * 2021-04-12 2021-07-30 成都安易迅科技有限公司 Test case generation method and device, storage medium and computer equipment
WO2022135276A1 (en) * 2020-12-22 2022-06-30 深圳前海微众银行股份有限公司 Method and apparatus for processing test cases, and storage medium
CN114896141A (en) * 2022-04-24 2022-08-12 广州虎牙科技有限公司 Test case duplication removing method, device, equipment and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170139819A1 (en) * 2015-11-18 2017-05-18 International Business Machines Corporation Proactive and selective regression testing based on historic test results
WO2022135276A1 (en) * 2020-12-22 2022-06-30 深圳前海微众银行股份有限公司 Method and apparatus for processing test cases, and storage medium
CN112783779A (en) * 2021-01-28 2021-05-11 北京达佳互联信息技术有限公司 Test case generation method and device, electronic equipment and storage medium
CN113190434A (en) * 2021-04-12 2021-07-30 成都安易迅科技有限公司 Test case generation method and device, storage medium and computer equipment
CN114896141A (en) * 2022-04-24 2022-08-12 广州虎牙科技有限公司 Test case duplication removing method, device, equipment and computer readable storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
杨杰等: "改进的可靠性测试用例自动生成方法", 杭州电子科技大学学报(自然科学版), no. 04 *

Also Published As

Publication number Publication date
CN116841913B (en) 2023-12-29

Similar Documents

Publication Publication Date Title
CN109460775B (en) Data filling method and device based on information entropy
CN112148216A (en) Data processing method and system based on cloud server and data interaction
CN110380890B (en) CDN system service quality detection method and system
CN116841913B (en) Test case generation method and device, electronic equipment and storage medium
CN113641742A (en) Data extraction method, device, equipment and storage medium
CN111581235B (en) Method and system for identifying common incidence relation
CN115906048A (en) Equipment identification method and system based on terminal information
CN108390770B (en) Information generation method and device and server
CN111694588B (en) Engine upgrade detection method and device, computer equipment and readable storage medium
CN116070586A (en) Preview file generation method, file preview device and computing equipment
CN113778831A (en) Data application performance analysis method, device, equipment and medium
CN115118583B (en) Log query method and device, electronic equipment and computer readable storage equipment
CN116795723B (en) Chain unit test processing method and device and computer equipment
CN116595945B (en) High-precision simulation scattering parameter extraction method, electronic equipment and storage medium
CN117395071B (en) Abnormality detection method, abnormality detection device, abnormality detection equipment and storage medium
CN112699101B (en) Server system based on storage and processing
CN117453577B (en) Method, device and computer equipment for generating interface automation use case based on flow recording
CN108933709B (en) Method, apparatus and computer readable storage medium for testing server performance
CN115827280A (en) Message processing method and device, electronic equipment and storage medium
CN116846797A (en) Node limit throughput determination method, system, device, equipment and medium
CN117573543A (en) Test data generation method and device, electronic equipment and storage medium
CN110618906A (en) Detection method and device for missed detection interface, network equipment and storage medium
CN117093458A (en) Computer device efficiency testing method
CN113297576A (en) Threat detection method and device, behavior portrait method and device and electronic equipment
CN117171016A (en) Testing method and device for approval process, computer equipment and readable 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