Test case verification method, device, medium and electronic equipment
1. A method for verifying a test case is characterized in that the method comprises the following steps:
acquiring at least two case character strings corresponding to a test case, and determining a common character string of the at least two case character strings;
calculating the similarity between every two of the at least two case character strings to obtain a similarity set;
and acquiring a character string to be verified obtained by executing the test case, and verifying the character string to be verified by utilizing the public character string and the similarity set to obtain a verification result of the test case.
2. The method for verifying the test case according to claim 1, wherein the verifying the character string to be verified by using the common character string and the similarity set to obtain the verification result of the test case comprises:
acquiring the number of character strings of the public character string, and acquiring the number to be checked of the character strings to be checked;
if the character string to be verified comprises the public character string and the number of the character strings is less than the number to be verified, determining a similarity set to be verified corresponding to the character string to be verified;
and verifying the similarity set to be verified by using the similarity set to obtain a verification result of the test case.
3. The method for verifying the test case according to claim 2, wherein the verifying the similarity set to be verified by using the similarity set to obtain a verification result comprises:
if the similarity set comprises the similarity set to be verified, determining that the verification result of the test case is verification success;
and if the similarity set does not comprise the similarity set to be verified, determining that the verification result of the test case is verification failure.
4. The method for verifying the test case according to claim 2, wherein the verifying the similarity set to be verified by using the similarity set to obtain the verification result of the test case comprises:
acquiring fluctuation parameters corresponding to the similarity set;
and verifying the similarity set to be verified by using the similarity set and the fluctuation parameters to obtain a verification result.
5. The method for verifying the test case according to claim 1, wherein after the obtaining the character string to be verified obtained by executing the test case, the method further comprises:
acquiring the number of character strings of the public character string, and acquiring the number to be checked of the character strings to be checked;
and if the character string to be verified comprises the public character string and the number to be verified is equal to the number of the character strings, determining that the verification result of the test case is successful.
6. The method for verifying the test case according to claim 1, wherein after the calculating the similarity between each two of the at least two case strings to obtain a similarity set, the method further comprises:
acquiring verification character strings corresponding to the at least two use case character strings;
updating the common character string and the similarity set with the validation character string.
7. The method for verifying the test case according to claim 6, wherein the updating the common character string and the similarity set by using the verification character string includes:
determining a verification common character string and a verification similarity set of the at least two use case character strings and the verification character string;
comparing the public character string with the verification public character string to obtain a public comparison result, and comparing the similarity set with the verification similarity set to obtain a similarity comparison result;
and updating the public character string and the similarity set according to the public comparison result and the similarity comparison result.
8. The method for verifying the test case according to claim 7, wherein the updating the common character string and the similarity set according to the common comparison result and the similarity comparison result includes:
if the public comparison result indicates that the public character string is different from the verified public character string, updating the public character string; and/or
And if the similarity comparison result indicates that the similarity set is different from the verification similarity set, updating the similarity set.
9. The method for verifying the test case according to claim 1, wherein the at least two case strings comprise at least two operation strings;
the determining a common string of the at least two use case strings includes:
determining an operation substring between every two of the at least two operation strings;
performing aggregation processing on the operation substrings to obtain operation aggregated strings;
and carrying out deduplication processing on the operation aggregation character string to obtain a public character string.
10. The method for verifying the test case according to claim 9, wherein the calculating the similarity between each two of the at least two case character strings to obtain a similarity set includes:
calculating the similarity between every two of the at least two operation character strings by using a similarity algorithm to obtain operation similarity;
and performing aggregation processing on the operation similarity to obtain a similarity set.
11. The method for verifying the test case according to claim 1, wherein the at least two case strings comprise at least two network strings;
the determining a common string of the at least two use case strings includes:
determining network substrings between every two of the at least two network strings;
carrying out aggregation processing on the network substrings to obtain network aggregation character strings;
and carrying out deduplication processing on the network aggregation character string to obtain a public character string.
12. The method for verifying the test case according to claim 11, wherein the calculating the similarity between each two of the at least two case character strings to obtain a similarity set includes:
calculating the similarity between every two of the at least two network character strings by using a similarity algorithm to obtain network similarity;
and carrying out aggregation processing on the network similarity to obtain a similarity set.
13. An apparatus for verifying a test case, the apparatus comprising:
the common part module is configured to acquire at least two case character strings corresponding to the test cases and determine common character strings of the at least two case character strings;
the difference calculation module is configured to calculate the similarity between every two of the at least two case character strings to obtain a similarity set;
and the verification execution module is configured to acquire a character string to be verified obtained by executing the test case, and verify the character string to be verified by using the common character string and the similarity set to obtain a verification result of the test case.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out a method for verification of a test case according to any one of claims 1 to 12.
15. An electronic device, comprising:
a processor; and
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of verification of a test case of any of claims 1 to 12 via execution of the executable instructions.
Background
There are many ways of checking for text and other types of strings, such as a tester writing various forms of assertions or matching codes.
However, writing code to verify is inefficient and also requires human judgment and maintenance in different scenarios. Therefore, this method is less reliable and less automated and intelligent.
In view of this, there is a need in the art to develop a new method and apparatus for verifying test cases.
It should be noted that the information disclosed in the above background section is only for enhancement of understanding of the technical background of the present application, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure is directed to a method for verifying a test case, a device for verifying a test case, a computer-readable medium, and an electronic device, so as to overcome the technical problem that the efficiency and reliability of a string verification method are too low at least to some extent.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to an aspect of the embodiments of the present disclosure, a method for verifying a test case is provided, where the method includes: acquiring at least two case character strings corresponding to a test case, and determining a common character string of the at least two case character strings;
calculating the similarity between every two of the at least two case character strings to obtain a similarity set;
and acquiring a character string to be verified obtained by executing the test case, and verifying the character string to be verified by utilizing the public character string and the similarity set to obtain a verification result of the test case.
According to an aspect of the embodiments of the present disclosure, there is provided a device for verifying a test case, the device including: the common part module is configured to acquire at least two case character strings corresponding to the test cases and determine common character strings of the at least two case character strings;
the difference calculation module is configured to calculate the similarity between every two of the at least two case character strings to obtain a similarity set;
and the verification execution module is configured to acquire a character string to be verified obtained by executing the test case, and verify the character string to be verified by using the common character string and the similarity set to obtain a verification result of the test case.
In some embodiments of the present disclosure, based on the above technical solutions, the verification execution module includes: the number determining submodule is configured to obtain the number of the character strings of the public character string and obtain the number to be checked of the character strings to be checked;
the set determining submodule is configured to determine a similarity set to be checked corresponding to the character string to be checked if the character string to be checked comprises the public character string and the number of the character strings is smaller than the number to be checked;
and the set checking submodule is configured to check the similarity set to be checked by using the similarity set to obtain a checking result of the test case.
In some embodiments of the present disclosure, based on the above technical solutions, the set checking submodule includes: the verification success unit is configured to determine that the verification result of the test case is verification success if the similarity set comprises the similarity set to be verified;
and the verification failure unit is configured to determine that the verification result of the test case is verification failure if the similarity set does not include the similarity set to be verified.
In some embodiments of the present disclosure, based on the above technical solutions, the set checking submodule includes: a parameter acquisition unit configured to acquire a fluctuation parameter corresponding to the similarity set;
and the random checking unit is configured to check the similarity set to be checked by using the similarity set and the fluctuation parameter to obtain a checking result.
In some embodiments of the present disclosure, based on the above technical solutions, the verification apparatus for a test case further includes: the number determining module is configured to obtain the number of the character strings of the public character string and obtain the number to be checked of the character strings to be checked;
and the same verification module is configured to determine that the verification result of the test case is successful if the to-be-verified character string comprises the common character string and the number of the to-be-verified characters is equal to the number of the character strings.
In some embodiments of the present disclosure, based on the above technical solutions, the verification apparatus for a test case further includes: the verification updating module is configured to acquire verification character strings corresponding to the at least two use case character strings;
a set update module configured to update the common string and the similarity set with the validation string.
In some embodiments of the present disclosure, based on the above technical solutions, the set updating module includes: a set determination submodule configured to determine a verification common character string and a verification similarity set of the at least two use case character strings and the verification character string;
the set comparison submodule is configured to compare the public character string with the verification public character string to obtain a public comparison result, and compare the similarity set with the verification similarity set to obtain a similarity comparison result;
a comparison result submodule configured to update the common character string and the similarity set according to the common comparison result and the similarity comparison result.
In some embodiments of the disclosure, based on the above technical solutions, the comparison result sub-module includes: a public updating unit configured to update the public character string if the public comparison result indicates that the public character string is different from the verified public character string; and/or
And the difference updating unit is configured to update the similarity set if the similarity comparison result shows that the similarity set is different from the verification similarity set.
In some embodiments of the present disclosure, based on the above technical solutions, the common part module includes: an operation determining sub-module configured to determine an operation sub-string between each two of the at least two operation strings;
the operation aggregation sub-module is configured to aggregate the operation substrings to obtain operation aggregation character strings;
and the operation duplication removing sub-module is configured to carry out duplication removing processing on the operation aggregation character string to obtain a public character string.
In some embodiments of the present disclosure, based on the above technical solutions, the difference calculating module includes: the operation similarity submodule is configured to calculate the similarity between every two of the at least two operation character strings by using a similarity algorithm to obtain operation similarity;
and the operation set submodule is configured to aggregate the operation similarity to obtain a similarity set.
In some embodiments of the present disclosure, based on the above technical solutions, the common part module includes: a network determination sub-module configured to determine a network substring between each two of the at least two network strings;
the network aggregation sub-module is configured to aggregate the network substrings to obtain network aggregation character strings;
and the network duplication removal sub-module is configured to perform duplication removal processing on the network aggregation character string to obtain a public character string.
In some embodiments of the present disclosure, based on the above technical solutions, the difference calculating module includes: the network similarity submodule is configured to calculate the similarity between every two of the at least two network character strings by using a similarity algorithm to obtain network similarity;
and the network set submodule is configured to aggregate the network similarity to obtain a similarity set.
According to an aspect of the embodiments of the present disclosure, there is provided a computer readable medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the verification method of the test case as in the above technical solution.
According to an aspect of an embodiment of the present disclosure, there is provided an electronic apparatus including: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the verification method of the test case in the above technical solution by executing the executable instruction.
In the technical scheme provided by the embodiment of the disclosure, on one hand, the common character strings and the similarity set of at least two case character strings are determined, the case verification method is self-learning, the operation process is automatic and intelligent, codes do not need to be written, and the verification efficiency of the character strings of the test cases is improved; on the other hand, the common character string and the similarity set are used for verifying the character string to be verified, manual participation is not needed, and the reliability and the accuracy of character string verification are improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty. In the drawings:
fig. 1 schematically illustrates an architecture diagram of an exemplary system to which the disclosed solution applies;
FIG. 2 is a flow chart that schematically illustrates steps of a method for verification of test cases, in some embodiments of the present disclosure;
FIG. 3 schematically illustrates a flow chart of steps of a method of manipulating strings to obtain common strings in some embodiments of the present disclosure;
FIG. 4 schematically illustrates a flow chart of steps of a method of making network strings common in some embodiments of the present disclosure;
FIG. 5 schematically illustrates a flow chart of steps of a method of calculating similarity between operation strings resulting in a set of similarities in some embodiments of the present disclosure;
FIG. 6 schematically illustrates a flow chart of steps of a method of calculating similarity between network strings resulting in a set of similarities in some embodiments of the present disclosure;
FIG. 7 schematically illustrates a flow chart of steps of a method of updating common strings and similarity sets in some embodiments of the present disclosure;
FIG. 8 schematically illustrates a flow chart of steps of a method of updating common strings and similarity sets according to comparison results in some embodiments of the present disclosure;
FIG. 9 schematically illustrates a flow chart of steps of a method of further updating common strings and similarity sets based on comparison results in some embodiments of the present disclosure;
FIG. 10 schematically illustrates a flow chart of steps of a method of checking with a common string and a similarity set simultaneously in some embodiments of the present disclosure;
FIG. 11 schematically illustrates a flow chart of steps of a method of obtaining a verification result in some embodiments of the present disclosure;
FIG. 12 schematically illustrates a flow chart of steps of a method of verifying with fluctuating parameters in some embodiments of the present disclosure;
FIG. 13 schematically illustrates a flow chart of steps of a method of verifying with a common string in some embodiments of the present disclosure;
FIG. 14 is a flow chart that schematically illustrates steps of a method for verifying a test case in an application scenario in accordance with some embodiments of the present disclosure;
fig. 15 schematically illustrates an interface diagram for setting a recording scene in an application scene according to some embodiments of the present disclosure;
FIG. 16 schematically illustrates an interface diagram for learning tasks in an application scenario in accordance with embodiments of the present disclosure;
FIG. 17 is a schematic interface diagram illustrating at least two character strings in an application scenario in accordance with embodiments of the present disclosure;
FIG. 18 is a schematic interface diagram illustrating another at least two strings in an application scenario in accordance with some embodiments of the present disclosure;
FIG. 19 schematically illustrates an interface diagram stored in a text mode in an application scenario in accordance with some embodiments of the present disclosure;
FIG. 20 is a schematic diagram illustrating a verifiable scenario of a verification method for a test case according to some embodiments of the disclosure;
FIG. 21 is a schematic interface diagram illustrating a record to be checked for a string in an application scenario according to some embodiments of the disclosure;
FIG. 22 is a schematic interface diagram illustrating all verification results in an application scenario in accordance with some embodiments of the present disclosure;
FIG. 23 is an interface diagram that schematically illustrates an example of a test method that applies test cases in some embodiments of the present disclosure;
FIG. 24 is a block diagram that schematically illustrates an apparatus for verifying a test case, in some embodiments of the present disclosure;
FIG. 25 schematically illustrates a structural diagram of a computer system suitable for use with an electronic device that implements an embodiment of the disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations, or operations have not been shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
In the related art, there are many methods for checking a character string. For example, various forms of assertions and matches are written. The assertion is a common debugging mode in software development, and is supported by multiple development languages. Assertions are used to guarantee the most basic and critical correctness of a program.
Especially in the field of testing, a tester needs to perform string verification by writing a large amount of code. Moreover, the test personnel is required to judge and maintain under different scenes.
The mode of testing personnel writing codes to check character strings enables checking results to be different from person to person, and is low in reliability and large in variation. Moreover, for different scenes, developers all need to participate in code writing for verification, and the verification efficiency is too low.
Based on the problems existing in the above schemes, the present disclosure provides a test case verification method based on artificial intelligence, a test case verification apparatus, a computer readable medium, and an electronic device.
Artificial Intelligence (AI) is a theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and expand human Intelligence, perceive the environment, acquire knowledge and use the knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technique of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence. Artificial intelligence is the research of the design principle and the realization method of various intelligent machines, so that the machines have the functions of perception, reasoning and decision making.
The artificial intelligence technology is a comprehensive subject and relates to the field of extensive technology, namely the technology of a hardware level and the technology of a software level. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
Machine Learning (ML) is a multi-domain cross subject, and relates to multiple subjects such as probability theory, statistics, approximation theory, convex analysis and algorithm complexity theory. The special research on how a computer simulates or realizes the learning behavior of human beings so as to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve the performance of the computer. Machine learning is the core of artificial intelligence, is the fundamental approach for computers to have intelligence, and is applied to all fields of artificial intelligence. Machine learning and deep learning generally include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and formal education learning.
The method for verifying the test case by utilizing the machine learning technology in the artificial intelligence does not need manual participation, improves the reliability of the verification result of the test case, does not need to write codes, and improves the verification efficiency of the test case.
Fig. 1 shows an exemplary system architecture diagram to which the disclosed solution is applied.
As shown in fig. 1, the system architecture 100 may include a terminal 110, a network 120, and a server side 130. Wherein the terminal 110 and the server 130 are connected through the network 120.
The terminal 110 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, and the like. Network 120 may be any type of communications medium capable of providing a communications link between terminal 110 and server 130, such as a wired communications link, a wireless communications link, or a fiber optic cable, and the like, without limitation. The server 130 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, middleware service, a domain name service, a security service, a CDN, a big data and artificial intelligence platform, and the like.
Specifically, the server 130 obtains at least two case character strings corresponding to the test cases, determines a common character string of the at least two case character strings, and calculates a similarity between every two of the at least two case character strings to obtain a similarity set. Further, a character string to be verified obtained by executing the test case is obtained, and the common character string and the similarity set are used for verifying the character string to be verified to obtain a verification result of the test case.
In addition, the verification method of the test case in the embodiment of the present disclosure may be applied to a terminal, and may also be applied to a server, which is not particularly limited in this disclosure. The embodiment of the present disclosure is mainly illustrated by applying a verification method of a test case to the server 130.
The following describes in detail a test case verification method, a test case verification apparatus, a computer-readable medium, and an electronic device, which are provided by the present disclosure, with reference to specific embodiments.
Fig. 2 schematically illustrates a flowchart of steps of a method for verifying a test case in some embodiments of the present disclosure, and as shown in fig. 2, the method for verifying a test case may mainly include the following steps:
s210, at least two case character strings corresponding to the test cases are obtained, and a public character string of the at least two case character strings is determined.
And S220, calculating the similarity between every two at least two case character strings to obtain a similarity set.
And S230, obtaining a character string to be verified obtained by executing the test case, and verifying the character string to be verified by utilizing the common character string and the similarity set to obtain a verification result of the test case.
In the exemplary embodiment of the disclosure, on one hand, the common character string and the similarity set of at least two case character strings are determined, and the case verification method is self-learning, the running process is automatic and intelligent, codes do not need to be written, and the verification efficiency of the character strings of the test cases is improved; on the other hand, the common character string and the similarity set are used for verifying the character string to be verified, manual participation is not needed, and the reliability and the accuracy of character string verification are improved.
The following describes each step of the verification method of the test case in detail.
In step S210, at least two case strings corresponding to the test case are obtained, and a common string of the at least two case strings is determined.
In an exemplary embodiment of the present disclosure, the test case may be a recorded case, and may be recorded by a recording engine.
It should be noted that the recorded test cases can be regarded as a series of operation flows and network flows. The operation flow may be each operation of the user, and the network flow may be a network request generated by the user in each operation.
The at least two case strings corresponding to the test case may be strings generated in the process of playing back the recorded test case.
For example, when the test case is a case for testing a function of a user clicking search data of a search engine, the character string corresponding to the operation flow may be a name of the search engine or a value of another element, and the network flow may be an identification character string corresponding to the search data, and the like.
Therefore, the at least two use case strings may include two categories, i.e., a string corresponding to the operation flow and a string corresponding to the network flow, so as to determine a common string in different categories.
Fig. 3 and 4 show a flow chart of steps of a method of determining a common character string under two categories, respectively. Fig. 3 is a flowchart illustrating steps of a method for determining a common character string from an operation character string corresponding to an operation flow, and fig. 4 is a flowchart illustrating steps of a method for determining a common character string from a network character string corresponding to a network flow.
In an alternative embodiment, the at least two use case strings include at least two operation strings. Fig. 3 shows a flow chart of the steps of a method of manipulating a string to obtain a common string, which method comprises at least the following steps, as shown in fig. 3: in step S310, an operation substring between at least two operation strings is determined.
At least two operation character strings are character strings corresponding to the operation stream, and the character strings may be in a text form or a number form, which is not particularly limited in this exemplary embodiment.
The way to determine that at least two strings are identical between each other may be a standard algorithm using the difflib module in the standard library Python. The difflib module does not need to be installed, the provided algorithm is used for comparing the difference between character strings such as texts, and the output of documents with stronger readability is supported.
Thus, standard algorithms using the difflib model can align operator sub-strings between operator strings two by two. The substring may be the same string between two operation strings.
Specifically, the standard algorithm of the difflib model may first store all the character strings included in the two operation character strings into corresponding sets to obtain two character string sets; then, the intersection of the two character string sets is obtained to obtain the operation substring of the two operation character strings. When the number of the operation character strings is more than 2, the mode of determining the operation sub character strings between every two other operation character strings is the same, and the description is omitted.
For example, when the first string set is { element 1, element 2, element 3}, the second string set is { element 1, element 2, element 4}, and the third string set is { element 2, element 5}, obtaining the intersection of the first operation character string and the second operation character string to obtain the operation substring between the first operation character string and the second operation character string as { element 1, element 2}, obtaining the intersection of the first operation character string and the third operation character string to obtain an operation substring between the first operation character string and the third operation character string as { element 2}, and obtaining the intersection of the second operation character string and the third operation character string to obtain the operator character string between the second operation character string and the third operation character string as { element 2 }. Therefore, the operator sub-strings from which these three operation strings can be obtained are { element 1, element 2}, { element 2}, and { element 2}, respectively.
In step S320, the operation substring is aggregated to obtain an operation aggregated string.
After determining the identical operation substrings between every two operation substrings, the operation substrings may be aggregated to obtain an operation aggregated string, where the operation aggregated string may include at least one operation substring.
For example, when the operator strings of the three operator strings are { element 1, element 2}, { element 2}, and { element 2}, respectively, the aggregate string of the three operator strings can be obtained as { element 1, element 2, and element 2 }.
In step S330, the operation aggregate string is subjected to deduplication processing to obtain a common string.
After obtaining the operation aggregate string, the operation aggregate string may be further subjected to a deduplication process to obtain a common string, which may include at least one different operation substring.
For example, when the operation aggregate string is { element 1, element 2}, performing the de-duplication process on { element 1, element 2}, may result in the common string being { element 1, element 2 }.
In the exemplary embodiment, the method for determining the common character string when at least two operation character strings are provided, and the logic meticulous determination mode ensures the accuracy of the common character string and improves the determination efficiency of the common character string.
In an alternative embodiment, the at least two use case strings include at least two network strings. Fig. 4 shows a flow chart of the steps of a method for obtaining a public string from a network string, as shown in fig. 4, the method at least comprises the following steps: in step S410, a network substring between at least two network strings is determined.
At least two network character strings are character strings corresponding to the network stream, and the character strings may be in a text form or a number form, which is not particularly limited in this exemplary embodiment.
The way of determining the same character string between at least two character strings may also be a standard algorithm using the difflib module in the standard library Python.
Thus, standard algorithms using the difflib model can align two-by-two network substrings between network strings. The network substring may be a string that is the same between two network strings.
For example, when the character string set of the first network character string is {1, 2, 3}, the character string set of the second network character string is {1, 2, 4}, and the character string set of the third network character string is {2, 5}, intersecting the first network character string and the second network character string to obtain a network substring between the first network character string and the second network character string as {1, 2}, intersecting the first network character string and the third network character string to obtain a network substring between the first network character string and the third network character string as {2}, and intersecting the second network character string and the third network character string to obtain a network substring between the second network character string and the third network character string as {2 }. Therefore, the network substrings from which these three network substrings can be obtained are {1, 2}, {2}, and {2}, respectively.
In step S420, the network substrings are aggregated to obtain a network aggregated string.
After the same network substrings between every two network strings are determined, aggregation processing can be performed between the network strings to obtain a network aggregation string, wherein the network aggregation string comprises a plurality of network strings.
For example, when the network substrings of the three network substrings are {1, 2}, {2} and {2}, respectively, the network aggregate substring can be obtained by aggregating the three network substrings to obtain {1, 2 }.
In step S430, the network aggregation character string is subjected to deduplication processing to obtain a common character string.
After obtaining the network aggregation character string, the network aggregation character string may be further subjected to a deduplication process to obtain a common character string, which may include at least one different network aggregation character string.
For example, when the network aggregation string is {1, 2}, performing the de-duplication process on {1, 2} may result in the common string being {1, 2 }.
In the exemplary embodiment, a method for determining a common character string when at least two network character strings are provided, and the accuracy of the common character string is ensured and the determination efficiency of the common character string is improved through a logic meticulous determination mode.
It should be noted that, no matter the common character string corresponding to the operation character string is determined, or the common character string corresponding to the network character string is determined, the unrepeated common character string may also be directly obtained by using other algorithms or manners according to actual situations, and the determination manner of the common character string in the present exemplary embodiment is not particularly limited.
In step S220, the similarity between at least two case strings is calculated to obtain a similarity set.
In an exemplary embodiment of the present disclosure, in addition to determining a common character string between at least two use case character strings, a similarity between the at least two use case character strings may be further calculated.
Fig. 5 and 6 are flowcharts illustrating steps of a method for calculating similarity between an operation string and a network string to obtain a similarity set. Fig. 5 is a flowchart illustrating steps of a method for calculating similarity between operation strings to obtain a similarity set, and fig. 6 is a flowchart illustrating steps of a method for calculating similarity between network strings to obtain a similarity set.
In an alternative embodiment, fig. 5 is a flowchart illustrating steps of a method for obtaining a similarity set of operation strings, as shown in fig. 5, the method at least includes the following steps: in step S510, similarity between at least two operation character strings is calculated by using a similarity algorithm to obtain operation similarity.
The similarity calculation method may also be a standard algorithm of the difflib model, or may also be another algorithm for calculating the similarity, which is not particularly limited in this exemplary embodiment.
Similarity calculation is carried out on the two operation character strings by using a similarity calculation method, so that operation similarity between the two operation character strings can be obtained respectively.
Specifically, the standard algorithm of the difflib model may first perform word segmentation on the two operation strings respectively to obtain word segmentation strings, and then calculate cosine values between the word segmentation strings as corresponding operation similarities.
The word segmentation processing modes of the two operation character strings respectively comprise rule-based word segmentation and statistical-based word segmentation.
The rule-based word segmentation is performed by pre-constructing a dictionary and segmenting words according to a matching mode. The dictionary can be a multivariate grammar N-gram (Chinese language model) dictionary, the operation character strings are matched with the multivariate grammar N-gram dictionary which is constructed in advance according to a word segmentation strategy to obtain a possible segmentation result of each character string, and then a shortest path method based on the multivariate grammar N-gram dictionary is adopted to calculate the final word segmentation character strings.
The word segmentation is carried out by utilizing a classifier constructed by labeled corpus training based on statistical word segmentation. The classifier can be constructed by training using machine learning or deep learning algorithms. Such algorithms may employ Hidden Markov Models (HMMs), conditional random field algorithms (CRFs), deep learning, and the like.
In addition, a plurality of different word segmentation tools can be directly called as word segmentation models, and word segmentation tools of different types are respectively called to perform word segmentation processing on the operation character string to obtain a word segmentation character string. The operation string may also be referred to as a coarse corpus. And calling word segmentation tools with different types to perform primary word segmentation on the operation character string to obtain a plurality of initial word segmentations corresponding to different word segmentation tools, and merging the plurality of initial word segmentations into an initial word segmentation set. At this time, the initial participle set includes more initial participle data, and the number of initial participles can be reduced by voting for each initial participle. The voting process can be obtained according to the word segmentation tool statistics. For example, for a certain initial word segmentation, all three word segmentation tools can segment the initial word segmentation from the original text, and the initial word segmentation is used as a word segmentation character string. If the word segmentation results of the three word segmentation tools for the initial word segmentation are not consistent, directly discarding the initial word segmentation; if the word segmentation results of the two word segmentation tools for the initial word segmentation are consistent, and the word segmentation results of the other word segmentation tool for the initial word segmentation are inconsistent, the initial word segmentation can be determined to be a word segmentation character string.
When a plurality of word segmentation tools are used for word segmentation, the number of initial word segmentation in the initial word segmentation set can be preliminarily reduced through a voting mode, and the effectiveness of the word segmentation character strings is guaranteed.
The word segmentation tool may be an open-source Chinese word segmentation tool, such as Chinese word segmentation in the crust, a Hanlp word segmentation device, a Language Technology Platform (LTP), a Chinese lexical analysis kit (THU lexical Analyzer for Chinese) developed by the university of qinghua in natural Language processing and social human computing laboratory, a stanford word segmentation device, a natural Language processing and information retrieval sharing Platform NLPIR, and the like. These word segmentation tools have respective word segmentation characteristics. For example, the called multiple word segmentation tools can be three word segmentation tools, namely LTP, THULAV and NLPIR, respectively, for performing word segmentation processing on the operation character string.
The word segmentation module of LTP is trained and decoded based on CRF model, which models the target sequence based on the observed sequence, and the data source is the data in the 1-6 month people's daily report of 1998. Initializing by obtaining a file path word segmentation interface, and calling the word segmentation interface to perform word segmentation processing on the operation character string to obtain a word segmentation character string.
The THULAC toolkit trains the original corpus from the onboard model, but requires authorization. The Chinese word segmentation and part-of-speech tagging functions of the THULAC toolkit have the characteristics of strong capability and high accuracy. The method can call the word segmentation sentence to perform word segmentation processing on the operation character string by configuring interface parameters to obtain the word segmentation character string.
The NLPIR tool is a full-chain analysis tool and can perform word segmentation on an operation character string. In the specific word segmentation process, a pre-constructed dictionary needs to be introduced, and the dictionary is called to perform primary segmentation to obtain a segmentation result. Further, a probability statistical method and a simple rule are used for eliminating ambiguous words, word frequency information is used for identifying unknown words, and word segmentation character strings are obtained after ambiguity elimination and identification of the unknown words.
After the segmentation character strings are obtained, cosine values between the segmentation character strings can be calculated as operation similarities.
Cosine similarity measures the similarity between two segmented character strings by measuring the cosine value of the angle between the vectors of the two segmented character strings. The cosine of an angle of 0 degrees is 1 and the cosine of any other angle is not greater than 1 and its minimum is-1, so that the cosine of the angle between two vectors determines whether the two vectors point in approximately the same direction. When the two vectors have the same direction, the cosine similarity value is 1; when the included angle of the two vectors is 90 degrees, the value of the cosine similarity is 0; the cosine similarity has a value of-1 when the two vectors point in completely opposite directions. The result is independent of the length of the vector, only the pointing direction of the vector. Cosine similarity is commonly used in the positive space, and thus gives values between 0 and 1.
The cosine similarity between two participle character strings can be solved by an Euclidean dot product formula:
a·b=‖a‖‖b‖cosθ (1)
given the vectors a and B of the two strings, the cosine similarity θ is derived from the dot product and the vector length:
wherein A isiAnd BiRepresenting the corresponding components of vector a and vector B, respectively.
Therefore, the operation similarity of the first operation character string and the second operation character string is 20%, the operation similarity of the first operation character string and the third operation character string is 31%, and the operation similarity of the second operation character string and the third operation character string is 50%.
It should be noted that the operation similarity may be in the form of a percentage, a decimal, or other numerical value, and this exemplary embodiment is not particularly limited to this.
In step S520, the operation similarity is aggregated to obtain a similarity set.
After the operation similarity between every two operation character strings is obtained, further aggregation processing may be performed to obtain a similarity set, where the similarity set includes at least one operation similarity.
For example, the operation similarity of the first operation character string and the second operation character string is 20%, the operation similarity of the first operation character string and the third operation character string is 31%, and the operation similarity of the second operation character string and the third operation character string is 50%. Further, the three operation similarities are aggregated to obtain a set of similarities of { 20%, 31%, 50% }.
It should be noted that the similarity set may also be in the form of a list or a sequence. When the similarity set is in a sequence form, the similarity set can be sorted according to the operation similarity, so as to determine whether the subsequent verification is finished or not, or can be quickly used in the verification process.
In the exemplary embodiment, the corresponding similarity set can be obtained by respectively calculating the operation similarity between every two operation character strings, the calculation mode is simple and accurate, and the overall learning efficiency is improved in the aspect of the similarity set.
Fig. 6 is a flow chart illustrating steps of a method for calculating similarity between network strings to obtain a similarity set, as shown in fig. 6, the method at least includes the following steps: in step S610, a similarity calculation method is used to calculate the similarity between at least two network character strings to obtain the network similarity.
The similarity calculation method may also be a standard algorithm of the difflib model, or may also be another algorithm for calculating the similarity, which is not particularly limited in this exemplary embodiment.
And performing similarity calculation on the two network character strings by using a similarity calculation method to respectively obtain the network similarity between the two network character strings. The specific calculation method is the same as step S510, and is not described herein again.
For example, the network similarity between the first network string and the second network string is 80%, the network similarity between the first network string and the third network string is 71%, and the network similarity between the second network string and the third network string is 77%.
It should be noted that the form of the network similarity may be a percentage form, a decimal form, or other numerical forms, and this exemplary embodiment is not particularly limited to this.
In step S620, a similarity set is obtained by aggregating the network similarities.
After the network similarity between every two network character strings is obtained, aggregation processing can be further performed to obtain a similarity set.
For example, the network similarity between the first network string and the second network string is 80%, the network similarity between the first network string and the third network string is 71%, and the network similarity between the second network string and the third network string is 77%. Further, the three network similarities are aggregated to obtain a set of similarities of { 80%, 71%, 77% }.
It should be noted that the similarity set may also be in the form of a list or a sequence. When the similarity set is in a sequence form, the similarity set can be sorted according to the size of the network similarity, so as to determine whether the subsequent verification is finished or not, or can be quickly used in the verification process.
In the exemplary embodiment, the corresponding similarity set can be obtained by respectively calculating the network similarity between every two network character strings, the calculation mode is simple and accurate, and the overall learning efficiency is improved in the aspect of the similarity set.
It should be noted that, no matter whether the operation similarity between the operation character strings is calculated to obtain the similarity set or the network similarity between the network character strings is calculated to obtain the similarity set, other algorithms or manners may also be used to obtain the similarity set according to the actual situation, and the calculation manner of the similarity set in this exemplary embodiment is not particularly limited.
After the common character strings and the similarity sets of the at least two use case character strings are determined, the common character strings and the similarity sets learned at the time can be further verified. When the verification result shows that the public character string and the similarity set do not change any more, the learning is determined to be finished at the moment, and the public character string and the similarity set do not need to be updated; when the verification result shows that the common character string and the similarity set are not stable, the common character string and/or the similarity set need to be updated.
In an alternative embodiment, fig. 7 shows a flow chart of the steps of a method of updating a common string and a similarity set, as shown in fig. 7, the method comprising at least the steps of: in step S710, verification strings corresponding to at least two use case strings are acquired.
The verification character string may be obtained by copying one of at least two use case character strings, or may be a character string corresponding to an operation stream or a network stream generated by playing back a test case once again.
It is worth mentioning that when the common character string or the similarity set obtained according to the operation character string is to be verified, the verification character string is the character string obtained by copying or according to the operation flow of the test case; when the common character string or the similarity set obtained according to the network character string is to be verified, the verification character string is the character string obtained by copying or according to the network flow of the test case.
In step S720, the common character string and the similarity set are updated with the verification character string.
In an alternative embodiment, fig. 8 shows a flowchart of the steps of a method for updating a common string and a similarity set according to a comparison result, as shown in fig. 8, the method at least comprises the following steps: in step S810, a verification common string and a verification similarity set of at least two use case strings and verification strings are determined.
When the verification character string is determined, the character string for determining the verification public character string comprises a newly added verification character string besides at least two use case character strings. The determination method of verifying the public character string is the same as the determination method of the public character string in step S210, and is not described herein again.
Correspondingly, the character string for determining the verification similarity is additionally provided with a verification character string besides at least two use case character strings. The way of calculating the similarity between at least two case strings and verification strings to obtain the verification similarity set is the same as the way of obtaining the similarity set in step S220, and is not repeated here.
In step S820, the common character string is compared with the common comparison result obtained by verifying the common character string, and the similarity set is compared with the verification similarity set to obtain a similarity comparison result.
The common character string and the verified common character string may be compared in a manner that compares whether there is a difference therebetween to obtain a common comparison result. The way in which the difference exists includes, but is not limited to, whether the number of the common character strings is the same as the number of the verification common character strings, whether the common character strings are identical to the character strings in the verification common character strings, and the like.
And the comparison mode between the similarity set and the verification similarity set can also be whether a difference exists between the two to obtain a similarity comparison result. The ways in which the difference exists include, but are not limited to, whether the number of similarities in the similarity set and the verification similarity is the same, whether the similarities in the similarity set and the verification similarity set are consistent, and the like.
In step S830, the common character string and the similarity set are updated according to the common comparison result and the similarity comparison result.
In an alternative embodiment, fig. 9 shows a flow chart of steps of a method for further updating the common character string and the similarity set according to the comparison result, as shown in fig. 9, the method at least comprises the following steps: in step S910, if the common comparison result indicates that the common character string is different from the verified common character string, the common character string is updated.
If the public comparison result of the public character string and the verification public character string is that the public character string and the verification public character string have differences, the public character string can be updated. The update mode may be to replace the public character string with the verified public character string to make a new public character string, or to add a character string that does not have the verified public character string to the public character string, or to add another update mode.
In step S920, if the similarity comparison result indicates that the similarity set is different from the verification similarity set, the similarity set is updated.
If the similarity comparison result between the similarity set and the verification similarity set indicates that the similarity set and the verification similarity set are different, the similarity set can be updated. The update mode may be to replace the similarity set with the verification similarity set as a new similarity set, add a similarity that does not exist in the similarity set in the verification similarity set to the similarity set, or add another update mode, which is not particularly limited in this exemplary embodiment.
It should be noted that, when the common comparison result indicates that the common character string is different from the verified common character string, only the common character string may be updated, or the common character string and the similarity set may be updated simultaneously; when the similarity comparison result shows that the similarity set is different from the verification similarity set, only the similarity set may be updated, or the similarity set and the common character string may be updated simultaneously.
After the public character string and/or the similarity set are updated, in order to determine whether the updated public character string and the similarity set are stable, the character string to be verified can be continuously obtained to perform a new round of verification and update until the number of times of verification is met, the public character string and the similarity set do not change in each round of verification, and the learning is finished.
Or when the common comparison result indicates that no difference exists between the common character string and the verification common character string and the similarity comparison result indicates that no difference exists between the similarity set and the verification similarity set, the new character string to be verified can be continuously obtained to perform a new round of verification until the number of times of verification is met, the common character string and the similarity set do not change in each round of verification, and the end of learning is determined.
In the exemplary embodiment, after the common character string and the similarity set are determined, the common character string and the similarity set may be updated to stabilize the common character string and the similarity set, so as to provide a data base for a subsequent verification process, and ensure accuracy of a verification result.
In step S230, a to-be-verified character string obtained by executing the test case is obtained, and the to-be-verified character string is verified by using the common character string and the similarity set, so as to obtain a verification result of the test case.
In an exemplary embodiment of the present disclosure, the character string to be verified may be a character string corresponding to an operation flow or a network flow obtained by executing the test case when the function to be tested of the test case is changed or available for verification.
After the character string to be verified is obtained, the common character string and the similarity set can be used for verifying the character string to be verified, so that the test case can be verified.
In an alternative embodiment, fig. 10 is a flowchart illustrating steps of a method for performing verification by using a common character string and a similarity set at the same time, and as shown in fig. 10, the method at least includes the following steps: in step S1010, the number of character strings of the common character string is obtained, and the number to be checked of the character strings to be checked is obtained.
The number of character strings may be a number that characterizes non-repetitive character strings included in the common character string.
For example, when the common character string is obtained according to at least two operation character strings, and the common character string is { element 1, element 2, element 3}, the number of the character strings at this time can be counted to be 3; when the public character string is obtained according to at least two network character strings and the public character string is {1, 2, 3, 4}, the number of the character strings at this time can be counted to be 4.
And the number to be checked is the number of the non-repeated character strings contained in the character strings to be checked. For example, when the string to be checked is { element 1, element 2}, the number to be checked is 2; when the character strings to be checked are {1, 2 and 3}, the number to be checked is 3.
In addition, the number to be checked may be the number of all the character strings in the character string to be checked counted under the requirement of the actual situation. That is, in the statistical process, whether the character strings in the character string to be verified are repeated or not is not distinguished, and the character strings are all counted in the statistical result of the number to be verified.
In step S1020, if the to-be-verified character string includes a common character string and the number of the character strings is smaller than the number to be verified, a to-be-verified similarity set corresponding to the to-be-verified character string is determined.
And matching the public character string with the character string to be checked, namely determining whether each character string in the public character string also exists in the character string to be checked. When it is determined that each of the character strings in the common character string exists in the character string to be checked, it may be determined that the character string to be checked includes the common character string.
Further, the number of the character strings is compared with the number to be checked. When the number of the character strings is less than the number to be checked, the common character strings and the character strings to be checked are indicated to have character strings of common parts and character strings of different parts.
In order to further verify whether the character strings of the difference part can also realize the function of the test case, a similarity set to be verified corresponding to the character strings to be verified can be further determined.
The similarity set to be verified may be obtained by calculating the similarity between the string to be verified and each of the at least two use case strings, and the calculation method is the same as the method for calculating the similarity set in step S220, and is not described herein again.
In step S1030, the similarity set to be verified is verified to obtain a verification result of the test case.
In an alternative embodiment, fig. 11 shows a flow chart of the steps of a method of obtaining a check result, as shown in fig. 11, the method comprising at least the steps of: in step S1110, if the similarity set includes a similarity set to be verified, it is determined that the verification result of the test case is verification success.
And when the similarity set comprises each similarity in the similarity set to be verified, determining that the similarity set comprises the similarity set to be verified, and determining that the verification result of the test case is verification success through verification of the character string to be verified.
In step S1120, if the similarity set does not include the similarity set to be verified, it is determined that the verification result of the test case is verification failure.
And when the similarity set does not comprise each similarity in the similarity set to be verified, determining that the similarity set does not comprise the similarity set to be verified, and determining that the verification result of the test case is verification failure through the verification of the character string to be verified.
In the exemplary embodiment, the verification result of the test case can be determined through the verification result between the similarity set and the similarity set to be verified, the verification mode is high in accuracy, and the verification efficiency is improved.
When the character string rule of the difference part between the public character string and the character string to be checked is changed, the check can be carried out by only utilizing the public character string and the similarity set. When the character strings of the difference part between the public character strings and the similarity to be verified are changed randomly, the fluctuation parameters can be obtained to be verified together.
In an alternative embodiment, fig. 12 shows a flow chart of the steps of a method for verification with fluctuating parameters, as shown in fig. 12, the method comprising at least the following steps: in step S1210, a fluctuation parameter corresponding to the similarity set is acquired.
The fluctuation parameter is a threshold value allowing the similarity to fluctuate up and down, and may be preset, or may be calculated according to the public character string and the character string to be verified, or may be determined according to other manners, which is not particularly limited in this exemplary embodiment.
In step S1220, the similarity set to be verified is verified by using the similarity set and the fluctuation parameter, so as to obtain a verification result.
When the similarity to be verified is verified by using the similarity and the fluctuation parameter, it may be determined whether the similarity set includes the similarity set to be verified according to the method shown in fig. 11.
If the similarity set does not include each similarity in the similarity set to be checked, a difference value can be made between the similarity in the similarity set and the similarity in each similarity set to be checked, and whether the difference value is smaller than the fluctuation parameter is judged.
If the difference values are smaller than the fluctuation parameters, the verification result of the test case is determined to be successful; if individual or all the mean values are not smaller than the fluctuation parameters, the verification result of the test case can be determined to be verification failure.
In the exemplary embodiment, the common character string, the similarity set and the fluctuation parameter are used for verifying the character string to be verified to determine the verification result of the test case, so that the verification accuracy and efficiency are improved, and the application scene of the verification method is enriched.
Besides the common character string and the similarity set are used for checking at the same time, or the common character string, the similarity set and the fluctuation parameter are used for checking at the same time, the checking can be carried out only according to the common character string.
In an alternative embodiment, fig. 13 shows a flow chart of the steps of a method for verification using a common string, as shown in fig. 13, the method comprising at least the steps of: in step S1310, the number of character strings of the common character string is acquired, and the number of character strings to be checked is acquired.
The string number may be the number of common strings that characterize an unrepeated string.
In step S1320, if the to-be-verified string includes the common string and the number to be verified is equal to the number of the strings, it is determined that the verification result of the test case is successful.
And matching the public character string with the character string to be checked, namely determining whether each character string in the public character string also exists in the character string to be checked. When it is determined that each of the character strings in the common character string exists in the character string to be checked, it may be determined that the character string to be checked includes the common character string.
Further, the number of the character strings is compared with the number to be checked. When the number of the character strings is equal to the number to be verified, the public character strings and the character strings to be verified are completely the same, and then the test case can be further determined to be verified successfully.
In the exemplary embodiment, the common character string is used for verifying the character string to be verified to determine the verification result of the test case, so that the verification accuracy and efficiency are improved, and the application scene of the verification method is enriched.
The following describes in detail a test case verification method provided in the embodiments of the present disclosure with reference to a specific application scenario.
Fig. 14 is a flowchart illustrating steps of a method for verifying a test case in an application scenario, and as shown in fig. 14, in step S1401, a replay learning task is issued.
Fig. 15 is a schematic diagram of an interface for setting a recording scene in an application scene, and as shown in fig. 15, when a tester sets the recording scene as ONLINE, the server issues a learning task to the task table.
Fig. 16 shows an interface diagram of a learning Task in an application scenario, and as shown in fig. 16, the name of the learning Task is Scene Auto learning Task, the Scene identifier (Scene list) is 41, and the product identifier (product id) is 4.
Further, the playback engine may obtain the current product identifier 4 from the server according to the name Scene Auto spare Task of the learning Task. Then, the task information of the currently unexecuted task can be pulled through the product identifier 4. The task information may include a scene identifier and information indicating that the task is a learning (Learn) task or a verification (Verify) task, and may also include other task information, which is not particularly limited in this exemplary embodiment.
The time interval for the playback engine to obtain the current product identifier is 1 second, and other time lengths may also be set, which is not particularly limited in this exemplary embodiment. The playback engine may support two categories of tasks, the Learn's task and the Verify's task. And when the task is executed each time, the operation flow and the network flow under the scene can be pulled from the server through the scene identification, and accurate playback is carried out.
In step S1402, the playback engine reports the text to be verified when executing the playback engine.
During the process of executing the operation flow and the network flow by the playback engine, text corresponding to the operation flow and text corresponding to the network flow, that is, at least two use case character strings, may be generated. And reporting at least two use case character strings to the server.
Fig. 17 is a schematic interface diagram illustrating at least two character strings in an application scenario, where, as shown in fig. 17, the at least two character strings are operation character strings of an operation flow. The operation flow character string is the content corresponding to text, and is 6, 4, 3, 2, SMB client list, client management, client operation and INPUT respectively.
Fig. 18 is a schematic interface diagram of another at least two character strings in an application scenario, where as shown in fig. 18, the at least two character strings are network character strings corresponding to a network stream. The network character string is the content corresponding to text, which is { \\ table _ name \ client _ ka _ smb \ … … }, { \ "table _ name \ lab _ router \ … … }, { \" table _ name \ ", … … } and { \\" table _ name \ subplier ", … … }, respectively.
In step S1403, the text common part learns.
In an application scenario, when the number of at least two use case strings exceeds 3, execution of a learning task may be triggered.
The learning mode of the public part can be that the difflib modules are used for pairwise comparison to obtain sub-character strings between at least two use case character strings. When the at least two use case character strings are at least two operation character strings, the sub character string is an operation sub character string; and when the at least two use case character strings are at least two network character strings, the substring is a network substring.
In step S1404, the text difference similarity section learns.
The learning of the difference similarity part may be a similarity algorithm such as a standard algorithm of the difflib model. Similarity calculation is carried out on the two operation character strings by using a similarity calculation method, so that operation similarity between the two operation character strings can be obtained respectively. Correspondingly, similarity calculation is carried out on the two network character strings by using a similarity calculation method, so that the network similarity between the two network character strings can be respectively obtained.
In step S1405, the text common substrings are aggregated.
After the operation substrings are obtained, performing aggregation processing on the operation substrings to obtain operation aggregated character strings; after the network substrings are obtained, aggregation processing may be performed between the network substrings to obtain a network aggregated string.
If the character strings in the operation aggregation character string or the network aggregation character string have repeated parts, the common character string can be obtained through deduplication processing.
In step S1406, the text difference similarity portions are aggregated.
After the operation similarity is obtained, aggregation processing may be performed to obtain a similarity set. Correspondingly, after the network similarity is obtained, aggregation processing can be performed to obtain a similarity set.
In step S1407, a common substring pattern is determined.
After the public character string is obtained, a verification character string can be added to judge whether the public character string changes. If the public character string changes, the public character string can be updated, and a new round of verification is started until the public character string does not change for 3 times continuously.
In step S1408, the difference portion mode is determined.
Similarly, whether the similarity list changes or not can be judged by using the newly added verification character string. If the similarity list changes, the similarity list can be updated, and the verification is carried out in a new round in the sick period until the similarity list does not change for 3 times.
In step S1409, the text mode is stored.
When the common character string and the similarity list do not change any more continuously for 3 times at the same time, indicating that the learning task is finished, the common character string and the similarity set may be stored in a fixed format, i.e., a text mode, for example, in a database.
Fig. 19 is a schematic diagram illustrating an interface stored in a text mode in an application scenario, and as shown in fig. 19, at least two learned operation character strings are stored in the text mode.
For example, the specific format of the text schema may be:
{
"now_time":"2020-09-28 19:52:36",
"text_list":["6"],
"result":[
["6"],
[]
],
"wave_num":5//
}
wherein, the now _ time is the time of learning ending, the text _ list is the case character string used during learning, the result comprises the common character string and the similarity in the similarity set, and the wave _ num is the fluctuation parameter corresponding to the test case. When wave _ num is 5, the values of the characterization similarity in the range of 5 are determined to be successful, otherwise, the verification fails.
Further, when the playback engine receives the Verify task, the to-be-verified character string may be imported into a verification table in the server. When the text verification engine in the server finds that the character string to be verified exists in the verification table, the algorithm of the verification task can be executed.
In step S1410, a string to be verified obtained by executing the test case, that is, a text generated by the network request stream, is obtained. Wherein the text stream is the determined common character string and similarity set.
Fig. 20 is a schematic diagram illustrating a verifiable scenario of a verification method of a test case, where as shown in fig. 20, the verifiable scenario first includes an identical scenario. The verification of the identical scene may be verified only by the common character string.
In step S1411, the common substrings are all present.
And acquiring the number of the character strings of the public character string, and acquiring the number to be checked of the character strings to be checked. And then, if the character strings to be verified comprise the public character strings and the number of the character strings to be verified is equal to the number of the character strings, determining that the verification result of the test case is successful.
But when the character strings to be verified comprise the public character strings and the number of the character strings is less than the number to be verified, the similarity set is further used for verification.
Therefore, the verifiable scenario in fig. 20 also includes a partial difference scenario. When the partial difference scene is that the difference partial rule changes, the verification can be further performed by only utilizing the similarity set.
In step S1412, a similarity difference is calculated.
And determining a similarity set to be checked corresponding to the character string to be checked. The similarity set to be verified can be obtained by calculating the similarity between the character string to be verified and at least two case character strings.
When the similarity set comprises each similarity in the similarity set to be verified, determining that the similarity set comprises the similarity set to be verified, and determining that the verification result of the test case is successful through the verification of the character string to be verified; and when the similarity set does not comprise each similarity in the similarity set to be verified, determining that the similarity set does not comprise the similarity set to be verified, and determining that the verification result of the test case is verification failure through the verification of the character string to be verified.
In addition, the verifiable scenario in fig. 20 also includes a partial difference scenario in which the difference portion changes randomly, and the fluctuation parameter may be acquired again for verification.
In step S1413, the similarity fluctuation match verification.
When the similarity to be verified is verified by using the similarity and the fluctuation parameter, it may be determined whether the similarity set includes the similarity set to be verified according to the method shown in fig. 11.
If the similarity set does not include each similarity in the similarity set to be checked, the similarity in the similarity set and the similarity in the similarity set to be checked may be differentiated by two, and whether the difference is smaller than the fluctuation parameter is determined.
If the difference values are smaller than the fluctuation parameters, the verification result of the test case is determined to be successful; if individual or all the mean values are not smaller than the fluctuation parameters, the verification result of the test case can be determined to be verification failure.
In step S1414, the single-operation text results are aggregated.
If a plurality of identical scenes exist, the plurality of identical scenes can be verified one by one according to the verification mode of the identical scenes, and the plurality of single verification results are aggregated to obtain the verification results of the plurality of identical scenes.
In step S1415, the single-operation network requests result aggregation.
When a plurality of partial difference scenes exist, the verification can be performed according to the verification modes of the two partial difference scenes one by one, and the multiple single verification results are aggregated to obtain the verification results of the multiple partial difference scenes.
In step S1416, the single scene results are aggregated.
And aggregating the verification results of the completely same scene and the partially different scenes to obtain the verification results of all the final verification scenes.
It can be seen that steps S1401-S1409 are learning portions for which new playback scenes are binned, and steps S1410-S1416 are verification portions for which tests are performed for new scenes.
Fig. 21 is a schematic interface diagram illustrating a record of checking a to-be-checked character string in an application scenario, where, as shown in fig. 21, state _ text is a check state, and text is a to-be-checked character string.
Fig. 22 is a schematic interface diagram illustrating all verification results in an application scenario, and as shown in fig. 22, state _ text indicates SUCCESS of verification of the SUCCESS token, and state _ text indicates failure of verification of the fault token.
FIG. 23 shows a result diagram of steps of an example of a verification method for an application test case, as shown in FIG. 23, at least two use case strings include 4 use case strings, which are ' { "platform": pc ', "reqid": bc319c38-7009-4d2b-ad75-b2266037eee ', "conserenced ': 5ed10d0372101c6d5a4b130c ' } ', ' {" platform ": pc '," reqid ": cfc 58151 aa-a886-4184-bfa2-10fd9709f263 '," conserenced ": 5ed10d0372101c6d5a4b130c ' } ' {" platform ": pc '," reqid ": 8a986 5-d 68640-187-c 5a4b130 ': 357 ': 645 b 467 ': 647 ': 645 b 467 ' c 19 b 467 ': 647 ' c 16 b 467 ': 6416 b 467 ' c 16 b 467 ': 6416 b 468 b 467 '.
A common string of the four use case strings is determined to be { "platform": pc "," reqid ": consenceced": 5ed10d0372101c6d5a4b130c ", and the similarity set is {74,77,70,74,74,76 }.
The character strings to be checked obtained by obtaining the execution test case are '{ "platform": pc', 'reqid': fjd5md74-fqce-deac-b983-3c5a98c4f3ca ',' conflenceld ': 5ed10d0372101c6d5a4b130 c'.
The character string to be verified can be verified by utilizing the public character string to obtain the character string to be verified including the public character string, and the similarity set is determined to be {77,76,78,73 }. Moreover, the fluctuation parameter c may be set to 1, so that it can be ensured that the similarity set to be verified corresponding to the character string to be verified belongs to the similarity set, that is, it is ensured that the verification result of the test case is successful.
Based on the application scenarios, on one hand, the common character string and the similarity set of at least two case character strings are determined, so that the method is a self-learning case verification mode, the operation process is automatic and intelligent, codes do not need to be written, and the verification efficiency of the character strings of the test cases is improved; on the other hand, the common character string and the similarity set are used for verifying the character string to be verified, manual participation is not needed, and the reliability and the accuracy of character string verification are improved.
It should be noted that although the various steps of the methods of the present disclosure are depicted in the drawings in a particular order, this does not require or imply that these steps must be performed in this particular order, or that all of the depicted steps must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions, etc.
The following describes an embodiment of an apparatus of the present disclosure, which may be used to execute a verification method for a test case in the foregoing embodiment of the present disclosure. For details not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the method for verifying the test case of the present disclosure.
Fig. 24 schematically illustrates a block diagram of a structure of a verification apparatus for a test case in some embodiments of the present disclosure, and as shown in fig. 24, the verification apparatus 2400 for a test case may mainly include: a common part module 2410, a difference calculation module 2420 and a check execution module 2430.
A common part module 2410 configured to obtain at least two case character strings corresponding to the test cases and determine a common character string of the at least two case character strings; a difference calculating module 2420 configured to calculate the similarity between every two of the at least two case character strings to obtain a similarity set; the verification execution module 2430 is configured to obtain a to-be-verified character string obtained by executing the test case, and verify the to-be-verified character string by using the common character string and the similarity set to obtain a verification result of the test case.
In some embodiments of the present disclosure, the check execution module includes: the number determining submodule is configured to obtain the number of the character strings of the public character string and obtain the number to be checked of the character strings to be checked;
the set determining submodule is configured to determine a similarity set to be checked corresponding to the character string to be checked if the character string to be checked comprises a public character string and the number of the character strings is smaller than the number to be checked;
and the set checking submodule is configured to check the similarity set to be checked by using the similarity set to obtain a checking result of the test case.
In some embodiments of the present disclosure, the set check submodule comprises: the verification success unit is configured to determine that the verification result of the test case is verification success if the similarity set comprises a similarity set to be verified;
and the verification failure unit is configured to determine that the verification result of the test case is verification failure if the similarity set does not include the similarity set to be verified.
In some embodiments of the present disclosure, the set check submodule includes: a parameter acquisition unit configured to acquire a fluctuation parameter corresponding to the similarity set;
and the random checking unit is configured to check the similarity set to be checked by utilizing the similarity set and the fluctuation parameter to obtain a checking result.
In some embodiments of the present disclosure, the apparatus for verifying a test case further includes: the number determining module is configured to obtain the number of the character strings of the public character string and obtain the number to be checked of the character strings to be checked;
and the same checking module is configured to determine that the checking result of the test case is successful if the to-be-checked character string comprises the public character string and the to-be-checked number is equal to the number of the character strings.
In some embodiments of the present disclosure, the apparatus for verifying a test case further includes: the verification updating module is configured to acquire verification character strings corresponding to at least two use case character strings;
a set update module configured to update the common string and the similarity set with the validation string.
In some embodiments of the present disclosure, based on the above technical solutions, the set updating module includes: the set determining submodule is configured to determine a verification common character string and a verification similarity set of at least two use case character strings and verification character strings;
the set comparison submodule is configured to compare the public character string with the verification public character string to obtain a public comparison result, and compare the similarity set with the verification similarity set to obtain a similarity comparison result;
and the comparison result submodule is configured to update the common character string and the similarity set according to the common comparison result and the similarity comparison result.
In some embodiments of the disclosure, the comparison result sub-module comprises: the public updating unit is configured to update the public character string if the public comparison result shows that the public character string is different from the verification public character string; and/or
And the difference updating unit is configured to update the similarity set if the similarity comparison result shows that the similarity set is different from the verification similarity set.
In some embodiments of the disclosure, a common portion module, comprises: an operation determining submodule configured to determine an operation substring between two of the at least two operation strings;
the operation aggregation sub-module is configured to aggregate the operation substrings to obtain operation aggregation character strings;
and the operation duplication removing sub-module is configured to carry out duplication removing processing on the operation aggregation character string to obtain a public character string.
In some embodiments of the disclosure, the difference calculation module comprises: the operation similarity submodule is configured to calculate the similarity between every two at least two operation character strings by using a similarity algorithm to obtain operation similarity;
and the operation set submodule is configured to aggregate the operation similarity to obtain a similarity set.
In some embodiments of the disclosure, a common portion module, comprises: a network determination submodule configured to determine a network substring between two of the at least two network strings;
the network aggregation sub-module is configured to aggregate the network substrings to obtain network aggregation character strings;
and the network duplication removal sub-module is configured to carry out duplication removal processing on the network aggregation character string to obtain a public character string.
In some embodiments of the disclosure, the difference calculation module comprises: the network similarity submodule is configured to calculate the similarity between every two at least two network character strings by using a similarity algorithm to obtain the network similarity;
and the network set submodule is configured to aggregate the network similarity to obtain a similarity set.
The specific details of the verification device for test cases provided in the embodiments of the present disclosure have been described in detail in the corresponding method embodiments, and therefore are not described herein again.
FIG. 25 illustrates a schematic structural diagram of a computer system suitable for use in implementing the electronic device of an embodiment of the present disclosure.
It should be noted that the computer system 2500 of the electronic device shown in fig. 25 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments of the present disclosure.
As shown in fig. 25, the computer system 2500 includes a Central Processing Unit (CPU)2501 that can perform various appropriate actions and processes in accordance with a program stored in a Read-Only Memory (ROM) 2502 or a program loaded from a storage section 2508 into a Random Access Memory (RAM) 2503. In the RAM 2503, various programs and data necessary for system operation are also stored. The CPU2501, ROM 2502, and RAM 2503 are connected to each other via a bus 2504. An Input/Output (I/O) interface 2505 is also connected to the bus 2504.
The following components are connected to the I/O interface 2505: an input portion 2506 including a keyboard, a mouse, and the like; an output portion 2507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like; a storage portion 2508 including a hard disk and the like; and a communication section 2509 including a Network interface card such as a LAN (Local Area Network) card, a modem, or the like. The communication section 2509 performs communication processing via a network such as the internet. A driver 2510 is also connected to the I/O interface 2505 as needed. A removable medium 2511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 2510 as necessary, so that a computer program read out therefrom is installed in the storage portion 2508 as necessary.
In particular, the processes described in the various method flowcharts may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via communications portion 2509, and/or installed from removable media 2511. The computer program executes various functions defined in the system of the present application when executed by a Central Processing Unit (CPU) 2501.
It should be noted that the computer readable medium shown in the embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a Read-Only Memory (ROM), an Erasable Programmable Read-Only Memory (EPROM), a flash Memory, an optical fiber, a portable Compact Disc Read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer-readable signal medium may include a propagated data signal with computer-readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:模块的测试方法、计算机设备和存储介质