Disclosure of Invention
Therefore, it is necessary to provide a website testing method, an apparatus, a computer device, and a storage medium capable of improving the website testing efficiency, in order to solve the problem of low testing efficiency of the existing website testing method.
The website testing method in the embodiment of the invention comprises the following steps:
acquiring a log to be detected; the log to be detected is a log generated by testing a website;
extracting text paragraph features in the log to be detected; the text paragraph features are features corresponding to text paragraphs of the log to be detected;
classifying the text paragraph features to obtain an abnormal classification result; and determining the abnormal type of the website according to the abnormal classification result.
In one embodiment, the extracting text paragraph features in the log to be detected includes:
acquiring a text paragraph in the log to be detected;
inputting the text paragraphs into a pre-trained feature extraction model, and determining target paragraph vectors corresponding to the text paragraphs according to output results of the pre-trained feature extraction model;
and taking the target paragraph vector corresponding to the text paragraph as the text paragraph feature.
In one embodiment, the acquiring a text paragraph in the log to be detected includes:
determining paragraphs to be spliced in the log to be detected; wherein, the paragraph to be spliced is provided with a plurality of paragraphs;
and splicing the paragraphs to be spliced to obtain the text paragraphs in the log to be detected.
In one embodiment, the inputting the text paragraphs into a pre-trained feature extraction model, and determining a target paragraph vector corresponding to the text paragraph according to an output result of the pre-trained feature extraction model includes:
in the text passage, determining a target prediction word and a sample word; wherein the target predicted word is a word in any one of the plurality of words; the sample word is a word in the plurality of words other than the target predicted word;
generating an initial paragraph vector of the text paragraph, and obtaining a word vector corresponding to the sample word;
inputting the initial paragraph vector and the word vector corresponding to the sample word into the pre-trained feature extraction model to generate a predicted word; the predicted words are words obtained by predicting words except the sample words in the plurality of words by the pre-trained feature extraction model;
adjusting the initial paragraph vector according to the predicted word and the target predicted word to obtain an adjusted initial paragraph vector;
and taking the adjusted initial paragraph vector as a target paragraph vector corresponding to the text paragraph.
In one embodiment, the text paragraph features are classified to obtain an abnormal classification result; and according to the abnormal classification result, determining the abnormal type of the website, including:
inputting the text paragraph features into a pre-trained abnormal type classification model; the pre-trained abnormal type classification model is used for classifying the text paragraph features and outputting a corresponding abnormal classification result;
determining the abnormal type of the website according to the abnormal classification result output by the pre-trained abnormal type classification model;
or
Acquiring paragraph vectors corresponding to a plurality of abnormal paragraph features;
calculating the vector distance between the paragraph vector corresponding to the text paragraph feature and the paragraph vector corresponding to each abnormal paragraph feature as the feature similarity between the text paragraph feature and each abnormal paragraph feature;
classifying the text paragraph features according to the feature similarity to obtain the abnormal classification result, and determining the abnormal type of the website according to the abnormal classification result.
In one embodiment, the method further comprises the following steps:
constructing an abnormal type classification model to be trained;
obtaining a text paragraph feature sample as a training sample of the abnormal type classification model to be trained;
determining an abnormal type corresponding to the text paragraph feature sample as a classification label of the text paragraph feature sample;
training the abnormal type classification model to be trained according to the text paragraph feature sample and the abnormal type corresponding to the text paragraph feature sample to obtain a trained abnormal type classification model;
and taking the trained abnormal type classification model as the pre-trained abnormal type classification model.
In one embodiment, the method further comprises the following steps:
acquiring an original log;
and filtering irrelevant data in the original log by adopting a preset regular expression to obtain the log to be detected.
In one embodiment, the method further comprises the following steps:
inquiring an exception removing guide corresponding to the exception type according to the exception type of the log to be detected;
and pushing the exception eliminating guide to a user side so that the user can eliminate the exception existing in the website according to the exception eliminating guide.
In one embodiment, the method further comprises the following steps:
acquiring memory data corresponding to the trained abnormal type classification model;
serializing the memory data to obtain a data serialization file corresponding to the trained abnormal type classification model;
and storing the data serialization file.
In an embodiment of the present invention, a website testing apparatus includes:
the acquisition module is used for acquiring the log to be detected; the log to be detected is a log generated by testing a website;
the extraction module is used for extracting the text paragraph characteristics in the log to be detected; the text paragraph features are features corresponding to text paragraphs of the log to be detected;
the classification module is used for classifying the text paragraph features to obtain an abnormal classification result; and determining the abnormal type of the website according to the abnormal classification result.
The computer device in the embodiment of the invention comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the following steps when executing the computer program:
acquiring a log to be detected; the log to be detected is a log generated by testing a website;
extracting text paragraph features in the log to be detected; the text paragraph features are features corresponding to text paragraphs of the log to be detected;
classifying the text paragraph features to obtain an abnormal classification result; and determining the abnormal type of the website according to the abnormal classification result.
A computer-readable storage medium in an embodiment of the present invention, on which a computer program is stored, the computer program, when executed by a processor, implementing the steps of:
acquiring a log to be detected; the log to be detected is a log generated by testing a website;
extracting text paragraph features in the log to be detected; the text paragraph features are features corresponding to text paragraphs of the log to be detected;
classifying the text paragraph features to obtain an abnormal classification result; and determining the abnormal type of the website according to the abnormal classification result.
In the website testing method, the website testing device, the computer equipment and the storage medium in the embodiment, the log to be tested generated by testing the website is obtained; then, extracting the characteristics corresponding to the text paragraphs in the log to be detected to obtain the characteristics of the text paragraphs; then, classifying the text paragraph features to obtain an abnormal classification result; and according to the abnormal classification result, the abnormal type of the website is determined, so that the automatic test of the website test logs with different formats can be flexibly realized, a tester does not need to spend a large amount of time to read the analysis logs with various and complicated contents to determine the abnormal type of the website, and the test efficiency of the website is improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The website testing method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. The server 110 first obtains a log to be detected; the log to be detected is a log generated by testing a website; then, the server 110 extracts the text paragraph features in the log to be detected; the text paragraph features are features corresponding to text paragraphs of the log to be detected; finally, the server 110 identifies the abnormal type of the website according to the text paragraph characteristics. In practical application. The server 110 may be implemented as a stand-alone server or as a server cluster comprising a plurality of servers.
In one embodiment, as shown in fig. 2, there is provided a website testing method, including the steps of:
s210, acquiring the log to be detected.
The log to be detected can be a website test log waiting for detecting the website abnormity type
The log to be detected is a log generated by testing the website.
In specific implementation, a tester can test the manufactured website through a pre-written test script. The test script tests various functions of the website, such as a pressure test, a connection speed test, a load test or a safety test. When the test script tests that the website has errors or abnormalities, the test script generates a corresponding website test log for the website. And finally, determining the log to be detected according to the website test log so that the server 110 can obtain the log to be detected.
S220, extracting the text paragraph features in the log to be detected.
The text paragraph features are features corresponding to each text paragraph in the log to be detected.
In a specific implementation, after the server 110 obtains the log to be detected, the server 110 analyzes the log to be detected, and determines each text paragraph in the log to be detected. Then, the server 110 performs feature extraction on each text paragraph in the log to be detected, so as to obtain a feature corresponding to each text paragraph in the log to be detected, and names the feature corresponding to each text paragraph in the log to be detected as a text paragraph feature.
In practical application, the server 110 may specifically perform preprocessing on each text paragraph in the log to be detected and input the preprocessed text paragraph into a pre-trained feature extraction neural network during feature extraction of each text paragraph in the log to be detected, extract features corresponding to each text paragraph through the feature extraction neural network, and finally extract an output result of the neural network according to the features, where the features of the text paragraphs in the log to be detected are extracted.
S230, classifying the text paragraph features to obtain an abnormal classification result; and determining the abnormal type of the website according to the abnormal classification result.
The exception type may refer to an error or exception type occurring when the website tests. In practical applications, the exception types may include error reporting during website execution, error reporting during website configuration, and error reporting in website environment. Website product line error reporting, etc.
In a specific implementation, after the server 110 extracts the text paragraph features in the log to be detected, the text paragraph features may be used as input parameters of a pre-trained log classification model, input into the pre-trained log classification model, and then obtain an abnormal classification result output by the pre-trained log classification model; finally, the server 110 determines the abnormal type of the website according to the abnormal classification result.
In practical applications, the pre-trained log classification model may be an SVM (Support Vector Machine). SVMs are a class of classifiers that classify data in a supervised learning (supervised learning) manner.
In addition, after the server 110 extracts the text paragraph features in the log to be detected, the abnormal classification result can be obtained by calculating the feature similarity between the text paragraph features and each abnormal paragraph feature and classifying the text paragraph features according to the feature similarity. Specifically, the server 110 takes the abnormal paragraph feature with the highest similarity as the target abnormal paragraph feature. And taking the target abnormal paragraph characteristics as an abnormal classification result; finally, the server 110 determines the target abnormal paragraph feature corresponding to the abnormal classification result, and finally, the server 110 takes the known abnormal type corresponding to the target abnormal paragraph feature as the currently existing abnormal type of the website.
The abnormal paragraph feature may refer to a text paragraph feature corresponding to a website test log generated according to a website with a known abnormal type.
In practical applications, the abnormal paragraph features include a plurality. For example, a first exception paragraph feature corresponding to an error report during execution of the website, a second exception paragraph feature corresponding to an error report during configuration of the website, a third exception paragraph feature corresponding to an error report in environment of the website, a fourth exception paragraph feature corresponding to an error report in product line of the website, and the like.
In the website testing method, a log to be detected generated by testing a website is obtained; then, extracting the characteristics corresponding to the text paragraphs in the log to be detected to obtain the characteristics of the text paragraphs; then, classifying the text paragraph features to obtain an abnormal classification result; and according to the abnormal classification result, the abnormal type of the website is determined, so that the automatic test of the website test logs with different formats can be flexibly realized, a tester does not need to spend a large amount of time to read the analysis logs with various and complicated contents to determine the abnormal type of the website, and the test efficiency of the website is improved.
In another embodiment, extracting text paragraph features in the log to be detected includes: acquiring a text paragraph in a log to be detected; inputting the text paragraphs into a pre-trained feature extraction model, and determining target paragraph vectors corresponding to the text paragraphs according to output results of the pre-trained feature extraction model; and taking the target paragraph vector corresponding to the text paragraph as the text paragraph characteristic.
In a specific implementation, the server 110 specifically includes extracting text paragraph features in the log to be detected; the server 110 determines text paragraphs in the log to be detected; inputting the text paragraphs into a pre-trained feature extraction model, more specifically, identifying the text paragraphs in the log to be detected by the server 110, and inputting the text paragraphs into the pre-trained feature extraction model as input parameters of the pre-trained feature extraction model respectively; then, the server 110 determines a target paragraph vector corresponding to the text paragraph according to an output result of the pre-trained feature extraction model; finally, the server 110 determines the text paragraph features according to the target paragraph vector corresponding to the text paragraph.
According to the technical scheme of the embodiment, text paragraphs in the log to be detected are determined; inputting the text paragraphs into a pre-trained feature extraction model; therefore, the target paragraph vector corresponding to the text paragraph can be quickly determined; and determining the characteristics of the text paragraphs according to the target paragraph vectors corresponding to the text paragraphs, so that the identification efficiency of the abnormal types of the websites is improved, and the test efficiency of the websites is improved.
In another embodiment, obtaining a text paragraph in the log to be detected includes: determining paragraphs to be spliced in the log to be detected; wherein, the paragraph to be spliced has a plurality of; and splicing the paragraphs to be spliced to obtain the text paragraphs in the log to be detected.
The paragraphs to be spliced may refer to text paragraphs that have not been spliced in the log to be detected.
In a specific implementation, in a process of acquiring a text paragraph in a log to be detected by the server 110, the method specifically includes: the server 110 identifies a plurality of paragraphs to be spliced in the log to be detected; then, carrying out the operation; the server 110 splices the plurality of paragraphs to be spliced to obtain spliced text paragraphs; and using the spliced text paragraphs as text paragraphs in the log to be detected.
According to the technical scheme of the embodiment, a plurality of paragraphs to be spliced in the log to be detected are spliced to obtain a complete text paragraph in the log to be detected; facilitating input of the entire text passage into a pre-trained feature extraction model; therefore, the target paragraph vector corresponding to the text paragraph can be quickly determined; and determining the characteristics of the text paragraphs according to the target paragraph vectors corresponding to the text paragraphs, and simultaneously realizing characteristic classification by combining the document characteristics corresponding to the whole log to be detected, thereby improving the accuracy of website abnormal type identification and further improving the testing efficiency of the website.
In another embodiment, referring to fig. 3, inputting the text paragraphs into the pre-trained feature extraction model, and determining the target paragraph vectors corresponding to the text paragraphs according to the output result of the pre-trained feature extraction model specifically includes the following steps: s310, in the text paragraph, determining a target prediction word and a sample word; s320, generating an initial paragraph vector of the text paragraph, and obtaining a word vector corresponding to the sample word; s330, inputting the initial paragraph vector and the word vector corresponding to the sample word into a pre-trained feature extraction model to generate a predicted word; s340, adjusting the initial paragraph vector according to the predicted word and the target predicted word to obtain an adjusted initial paragraph vector; and S350, taking the adjusted initial paragraph vector as a target paragraph vector corresponding to the text paragraph.
Where a text passage includes a plurality of words, a word may refer to each of the words that make up the text passage. For example, in the text paragraph "(INFO) STARTING SCENARO" Search an activity to book tissue page "there are words such as" INFO "," STARTING "," SCENARO "," Search "," an "," activity "," book "," page "," title ", etc.
Wherein the target predicted word is a word in any one of the plurality of words.
Wherein the sample word is a word other than the target predicted word among the plurality of words.
In practical applications, in the text paragraph "(INFO) STARTING SCENARO: Search an activity book tissue page", when the target predicted word is "activity", the sample words are divided into "INFO", "STARTING", "SCENARO", "Search", "an", "book", "page" and "title", respectively.
The predicted words are words obtained by predicting words except for the sample words in the plurality of words through a pre-trained feature extraction model.
In a specific implementation, in the process of respectively inputting a text paragraph to a pre-trained feature extraction model and determining a target paragraph vector corresponding to the text paragraph according to an output result of the pre-trained feature extraction model, the server 110 determines a target prediction word and a sample word in the text paragraph. The server 110 randomly generates an initial paragraph vector of a text paragraph and obtains a word vector corresponding to a sample word in a word vector database; then, the server 110 inputs the feature vector obtained by cascading or averaging the initial paragraph vector and the word vector corresponding to the sample word as an input parameter of the pre-trained feature extraction model to the pre-trained feature extraction model, so that the pre-trained feature extraction model generates a predicted word according to the input parameter.
The server 110 then determines the loss of the feature extraction model based on the predicted word and the target predicted word. The server 110 then adjusts the initial paragraph vector using a stochastic gradient descent method based on the loss of the feature extraction model. And continuously iterating and adjusting in a sliding window mode according to the steps until the target predicted word traverses each word in the text paragraphs, so that the server 110 obtains an adjusted initial paragraph vector as a target paragraph vector corresponding to the text paragraphs, and further mapping each text paragraph in the log to be detected into a vector space. In practical applications, the target paragraph vector corresponding to the text paragraph can be represented by one column of the matrix. The vector of each word in a text passage may be represented by a column of the matrix.
According to the technical scheme of the embodiment, a server determines a target prediction word and a sample word in a text paragraph; then, the server generates an initial paragraph vector of the text paragraph and obtains a word vector corresponding to the sample word; inputting the initial paragraph vector and the word vector corresponding to the sample word into a pre-trained feature extraction model to generate a predicted word; finally, the server adjusts the initial paragraph vector according to the predicted word and the target predicted word to obtain an adjusted initial paragraph vector which is used as a target paragraph vector corresponding to the text paragraph; therefore, the target paragraph vector corresponding to the text paragraph semantic meaning can be obtained, and the text paragraph characteristic corresponding to the text paragraph can be accurately obtained, so that the accuracy of website abnormal type identification is improved, and the testing efficiency of the website is improved.
In another embodiment, the text paragraph features are classified to obtain an abnormal classification result; and according to the abnormal classification result, determining the abnormal type of the website, including: inputting the text paragraph features into a pre-trained abnormal type classification model; the pre-trained abnormal type classification model is used for classifying the characteristics of the text paragraphs and outputting corresponding abnormal classification results; and determining the abnormal type of the website according to the abnormal classification result output by the pre-trained abnormal type classification model.
In a specific implementation, after the server 110 extracts the text paragraph features in the log to be detected, the text paragraph features may be used as input parameters of a pre-trained abnormal type classification model, input into the pre-trained abnormal type classification model, and then obtain an abnormal classification result output by the pre-trained abnormal type classification model; finally, the server 110 determines the abnormal type of the website according to the abnormal classification result.
In practical applications, the pre-trained log classification model may be an SVM (Support Vector Machine). SVMs are a class of classifiers that classify data in a supervised learning (supervised learning) manner.
In addition, after the server 110 extracts the text paragraph features in the log to be detected, paragraph vectors corresponding to a plurality of abnormal paragraph features can be obtained; calculating the vector distance between the paragraph vector corresponding to the text paragraph feature and the paragraph vector corresponding to each abnormal paragraph feature as the feature similarity between the text paragraph feature and each abnormal paragraph feature; and classifying the text paragraph features according to the feature similarity to obtain an abnormal classification result, and determining the abnormal type of the website according to the abnormal classification result.
In a specific implementation, the server 110 first obtains paragraph vectors corresponding to a plurality of abnormal paragraph features; and then, calculating Euclidean distance between the paragraph vector corresponding to the text paragraph feature and the paragraph vector corresponding to the abnormal paragraph feature as a vector distance. Then, the server 110 takes the vector distance as the feature similarity between the text paragraph features and each abnormal paragraph feature pre-stored in the database; then, the server 110 classifies the text paragraph features according to the feature similarity, and outputs an abnormal classification result. Specifically, the server 110 uses the abnormal paragraph feature corresponding to the highest feature similarity as the target abnormal paragraph feature, and uses the target abnormal paragraph feature as the abnormal classification result. Finally, the server 110 uses the website exception type corresponding to the target exception paragraph feature as the current exception type of the website. According to the technical scheme, the accuracy of identifying the abnormal types of the websites can be improved as much as possible, and further the testing efficiency of the websites is improved.
In another embodiment, the method further comprises: constructing an abnormal type classification model to be trained; obtaining a text paragraph feature sample as a training sample of an abnormal type classification model to be trained; determining an abnormal type corresponding to the text paragraph feature sample as a classification label of the text paragraph feature sample; training an abnormal type classification model to be trained according to the text paragraph feature samples and the abnormal types corresponding to the text paragraph feature samples to obtain a trained abnormal type classification model; and taking the trained abnormal type classification model as a pre-trained abnormal type classification model.
The text paragraph feature sample may refer to a text paragraph feature corresponding to a website test log of a known abnormal type.
In practical application, the website test logs of known abnormal types can be input into the pre-trained feature extraction model, and text paragraph feature samples corresponding to the website test logs of known abnormal types can be obtained according to the output result of the pre-trained feature extraction model.
In a specific implementation, before the server 110 uses the pre-trained abnormal type classification model, the server 110 may construct an abnormal type classification model to be trained; then, the server 110 obtains a text paragraph feature sample as a training sample of the abnormal type classification model to be trained; meanwhile, the server 110 determines the abnormal type corresponding to the text paragraph feature sample as a classification label of the text paragraph feature sample; then, the server 110 trains the abnormal type classification model to be trained according to the text paragraph feature samples and the abnormal types corresponding to the text paragraph feature samples to obtain a trained abnormal type classification model; finally, the server 110 takes the trained anomaly type classification model as a pre-trained anomaly type classification model.
In practical application, the abnormal type classification model to be trained may be a support vector machine with a multi-classification function, where the support vector machine may be composed of a plurality of sub-support vector machines, and a combination strategy of one vs rest (a training method of the support vector machine) may be used to train the support vector machine when the abnormal type classification model to be trained is trained.
According to the technical scheme of the embodiment, the abnormal type classification model to be trained is constructed, and the abnormal type classification model to be trained is trained according to the text paragraph feature sample and the abnormal type corresponding to the text paragraph feature sample, so that the trained abnormal type classification model is obtained; finally, the trained abnormal type classification model is used as a pre-trained abnormal type classification model; therefore, the pre-trained abnormal type classification model can accurately output the abnormal classification result according to the text paragraph characteristics, so that the accuracy of website abnormal type identification is improved, and the testing efficiency of the website is improved.
In another embodiment, the method further comprises: acquiring an original log; and filtering irrelevant data in the original log by adopting a preset regular expression to obtain the log to be detected.
Wherein, the original log may refer to an unprocessed network test log.
The irrelevant data may refer to data irrelevant to the test content and the test result.
In a specific implementation, before the server 110 obtains the log to be detected, the server 110 collects the unprocessed network test log, i.e., the original log. Then, the server 110 cleans the original log data, and filters out irrelevant data irrelevant to the test content and the test result in the original log to obtain the log to be detected.
In practical application, the server 110 obtains an original log from a database, for example, a mongodb database, then the server 110 extracts data related to the test content and the test result from the original log by using a regular expression preset by a developer, so as to filter the data unrelated to the test content and the test result from the original log, and finally the server 110 adjusts the format of the extracted data, so as to obtain a log to be detected.
According to the technical scheme, before the server acquires the log to be detected, the original log is acquired and preprocessed, irrelevant data in the original log is filtered, and the log to be detected with the data relevant to the test content and the test result is acquired.
In another embodiment, the website testing method described above can also be applied to the application environment shown in fig. 4. The server 110 and the client 120 may perform communication connection through a network, and the server 110 first queries an exception removal guide corresponding to an exception type according to the exception type of the log to be detected; then, the server 110 pushes an exception exclusion guide to the user terminal 120, so that the user can exclude the existing exception of the website according to the exception exclusion guide.
In practical application. The server 110 may be implemented as a stand-alone server or as a server cluster comprising a plurality of servers. The user end 120 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices
The abnormality exclusion guidance may be operation guidance for guiding a detection person to debug a website with an abnormality.
In practical applications, the exception-removing guide may be an operation guide document, an operation guide video, or the like.
In a specific implementation, after the server 110 determines the abnormal type corresponding to the log to be detected, the server 110 queries, according to the abnormal type of the log to be detected, an abnormal exclusion guide having a mapping relationship with the abnormal type in a preset database; finally, the server 110 sends the exception eliminating guide to the user terminal 120, so that the user can eliminate the exception existing in the website according to the exception eliminating guide after using the user terminal 120 to check the exception eliminating guide.
According to the technical scheme of the embodiment, after the server judges the current abnormal type of the website, the server inquires the abnormal removing guide corresponding to the abnormal type according to the abnormal type of the log to be detected; and the abnormal exclusion guide is pushed to the user side for the user to check, so that the user can quickly exclude the abnormal condition of the website according to the abnormal exclusion guide, the functions of the website are close to perfect, the times of repeated tests on the website are reduced, and the efficiency of the test personnel for testing the website is improved.
In another embodiment, the method further comprises: acquiring memory data corresponding to the trained abnormal type classification model; serializing the memory data to obtain a data serialization file corresponding to the trained abnormal type classification model; the data serialization file is stored.
The memory data may refer to data stored in the memory of the server 110 for direct operation.
In a specific implementation, when the server 110 trains an abnormal type classification model to be trained to obtain the trained abnormal type classification model, the server 110 obtains memory data corresponding to the trained abnormal type classification model; then, the server 110 serializes the memory data corresponding to the trained abnormal type classification model to obtain a data serialization file corresponding to the trained abnormal type classification model; finally, the server 110 stores the data serialization file on a local hard disk device.
For example, based on a python (a programming language) platform, the server 110 may perform serialization and persistence on the memory data corresponding to the trained abnormal type classification model by calling a pickle module of the python itself, so as to obtain a data serialization file corresponding to the trained abnormal type classification model; finally, the server 110 stores the data serialization file on a local hard disk device.
According to the technical scheme of the embodiment, memory data corresponding to the trained abnormal type classification model is obtained; the memory data are serialized, and the obtained data serialization file is stored, so that a user can conveniently archive or copy the trained abnormal type classification model, the reusability of the trained abnormal type classification model is improved, and the efficiency of testing various websites by testers is improved.
In another embodiment, referring to fig. 5, a website testing method is provided, which specifically includes the following steps: s510, acquiring a log to be detected; the log to be detected is a log generated by testing a website. S520, determining the text paragraphs in the log to be detected. S530, inputting the text paragraphs to a pre-trained feature extraction model, and determining target paragraph vectors corresponding to the text paragraphs according to output results of the pre-trained feature extraction model. S540, determining paragraphs to be spliced in the log to be detected; wherein, the paragraph to be spliced has a plurality of. And S550, splicing the paragraphs to be spliced to obtain the text paragraphs in the log to be spliced. And S560, inputting the text paragraphs into a pre-trained feature extraction model, and determining target paragraph vectors corresponding to the text paragraphs according to output results of the pre-trained feature extraction model. S570, using the target paragraph vector corresponding to the text paragraph as the text paragraph feature. S580, inputting the text paragraph features into a pre-trained abnormal type classification model; and the pre-trained abnormal type classification model is used for classifying the text paragraph features and outputting a corresponding abnormal classification result. And S590, determining the abnormal type of the website according to the abnormal classification result output by the pre-trained abnormal type classification model.
According to the website testing method, the log to be detected generated by testing the website is obtained; then, extracting the characteristics corresponding to the text paragraphs in the log to be detected to obtain the characteristics of the text paragraphs; then, classifying the text paragraph features to obtain an abnormal classification result; and according to the abnormal classification result, the abnormal type of the website is determined, so that the automatic test of the website test logs with different formats can be flexibly realized, a tester does not need to spend a large amount of time to read the analysis logs with various and complicated contents to determine the abnormal type of the website, and the test efficiency of the website is improved.
It should be understood that although the steps in the flowcharts of fig. 2, 3 and 5 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2, 3, and 5 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 6, there is provided a website testing apparatus, including:
an obtaining module 610, configured to obtain a log to be detected; the log to be detected is a log generated by testing a website.
An extracting module 620, configured to extract text paragraph features in the log to be detected; the text paragraph features are features corresponding to text paragraphs of the log to be detected.
A classification module 630, configured to classify the text paragraph features to obtain an abnormal classification result; and determining the abnormal type of the website according to the abnormal classification result.
The website testing device obtains a log to be detected generated by testing a website; then, extracting the characteristics corresponding to the text paragraphs in the log to be detected to obtain the characteristics of the text paragraphs; then, classifying the text paragraph features to obtain an abnormal classification result; and according to the abnormal classification result, the abnormal type of the website is determined, so that the automatic test of the website test logs with different formats can be flexibly realized, a tester does not need to spend a large amount of time to read the analysis logs with various and complicated contents to determine the abnormal type of the website, and the test efficiency of the website is improved.
In one embodiment, the extracting module 620 includes: the paragraph determining submodule is used for acquiring text paragraphs in the log to be detected; the vector determination submodule is used for inputting the text paragraphs into a pre-trained feature extraction model and determining target paragraph vectors corresponding to the text paragraphs according to output results of the pre-trained feature extraction model; and the characteristic determining submodule is used for taking the target paragraph vector corresponding to the text paragraph as the text paragraph characteristic.
In one embodiment, the log to be detected includes a plurality of text paragraphs, and the paragraph determination sub-module is specifically configured to determine paragraphs to be spliced in the log to be detected; wherein, the paragraph to be spliced is provided with a plurality of paragraphs; and splicing the paragraphs to be spliced to obtain the text paragraphs in the log to be detected.
In one embodiment, the text passage includes a plurality of words, and the vector determination sub-module is configured to determine a target predicted word and a sample word in the text passage; wherein the target predicted word is a word in any one of the plurality of words; the sample word is a word in the plurality of words other than the target predicted word; generating an initial paragraph vector of the text paragraph, and obtaining a word vector corresponding to the sample word; inputting the initial paragraph vector and the word vector corresponding to the sample word into the pre-trained feature extraction model to generate a predicted word; the predicted words are words obtained by predicting words except the sample words in the plurality of words by the pre-trained feature extraction model; adjusting the initial paragraph vector according to the predicted word and the target predicted word to obtain an adjusted initial paragraph vector; and taking the adjusted initial paragraph vector as a target paragraph vector corresponding to the text paragraph.
In one embodiment, the classification module 630 includes: the input submodule is used for inputting the text paragraph features into a pre-trained abnormal type classification model; the pre-trained abnormal type classification model is used for classifying the text paragraph features and outputting a corresponding abnormal classification result; the type determining submodule is used for determining the abnormal type of the website according to the abnormal classification result output by the pre-trained abnormal type classification model; or, the vector obtaining submodule is used for obtaining paragraph vectors corresponding to the plurality of abnormal paragraph features; the calculation submodule is used for calculating the vector distance between the paragraph vector corresponding to the text paragraph feature and the paragraph vector corresponding to each abnormal paragraph feature, and the vector distance is used as the feature similarity between the text paragraph feature and each abnormal paragraph feature; and the abnormality classification submodule is used for classifying the text paragraph features according to the feature similarity to obtain an abnormality classification result, and determining the abnormality type of the website according to the abnormality classification result.
The input submodule is used for inputting the text paragraph features into a pre-trained abnormal type classification model; the pre-trained abnormal type classification model is used for calculating the vector distance between the feature vector corresponding to the text paragraph feature and the feature vector corresponding to the abnormal paragraph feature; the vector distance is used as the feature similarity between the text paragraph feature and the abnormal paragraph feature; and the text paragraph features are classified according to the feature similarity, and the abnormal classification result is output.
In one embodiment, the website testing apparatus further includes: the building module is used for building an abnormal type classification model to be trained; the sample acquisition module is used for acquiring a text paragraph feature sample as a training sample of the abnormal type classification model to be trained; the label acquisition module is used for determining the abnormal type corresponding to the text paragraph feature sample and taking the abnormal type as a classification label aiming at the text paragraph feature sample; the training module is used for training the abnormal type classification model to be trained according to the text paragraph feature sample and the abnormal type corresponding to the text paragraph feature sample to obtain a trained abnormal type classification model; and the model determining module is used for taking the trained abnormal type classification model as the pre-trained abnormal type classification model.
In one embodiment, the website testing apparatus further includes: the memory data acquisition module is used for acquiring memory data corresponding to the trained abnormal type classification model; the serial number module is used for serializing the memory data to obtain a data serialization file corresponding to the trained abnormal type classification model; and the storage module is used for storing the data serialization file.
In one embodiment, the website testing apparatus further includes: the original log obtaining module is used for obtaining an original log; and the filtering module is used for filtering the irrelevant data in the original log by adopting a preset regular expression to obtain the log to be detected.
In one embodiment, the website testing apparatus further includes: the query module is used for querying an exception eliminating guide corresponding to the exception type according to the exception type of the log to be detected; and the pushing module is used for pushing the exception eliminating guide to a user side so that the user can eliminate the exception existing in the website according to the exception eliminating guide.
For the specific definition of the website testing apparatus, reference may be made to the above definition of the website testing method, which is not described herein again. All or part of each module in the website test device can be realized by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing website test data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a website testing method.
Those skilled in the art will appreciate that the architecture shown in fig. 7 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
s210, acquiring a log to be detected; the log to be detected is a log generated by testing a website;
s220, extracting the text paragraph features in the log to be detected; the text paragraph features are features corresponding to text paragraphs of the log to be detected;
s230, classifying the text paragraph features to obtain an abnormal classification result; and determining the abnormal type of the website according to the abnormal classification result.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring a text paragraph in the log to be detected; inputting the text paragraphs into a pre-trained feature extraction model, and determining target paragraph vectors corresponding to the text paragraphs according to output results of the pre-trained feature extraction model; and taking the target paragraph vector corresponding to the text paragraph as the text paragraph feature.
In one embodiment, the processor, when executing the computer program, further performs the steps of: determining paragraphs to be spliced in the log to be detected; wherein, the paragraph to be spliced is provided with a plurality of paragraphs; and splicing the paragraphs to be spliced to obtain the text paragraphs in the log to be detected.
In one embodiment, the text passage comprises a plurality of words, and the processor when executing the computer program further performs the steps of: in the text passage, determining a target prediction word and a sample word; wherein the target predicted word is a word in any one of the plurality of words; the sample word is a word in the plurality of words other than the target predicted word; generating an initial paragraph vector of the text paragraph, and obtaining a word vector corresponding to the sample word; inputting the initial paragraph vector and the word vector corresponding to the sample word into the pre-trained feature extraction model to generate a predicted word; the predicted words are words obtained by predicting words except the sample words in the plurality of words by the pre-trained feature extraction model; adjusting the initial paragraph vector according to the predicted word and the target predicted word to obtain an adjusted initial paragraph vector; and taking the adjusted initial paragraph vector as a target paragraph vector corresponding to the text paragraph.
In one embodiment, the processor, when executing the computer program, further performs the steps of: inputting the text paragraph features into a pre-trained abnormal type classification model; the pre-trained abnormal type classification model is used for classifying the text paragraph features and outputting a corresponding abnormal classification result; determining the abnormal type of the website according to the abnormal classification result output by the pre-trained abnormal type classification model;
or
Acquiring paragraph vectors corresponding to a plurality of abnormal paragraph features; calculating the vector distance between the paragraph vector corresponding to the text paragraph feature and the paragraph vector corresponding to each abnormal paragraph feature as the feature similarity between the text paragraph feature and each abnormal paragraph feature; classifying the text paragraph features according to the feature similarity to obtain the abnormal classification result, and determining the abnormal type of the website according to the abnormal classification result.
In one embodiment, the processor, when executing the computer program, further performs the steps of: constructing an abnormal type classification model to be trained; obtaining a text paragraph feature sample as a training sample of the abnormal type classification model to be trained; determining an abnormal type corresponding to the text paragraph feature sample as a classification label for the text paragraph feature sample; training the abnormal type classification model to be trained according to the text paragraph feature sample and the abnormal type corresponding to the text paragraph feature sample to obtain a trained abnormal type classification model; and taking the trained abnormal type classification model as the pre-trained abnormal type classification model.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring an original log; and filtering irrelevant data in the original log by adopting a preset regular expression to obtain the log to be detected.
In one embodiment, the processor, when executing the computer program, further performs the steps of: inquiring an exception removing guide corresponding to the exception type according to the exception type of the log to be detected; and pushing the exception eliminating guide to a user side so that the user can eliminate the exception existing in the website according to the exception eliminating guide.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring memory data corresponding to the trained abnormal type classification model; serializing the memory data to obtain a data serialization file corresponding to the trained abnormal type classification model; and storing the data serialization file.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
s210, acquiring a log to be detected; the log to be detected is a log generated by testing a website;
s220, extracting the text paragraph features in the log to be detected; the text paragraph features are features corresponding to text paragraphs of the log to be detected;
s230, classifying the text paragraph features to obtain an abnormal classification result; and determining the abnormal type of the website according to the abnormal classification result.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a text paragraph in the log to be detected; inputting the text paragraphs into a pre-trained feature extraction model, and determining target paragraph vectors corresponding to the text paragraphs according to output results of the pre-trained feature extraction model; and taking the target paragraph vector corresponding to the text paragraph as the text paragraph feature.
In one embodiment, the computer program when executed by the processor further performs the steps of: determining paragraphs to be spliced in the log to be detected; wherein, the paragraph to be spliced is provided with a plurality of paragraphs; and splicing the paragraphs to be spliced to obtain the text paragraphs in the log to be detected.
In one embodiment, the text passage comprises a plurality of words, the computer program when executed by the processor further performing the steps of, in the text passage, determining a target predicted word and a sample word; wherein the target predicted word is a word in any one of the plurality of words; the sample word is a word in the plurality of words other than the target predicted word; generating an initial paragraph vector of the text paragraph, and obtaining a word vector corresponding to the sample word; inputting the initial paragraph vector and the word vector corresponding to the sample word into the pre-trained feature extraction model to generate a predicted word; the predicted words are words obtained by predicting words except the sample words in the plurality of words by the pre-trained feature extraction model; adjusting the initial paragraph vector according to the predicted word and the target predicted word to obtain an adjusted initial paragraph vector; and taking the adjusted initial paragraph vector as a target paragraph vector corresponding to the text paragraph.
In one embodiment, the computer program when executed by the processor further performs the steps of: inputting the text paragraph features into a pre-trained abnormal type classification model; the pre-trained abnormal type classification model is used for classifying the text paragraph features and outputting a corresponding abnormal classification result; determining the abnormal type of the website according to the abnormal classification result output by the pre-trained abnormal type classification model;
or
Acquiring paragraph vectors corresponding to a plurality of abnormal paragraph features; calculating the vector distance between the paragraph vector corresponding to the text paragraph feature and the paragraph vector corresponding to each abnormal paragraph feature as the feature similarity between the text paragraph feature and each abnormal paragraph feature; classifying the text paragraph features according to the feature similarity to obtain the abnormal classification result, and determining the abnormal type of the website according to the abnormal classification result.
In one embodiment, the computer program when executed by the processor further performs the steps of: constructing an abnormal type classification model to be trained; obtaining a text paragraph feature sample as a training sample of the abnormal type classification model to be trained; determining an abnormal type corresponding to the text paragraph feature sample as a classification label for the text paragraph feature sample; training the abnormal type classification model to be trained according to the text paragraph feature sample and the abnormal type corresponding to the text paragraph feature sample to obtain a trained abnormal type classification model; and taking the trained abnormal type classification model as the pre-trained abnormal type classification model.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring an original log; and filtering irrelevant data in the original log by adopting a preset regular expression to obtain the log to be detected.
In one embodiment, the computer program when executed by the processor further performs the steps of: inquiring an exception removing guide corresponding to the exception type according to the exception type of the log to be detected; and pushing the exception eliminating guide to a user side so that the user can eliminate the exception existing in the website according to the exception eliminating guide.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring memory data corresponding to the trained abnormal type classification model; serializing the memory data to obtain a data serialization file corresponding to the trained abnormal type classification model; and storing the data serialization file.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.