CN115757138A - Method and device for determining script abnormal reason, storage medium and electronic equipment - Google Patents

Method and device for determining script abnormal reason, storage medium and electronic equipment Download PDF

Info

Publication number
CN115757138A
CN115757138A CN202211450899.8A CN202211450899A CN115757138A CN 115757138 A CN115757138 A CN 115757138A CN 202211450899 A CN202211450899 A CN 202211450899A CN 115757138 A CN115757138 A CN 115757138A
Authority
CN
China
Prior art keywords
abnormal
script
test
historical
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211450899.8A
Other languages
Chinese (zh)
Inventor
马美晓
秦亭亭
虞安虎
嵇雯雯
张宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hillstone Networks Co Ltd
Original Assignee
Hillstone Networks Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hillstone Networks Co Ltd filed Critical Hillstone Networks Co Ltd
Priority to CN202211450899.8A priority Critical patent/CN115757138A/en
Publication of CN115757138A publication Critical patent/CN115757138A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a method and a device for determining a script exception reason, a storage medium and electronic equipment. The method comprises the following steps: acquiring a test log of the abnormal script from the target equipment, and acquiring an abnormal test step from the test log; judging whether a test log in the database has a history test step which is the same as the abnormal test step; under the condition that the test log in the database does not have the same historical test step as the abnormal test step, acquiring the occurrence time of the abnormal test step to obtain a target time; judging whether the target equipment is abnormal at the target moment; and under the condition that the target equipment has no abnormality, determining the abnormality reason of the abnormal script according to the historical operating condition of the abnormal script. By the method and the device, the problem that in the related technology, the abnormal scripts in the continuous integration test are tested manually, and a large amount of time is consumed, so that the testing efficiency is low is solved.

Description

Method and device for determining script abnormal reason, storage medium and electronic equipment
Technical Field
The present application relates to the field of data testing, and in particular, to a method and an apparatus for determining a cause of a script exception, a storage medium, and an electronic device.
Background
Continuous integration testing is an important ring in the software development process. The continuous integration test is to integrate the work of a plurality of members and give feedback frequently and continuously in the development process. Typically each member integrates at least once per day, meaning that multiple integrations may occur per day. Each integration is verified by automated build (including compile, release, automated testing) to discover integration errors as early as possible.
The analysis of the script operation failure reason refers to the analysis of the abnormal reason of the script/use case which runs abnormally (does not run, scheduling fails) or runs failure (test result fails) in the continuous integration test. Because a relatively large number of test failures may occur in one continuous integration, and a large number of abnormal scripts may be generated during testing of the scripts, each abnormal script needs to be analyzed by a manual method, thereby causing a large amount of test time consumed in the continuous integration test and causing a large amount of invalid human resource waste.
Aiming at the problem that in the related technology, a large amount of time is consumed to test an abnormal script in a continuous integration test manually, so that the test efficiency is low, an effective solution is not provided at present.
Disclosure of Invention
The application provides a method and a device for determining a script abnormal reason, a storage medium and electronic equipment, which are used for solving the problem that in the related art, a lot of time is consumed to cause low testing efficiency due to the fact that an abnormal script in a continuous integration test is tested manually.
According to one aspect of the application, a method for determining a cause of a script exception is provided. The method comprises the following steps: acquiring a test log of an abnormal script from target equipment, and acquiring an abnormal test step from the test log, wherein the abnormal script runs in the target equipment; judging whether a test log in the database has a history test step which is the same as the abnormal test step; under the condition that the test log in the database does not have the historical test step which is the same as the abnormal test step, acquiring the occurrence time of the abnormal test step to obtain the target time; judging whether the target equipment is abnormal at the target moment; and under the condition that the target equipment has no abnormality, determining the abnormality reason of the abnormal script according to the historical operating condition of the abnormal script.
Optionally, after determining whether the test log in the database has the same historical test step as the abnormal test step, the method further includes: under the condition that a test log in a database has a history test step which is the same as the abnormal test step, judging whether the history test step has a history abnormal reason or not; and in the case that the historical test step has a historical abnormal reason, determining the historical abnormal reason as the abnormal reason of the abnormal script.
Optionally, after determining whether the target device is abnormal at the target time, the method further includes: under the condition that the target equipment is abnormal at the target moment, determining the test result of the abnormal script and the abnormal phenomenon of the target equipment, and judging whether the test result is a preset result; and determining the abnormal phenomenon as the abnormal reason of the abnormal script under the condition that the test result is a preset result.
Optionally, the determining the abnormal reason of the abnormal script according to the historical operating condition of the abnormal script includes: judging whether the accuracy of the historical operating condition is greater than or equal to a first preset value or not; under the condition that the accuracy of the historical running condition is greater than or equal to a first preset value, judging whether the version of the abnormal script is changed or not; determining the abnormal reason of the abnormal script as the abnormal version of the abnormal script under the condition that the version of the abnormal script is changed; and under the condition that the version of the abnormal script is not changed, sending the test log to the server, and receiving the abnormal reason fed back by the server to obtain the abnormal reason.
Optionally, determining the abnormal reason of the abnormal script according to the historical operating condition of the abnormal script includes: judging whether the accuracy of the historical operating condition is smaller than a second preset value, wherein the second preset value is smaller than the first preset value; under the condition that the accuracy of the historical running condition is smaller than a second preset value, judging whether the version of the abnormal script is changed or not; under the condition that the version of the abnormal script is not changed, determining the abnormal occurrence of the stability of the abnormal script as the abnormal reason of the abnormal script; and under the condition that the version of the abnormal script is changed, sending the test log to the server, and receiving the abnormal reason fed back by the server to obtain the abnormal reason.
Optionally, after determining the historical abnormality cause as the abnormality cause, the method further includes: determining whether a historical cause of the anomaly is resolved; and under the condition that the historical abnormal reason is solved, executing a step of acquiring the occurrence time of the abnormal test step and obtaining a target time.
Optionally, after determining the abnormal reason of the abnormal script according to the historical operating condition of the abnormal script, the method further includes: storing the abnormal reason of the abnormal script and the abnormal testing step in a database in a correlation manner, and acquiring a solution of the abnormal reason from the server; and after the solution is obtained, the solution and the abnormal reason are associated and stored in the database.
According to another aspect of the present application, an apparatus for determining a cause of a script abnormality is provided. The device includes: a first obtaining unit, configured to obtain a test log of an abnormal script from a target device, and obtain an abnormal test step from the test log, where the abnormal script runs in the target device; the first judging unit is used for judging whether the test logs in the database have the same history test steps as the abnormal test steps; the second acquisition unit is used for acquiring the occurrence time of the abnormal testing step to obtain the target time under the condition that the historical testing step which is the same as the abnormal testing step does not exist in the testing log in the database; a second judgment unit, configured to judge whether the target device is abnormal at the target time; and the first determining unit is used for determining the abnormal reason of the abnormal script according to the historical running condition of the abnormal script under the condition that the target device has no abnormality.
According to another aspect of the embodiments of the present invention, there is also provided a computer storage medium for storing a program, where the program is run to control a device in which the computer storage medium is located to execute a method for determining a cause of a script exception.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors and a memory; the memory is used for storing computer readable instructions, and the processor is used for executing the computer readable instructions, wherein the computer readable instructions execute a method for determining the reason of the script exception.
Through the application, the following steps are adopted: acquiring a test log of an abnormal script from target equipment, and acquiring an abnormal test step from the test log, wherein the abnormal script runs in the target equipment; judging whether a test log in the database has a history test step which is the same as the abnormal test step; under the condition that the test log in the database does not have the same historical test step as the abnormal test step, acquiring the occurrence time of the abnormal test step to obtain a target time; judging whether the target equipment is abnormal at the target moment; and under the condition that the target equipment has no abnormality, determining the abnormality reason of the abnormal script according to the historical operating condition of the abnormal script. The problem of among the correlation technique test the abnormal script in the continuous integration test through the manual work, need to consume a large amount of time and lead to the inefficiency of test is solved. The abnormal script determining method has the advantages that whether the same historical testing steps exist in the abnormal testing steps or not is determined, whether the target equipment is abnormal or not is determined under the condition that the historical testing steps do not exist, the abnormal reason of the abnormal script is determined through two dimensions of the historical running condition, the abnormal reason of most of the abnormal scripts is accurately determined through the automatic process, abnormal scripts needing to be confirmed manually are greatly reduced, and the effect of improving the efficiency of testing the abnormal scripts is achieved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate embodiments of the application and, together with the description, serve to explain the application and are not intended to limit the application. In the drawings:
FIG. 1 is a flowchart of a method for determining a cause of a script exception according to an embodiment of the present application;
FIG. 2 is a flow chart (I) of an alternative method for determining a cause of a script exception according to an embodiment of the present application;
FIG. 3 is a flow chart of an alternative method for determining a cause of a script exception according to an embodiment of the present application (II);
FIG. 4 is a schematic diagram of an apparatus for determining a cause of a script exception according to an embodiment of the present application;
fig. 5 is a schematic view of an electronic device according to an embodiment of the present application.
Detailed Description
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the accompanying drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be used. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that relevant information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for presentation, analyzed data, etc.) referred to in the present disclosure are information and data that are authorized by the user or sufficiently authorized by various parties. For example, an interface is provided between the system and the relevant user or organization, before obtaining the relevant information, an obtaining request needs to be sent to the user or organization through the interface, and after receiving the consent information fed back by the user or organization, the relevant information is obtained.
According to an embodiment of the application, a method for determining a script exception reason is provided.
Fig. 1 is a flowchart of a method for determining a script exception cause according to an embodiment of the present application. As shown in fig. 1, the method comprises the steps of:
step S102, obtaining a test log of the abnormal script from the target equipment, and obtaining an abnormal test step from the test log, wherein the abnormal script runs in the target equipment.
Specifically, the target device may be a test device that performs a continuous integration test, and when the continuous integration test is performed, the target device may test a plurality of scripts, and when a test result of a certain script is abnormal or wrong, the abnormal script needs to be tested and analyzed for an abnormal reason, so that an integration error in a software development process is found in time.
After a certain script is determined to be an abnormal script, a test log for testing the script needs to be obtained, the test log comprises a plurality of test steps, an abnormal test step with an error can be displayed in the test log of the abnormal script, and at this time, the abnormal reason of the script can be searched and analyzed by starting with the abnormal test step.
And step S104, judging whether the test logs in the database have the same history test steps as the abnormal test steps.
Specifically, the abnormality cause determination may be performed on the abnormality testing step through an existing testing log stored in the database. Firstly, a large number of test logs are stored in the database, and each test log has a plurality of history test steps, so that whether the history test steps identical to the abnormal test steps exist in the database can be determined, and further, under the condition that the history test steps exist, the abnormal reason of the abnormal test steps is determined through history information corresponding to the history test steps, wherein the history test steps are history abnormal test steps in the test logs, namely, the history test steps are all step information with abnormality.
And step S106, under the condition that the test log in the database does not have the same historical test step as the abnormal test step, acquiring the occurrence time of the abnormal test step to obtain the target time.
Specifically, when there is no history test step identical to the abnormal test step in the test log in the database, the abnormal test step needs to be further analyzed, and first, it needs to be determined whether the abnormality is caused by the abnormality of the target device. In the continuous integration operation time range, if a network fault exists, a test platform is upgraded, or a test network element is down, the continuous integration test of the target equipment is influenced, so that the continuous integration test is abnormal, therefore, the occurrence time of the abnormal test step needs to be acquired first, the target time is acquired, the target equipment is checked according to the time information, and the abnormal reason of the target equipment is acquired.
Step S108, judging whether the target equipment has abnormity at the target time.
Specifically, after the target time is obtained, it is necessary to determine whether the target device is abnormal at the time, and in order to accurately determine whether the target device is abnormal, whether the target device is abnormal may be determined through multiple dimensions such as a network fault, a test platform upgrade, or a test network element downtime.
And step S110, under the condition that the target device has no abnormality, determining the abnormality reason of the abnormal script according to the historical running condition of the abnormal script.
Specifically, when there is no abnormality in the target device, the historical operating condition of the abnormal script may be obtained, and the cause of the abnormality of the script may be determined according to the historical operating condition.
For example, when the historical running condition of the abnormal script is abnormal, it may be determined that the current version of the abnormal script may have an abnormality, which causes a problem in the running of the script.
The method for determining the script abnormal reason provided by the embodiment of the application acquires the test log of the abnormal script from the target device and acquires the abnormal test step from the test log, wherein the abnormal script runs in the target device; judging whether the test log in the database has a historical test step which is the same as the abnormal test step; under the condition that the test log in the database does not have the same historical test step as the abnormal test step, acquiring the occurrence time of the abnormal test step to obtain a target time; judging whether the target equipment is abnormal at the target moment; and under the condition that the target equipment has no abnormality, determining an abnormality reason of the abnormal script according to the historical running condition of the abnormal script. The problem of among the correlation technique test the abnormal script in the continuous integration test through the manual work, need to consume a large amount of time and lead to the inefficiency of test is solved. The abnormal script determining method has the advantages that whether the same historical testing steps exist in the abnormal testing steps or not is determined, whether the target equipment is abnormal or not is determined under the condition that the historical testing steps do not exist, the abnormal reason of the abnormal script is determined through two dimensions of the historical running condition, the abnormal reason of most of the abnormal scripts is accurately determined through the method for accurately and efficiently determining the abnormal script through the automatic process, and therefore the abnormal scripts needing to be confirmed manually are greatly reduced, and the effect of improving the efficiency of testing the abnormal scripts is achieved.
Optionally, in the method for determining a script abnormality cause provided in the embodiment of the present application, after determining whether a test log in a database has a history test step that is the same as the abnormality test step, the method further includes: under the condition that a test log in a database has a history test step which is the same as the abnormal test step, judging whether the history test step has a history abnormal reason or not; and in the case that the historical test step has a historical abnormal reason, determining the historical abnormal reason as the abnormal reason of the abnormal script.
Specifically, when a plurality of test logs in the database have historical test steps identical to the abnormal test steps, the abnormal test steps are characterized not to occur for the first time but to occur in the historical test process, and at this time, the abnormal test steps do not need to be analyzed again, but the abnormal analysis results of the historical test steps can be directly used as the abnormal reasons of the abnormal test steps, so that the analysis process of analyzing the abnormal again is omitted.
However, in the case where it is confirmed that there is a history test step identical to the abnormal test step, there may be a case where the problem corresponding to the history test step has been solved. Optionally, in the method for determining a script abnormality cause provided in the embodiment of the present application, after determining a historical abnormality cause as an abnormality cause, the method further includes: determining whether a historical cause of the anomaly is resolved; and under the condition that the historical abnormal reason is solved, executing a step of acquiring the occurrence time of the abnormal test step and obtaining a target time.
Specifically, when the historical abnormal cause corresponding to the historical test step is solved, it is characterized that the script does not have the historical abnormal cause, and the abnormal test step is the same as the historical test step, but the abnormal causes of the two steps may not be consistent, so that the abnormal cause needs to be analyzed again by using other methods, so as to determine the abnormal cause of the abnormal test step.
Fig. 2 is a flowchart of an optional method for determining a cause of a script exception according to an embodiment of the present application, where as shown in fig. 2, the method includes the following steps:
first, it is determined whether there is an analysis result in the history test step of the exception script, that is, whether the history exception cause in the exception script has been determined, in the case that the history exception cause has been determined, it is necessary to determine whether the history test step is the same as the exception test step, and in the case that the history test step is the same as the exception test step, the history test step and the exception test step may be recorded together, as shown in table 1,
TABLE 1
Figure BDA0003950881520000071
After recording, bug repair query can be performed in a log of a development department according to the associated bug ID in the history testing step, so as to determine whether the abnormal reason is solved, and under the condition that the abnormal reason is not solved, the associated bug ID of the abnormal testing step can be kept consistent with the history testing step, such as 111 in table 1, that is, the abnormal reasons of the history testing step and the abnormal testing step are combined, so that the abnormal reason of the history testing step is determined as the abnormal reason of the abnormal testing step, and the effect that the same abnormal condition is not required to be repeatedly processed for multiple times is achieved.
It should be noted that, in the case that the abnormality cause is solved, the characterization history test step and the abnormality cause of the abnormality test step are unrelated, and therefore, it is necessary to determine the abnormality cause of the abnormality test step in another way.
Optionally, in the method for determining a script abnormality reason provided in the embodiment of the present application, after determining whether the target device is abnormal at the target time, the method further includes: under the condition that the target equipment is abnormal at the target moment, determining the test result of the abnormal script and the abnormal phenomenon of the target equipment, and judging whether the test result is a preset result; and determining the abnormal phenomenon as the abnormal reason of the abnormal script under the condition that the test result is a preset result.
It should be noted that the reason for the failed script test may also be caused by an external factor, i.e. the target device. And for the situations that network faults are detected, an automatic test platform is upgraded or a network element is tested to be down and the like in the continuous integration running time range. The test case failure introduced by this kind of situation will be confusing to some extent. The analyst may expend a great deal of effort analyzing each external factor in turn, without knowing the cause. Thus, possible reason classifications can be given by automatically collecting these sources of information.
Specifically, when it is determined that the target device is abnormal at the target time, the reason for characterizing the abnormal script may be caused by the abnormality of the target device, and therefore, it is necessary to determine the test result of the abnormal script from the log, determine whether the test result is a preset result, and determine that the script abnormality is caused by the test result of the target device when the test result is the preset result, so that the reason for the abnormality of the abnormal script can be determined quickly and accurately.
For example, at a target time, an automatic test platform component in a target device may perform an upgrade operation, and at this time, when it is determined that a test result is some preset result, for example, a use case is not executed, an irregular exception (a database connection failure, a rest request call failure, an automatic platform component call exception) occurs when the use case is executed, and the like, it is determined that the test result is related to platform upgrade.
For another example, at the target time, the network of the target device may have an abnormality, and when it is detected that the network fault of the target device is a loop, a block, an abnormal switch, or the like, it may be determined that the cause of the abnormality of the abnormal script is the network problem of the target device.
Optionally, in the method for determining a script abnormal reason provided in the embodiment of the present application, determining the abnormal reason of the abnormal script according to the historical operating condition of the abnormal script includes: judging whether the accuracy of the historical operating condition is greater than or equal to a first preset value or not; under the condition that the accuracy of the historical running condition is greater than or equal to a first preset value, judging whether the version of the abnormal script is changed or not; determining the abnormal reason of the abnormal script as the abnormal version of the abnormal script under the condition that the version of the abnormal script is changed; and under the condition that the version of the abnormal script is not changed, sending the test log to the server, and receiving the abnormal reason fed back by the server to obtain the abnormal reason.
Specifically, the historical operating condition is the usage record of the abnormal script in the past, including the test accuracy, i.e. the success rate, of each time the abnormal script is used. Under the condition that the accuracy is greater than the first preset value, the running condition of the script is characterized to be relatively stable, so that whether the script is updated in version recently needs to be determined, and under the condition that the script is changed in version, the reason that the script is abnormal at this time can be determined to be the version problem of the script.
Optionally, in the method for determining a script abnormal reason provided in the embodiment of the present application, determining the abnormal reason of the abnormal script according to the historical operating condition of the abnormal script includes: judging whether the accuracy of the historical operating condition is smaller than a second preset value, wherein the second preset value is smaller than the first preset value; under the condition that the accuracy of the historical running condition is smaller than a second preset value, judging whether the version of the abnormal script is changed or not; under the condition that the version of the abnormal script is not changed, determining the abnormal occurrence of the stability of the abnormal script as the abnormal reason of the abnormal script; and under the condition that the version of the abnormal script is changed, sending the test log to the server, and receiving the abnormal reason fed back by the server to obtain the abnormal reason.
Specifically, when the accuracy is smaller than the second preset value, the running condition of the script is very unstable, and therefore it is necessary to determine whether the script has recently been updated in version.
Fig. 3 is a flowchart (ii) of a method for determining an optional script exception cause according to an embodiment of the present application, and as shown in fig. 3, it is first determined whether a historical operation accuracy of a script is greater than a first preset value, and when the historical operation accuracy of the script is greater than the first preset value, the script is characterized by strong operation stability, at this time, it is necessary to determine whether an external influence factor exists, and determine that the script exception is caused by the external factor when the external influence factor exists, and when the script exception does not exist, determine whether the script has a version change, and when the script has a version change, determine that the script exception is caused by a script version problem.
Further, under the condition that the historical script operation accuracy is smaller than or equal to the first preset value, whether the historical script operation accuracy is smaller than or equal to the second preset value or not is determined, and under the condition that the historical script operation accuracy is larger than or equal to the second preset value, the historical script operation accuracy is determined to be caused by other factors and needs to be analyzed manually. Under the condition that the historical running accuracy of the script is smaller than the second preset value, the running state of the script is represented to be very unstable, at the moment, whether external influence factors exist needs to be determined, and the script is judged to be abnormal due to the external factors under the existence condition, whether the script is changed in version under the nonexistence condition is judged, and the script is judged to be abnormal due to the robustness under the condition that the script is not changed, so that the effect of accurately and quickly determining the abnormal reason of the script is achieved.
Optionally, in the method for determining a script abnormal reason provided in the embodiment of the present application, after determining the abnormal reason of the abnormal script according to the historical operating condition of the abnormal script, the method further includes: storing the abnormal reason of the abnormal script and the abnormal testing step in a database in a correlation manner, and acquiring a solution of the abnormal reason from the server; after the solution is obtained, the solution and the abnormal reason are associated and stored in a database
Specifically, after the abnormal reason of the script is determined, the abnormal reason and the abnormal testing step can be stored in a database in an associated manner, so that the generation of a new historical testing step is completed, after the solution is obtained, the solution is stored together, so that the supplement of the historical testing step is completed, and further, the support of the analysis of the abnormal reason can be provided under the condition that the subsequent script is abnormal again.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than here.
The embodiment of the present application further provides a device for determining a script abnormal reason, and it should be noted that the device for determining a script abnormal reason according to the embodiment of the present application may be used to execute the method for determining a script abnormal reason provided by the embodiment of the present application. The following describes an apparatus for determining a cause of a script abnormality according to an embodiment of the present application.
Fig. 4 is a schematic diagram of an apparatus for determining a cause of a script exception according to an embodiment of the present application. As shown in fig. 4, the apparatus includes: a first acquiring unit 41, a first judging unit 42, a second acquiring unit 43, a second judging unit 44, and a first determining unit 45.
A first obtaining unit 41, configured to obtain a test log of an exception script from a target device, and obtain an exception test step from the test log, where the exception script runs in the target device.
Specifically, the target device may be a test device that performs a continuous integration test, and when the continuous integration test is performed, the target device may test a plurality of scripts, and when a test result of a certain script is abnormal or wrong, the abnormal script needs to be tested and analyzed for an abnormal reason, so that an integration error in a software development process is found in time.
After a certain script is determined to be an abnormal script, a test log for testing the script needs to be obtained, the test log comprises a plurality of test steps, an abnormal test step with an error can be displayed in the test log of the abnormal script, and at this time, the abnormal reason of the script can be searched and analyzed by starting with the abnormal test step.
And a first judging unit 42, configured to judge whether there is a history testing step identical to the abnormal testing step in the testing log in the database.
Specifically, the abnormality cause determination may be performed on the abnormality testing step through an existing testing log stored in the database. Firstly, a large number of test logs are stored in the database, and each test log has a plurality of history test steps, so that whether the history test steps identical to the abnormal test steps exist in the database can be determined, and further, under the condition that the history test steps exist, the abnormal reason of the abnormal test steps is determined through history information corresponding to the history test steps, wherein the history test steps are history abnormal test steps in the test logs, namely, the history test steps are all step information with abnormality.
A second obtaining unit 43, configured to obtain the occurrence time of the abnormal testing step and obtain the target time when the historical testing step identical to the abnormal testing step does not exist in the testing log in the database.
Specifically, when there is no history test step identical to the abnormal test step in the test log in the database, the abnormal test step needs to be further analyzed, and first, it needs to be determined whether the abnormality is caused by the abnormality of the target device. In the continuous integration operation time range, if a network fault exists, a test platform is upgraded, or a test network element is down, the continuous integration test of the target equipment is influenced, so that the continuous integration test is abnormal, therefore, the occurrence time of the abnormal test step needs to be acquired first, the target time is acquired, the target equipment is checked according to the time information, and the abnormal reason of the target equipment is acquired.
A second judgment unit 44, configured to judge whether there is an abnormality in the target device at the target time.
Specifically, after the target time is obtained, it is necessary to determine whether the target device is abnormal at the time, and in order to accurately determine whether the target device is abnormal, whether the target device is abnormal may be determined through multiple dimensions such as a network fault, a test platform upgrade, or a test network element downtime.
And a first determining unit 45, configured to determine, in a case where there is no abnormality in the target device, an abnormality cause of the abnormal script according to a historical operating condition of the abnormal script.
Specifically, when there is no abnormality in the target device, the historical operating condition of the abnormal script may be obtained, and the cause of the abnormality of the script may be determined according to the historical operating condition.
For example, when the historical running condition of the abnormal script is abnormal, it may be determined that the current version of the abnormal script may have an abnormality, which causes a problem in the running of the script.
The device for determining the script abnormality reason according to the embodiment of the present application obtains, by using the first obtaining unit 41, the test log of the abnormal script from the target device, and obtains the abnormality testing step from the test log, where the abnormal script runs in the target device. The first judgment unit 42 judges whether or not there is a history test step identical to the abnormality test step in the test log in the database. The second acquiring unit 43 acquires the occurrence time of the abnormal test step to obtain the target time when the test log in the database does not have the same history test step as the abnormal test step. The second judgment unit 44 judges whether or not there is an abnormality in the target apparatus at the target time. The first determination unit 45 determines an abnormality cause of the abnormal script based on a historical operating condition of the abnormal script in a case where there is no abnormality in the target device. The problem of among the correlation technique test the abnormal script in the continuous integration test through the manual work, need to consume a large amount of time and lead to the inefficiency of test is solved. The abnormal script determining method has the advantages that whether the same historical testing steps exist in the abnormal testing steps or not is determined, whether the target equipment is abnormal or not is determined under the condition that the historical testing steps do not exist, the abnormal reason of the abnormal script is determined through two dimensions of the historical running condition, the abnormal reason of most of the abnormal scripts is accurately determined through the method for accurately and efficiently determining the abnormal script through the automatic process, and therefore the abnormal scripts needing to be confirmed manually are greatly reduced, and the effect of improving the efficiency of testing the abnormal scripts is achieved.
Optionally, in the apparatus for determining a cause of a script exception provided in the embodiment of the present application, the apparatus further includes: a third judging unit, configured to, in a case where there is a historical test step in the test log in the database that is the same as the abnormal test step, judge whether there is a historical abnormal cause in the historical test step; and a second determination unit for determining the historical abnormal reason as the abnormal reason of the abnormal script when the historical abnormal reason exists in the historical test step.
Specifically, when a plurality of test logs in the database have a history test step identical to the abnormal test step, the abnormal test step is characterized not to occur for the first time but to occur in the history test process, and at this time, the abnormal test step does not need to be analyzed again, but the abnormal analysis result of the history test step can be directly used as the abnormal reason of the abnormal test step, so that the analysis process of analyzing the abnormality again is omitted.
However, in the case where it is confirmed that there is a history test step identical to the abnormal test step, there may be a case where the problem corresponding to the history test step has been solved. Optionally, in the apparatus for determining a cause of a script exception provided in the embodiment of the present application, the apparatus further includes: a third determination unit configured to determine whether the historical abnormality cause is resolved; and the execution unit is used for executing the step of acquiring the occurrence time of the abnormal test step and obtaining the target time under the condition that the historical abnormal reason is solved.
Specifically, when the historical abnormal cause corresponding to the historical test step is solved, the script is characterized that the historical abnormal cause does not exist, and the abnormal test step is the same as the historical test step, but the abnormal causes of the two steps may not be consistent, so that the abnormal test step needs to be analyzed again by using other methods, so as to determine the abnormal cause of the abnormal test step.
Fig. 2 is a flowchart of an optional method for determining a script exception reason according to an embodiment of the present application, where as shown in fig. 2, the method includes the following steps:
first, it is determined whether there is an analysis result in the history test step of the exception script, that is, whether the history exception cause in the exception script has been determined, in the case that the history exception cause has been determined, it is necessary to determine whether the history test step is the same as the exception test step, and in the case that the history test step is the same as the exception test step, the history test step and the exception test step may be recorded together as shown in table 1.
After recording, bug repair query can be performed in a log of a development department according to the associated bug ID in the history testing step, so as to determine whether the abnormal reason is solved, and under the condition that the abnormal reason is not solved, the associated bug ID of the abnormal testing step can be kept consistent with the history testing step, such as 111 in table 1, that is, the abnormal reasons of the history testing step and the abnormal testing step are combined, so that the abnormal reason of the history testing step is determined as the abnormal reason of the abnormal testing step, and the effect that the same abnormal condition is not required to be repeatedly processed for multiple times is achieved.
It should be noted that, in the case that the abnormality cause is solved, the characterization history test step and the abnormality cause of the abnormality test step are unrelated, and therefore, it is necessary to determine the abnormality cause of the abnormality test step in another way.
Optionally, in the apparatus for determining a cause of a script exception provided in the embodiment of the present application, the apparatus further includes: the third determining unit is used for determining the test result of the abnormal script and the abnormal phenomenon of the target equipment under the condition that the target equipment is abnormal at the target moment, and judging whether the test result is a preset result; and the fourth determining unit is used for determining the abnormal phenomenon as the abnormal reason of the abnormal script under the condition that the test result is the preset result.
It should be noted that the reason for the failed script test may also be caused by an external factor, i.e. the target device. And for the situations that network faults are detected, an automatic test platform is upgraded or a network element is tested to be down and the like in the continuous integration running time range. The test case failure introduced by this kind of situation will be confusing to some extent. In the case of unknown causes, the analyst may expend a lot of effort to analyze each external factor in turn. Thus, possible reason classifications can be given by automatically collecting these sources of information.
Specifically, when it is determined that the target device is abnormal at the target time, the reason for characterizing the abnormal script may be caused by the abnormality of the target device, and therefore, it is necessary to determine the test result of the abnormal script from the log, determine whether the test result is a preset result, and determine that the script abnormality is caused by the test result of the target device when the test result is the preset result, so that the reason for the abnormality of the abnormal script can be determined quickly and accurately.
For example, at the target time, an automatic test platform component in the target device may perform an upgrade operation, and at this time, when it is determined that the test result is some preset result, for example, a use case is not executed, an irregular exception (a database connection failure, a rest request call failure, an automatic platform component call exception) occurs during the execution of the use case, and the like, it is determined that the test result is related to the platform upgrade.
For another example, at the target time, the network of the target device may have an abnormality, and when it is detected that the network fault of the target device is a loop, a block, an abnormal switch, or the like, it may be determined that the cause of the abnormality of the abnormal script is the network problem of the target device.
Optionally, in the apparatus for determining a cause of a script abnormality provided in the embodiment of the present application, the first determining unit 45 includes: the first judgment module is used for judging whether the accuracy of the historical operating condition is greater than or equal to a first preset value or not; the second judgment module is used for judging whether the version of the abnormal script is changed or not under the condition that the accuracy of the historical running condition is greater than or equal to the first preset value; the first determining module is used for determining the abnormal reason of the abnormal script as the version abnormality of the abnormal script under the condition that the version of the abnormal script is changed; and the first sending module is used for sending the test log to the server side under the condition that the version of the abnormal script is not changed, receiving the abnormal reason fed back by the server side and obtaining the abnormal reason.
Specifically, the historical operating condition is the usage record of the abnormal script in the past, including the test accuracy, i.e. the success rate, of each time the abnormal script is used. Under the condition that the accuracy is greater than the first preset value, the running condition of the script is characterized to be relatively stable, so that whether the script is updated in version recently needs to be determined, and under the condition that the script is changed in version, the reason that the script is abnormal at this time can be determined to be the version problem of the script.
Optionally, in the apparatus for determining a cause of a script abnormality provided in the embodiment of the present application, the first determining unit 45 includes: the third judging module is used for judging whether the accuracy of the historical operating condition is smaller than a second preset value, wherein the second preset value is smaller than the first preset value; the fourth judgment module is used for judging whether the version of the abnormal script is changed or not under the condition that the accuracy of the historical running condition is smaller than the second preset value; the second determining module is used for determining the abnormal occurrence of the stability of the abnormal script as the abnormal reason of the abnormal script under the condition that the version of the abnormal script is not changed; and the second sending module is used for sending the test log to the server side under the condition that the version of the abnormal script is changed, receiving the abnormal reason fed back by the server side and obtaining the abnormal reason.
Specifically, when the accuracy is smaller than the second preset value, the running condition of the script is very unstable, and therefore it is necessary to determine whether the script has recently been updated in version.
Fig. 3 is a flowchart (ii) of a method for determining an optional script exception cause according to an embodiment of the present application, and as shown in fig. 3, it is first determined whether a historical operation accuracy of a script is greater than a first preset value, and when the historical operation accuracy of the script is greater than the first preset value, the script is characterized by strong operation stability, at this time, it is necessary to determine whether an external influence factor exists, and determine that the script exception is caused by the external factor when the external influence factor exists, and when the script exception does not exist, determine whether the script has a version change, and when the script has a version change, determine that the script exception is caused by a script version problem.
Further, under the condition that the historical script operation accuracy is smaller than or equal to the first preset value, whether the historical script operation accuracy is smaller than or equal to the second preset value or not is determined, and under the condition that the historical script operation accuracy is larger than or equal to the second preset value, the historical script operation accuracy is determined to be caused by other factors and needs to be analyzed manually. Under the condition that the historical running accuracy of the script is smaller than the second preset value, the running state of the script is represented to be very unstable, at the moment, whether external influence factors exist needs to be determined, and the script is judged to be abnormal due to the external factors under the existence condition, whether the script is changed in version under the nonexistence condition is judged, and the script is judged to be abnormal due to the robustness under the condition that the script is not changed, so that the effect of accurately and quickly determining the abnormal reason of the script is achieved.
Optionally, in the apparatus for determining a cause of a script exception provided in the embodiment of the present application, the apparatus further includes: the first storage unit is used for storing the abnormal reason of the abnormal script and the abnormal test step into a database in a correlation manner and acquiring a solution of the abnormal reason from the server; and the second storage unit is used for associating and storing the solution and the abnormal reason into the database after the solution is obtained.
Specifically, after the abnormal reason of the script is determined, the abnormal reason and the abnormal testing step can be stored in a database in an associated manner, so that the generation of a new historical testing step is completed, after the solution is obtained, the solution is stored together, so that the supplement of the historical testing step is completed, and further, the support of the analysis of the abnormal reason can be provided under the condition that the subsequent script is abnormal again.
The device for determining the script abnormality reason comprises a processor and a memory, wherein the first acquiring unit 41, the first judging unit 42, the second acquiring unit 43, the second judging unit 44, the first determining unit 45 and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the abnormal scripts in the continuous integration test are tested manually in the related technology by adjusting the kernel parameters, so that a great deal of time is consumed to cause the problem of low test efficiency.
The memory may include volatile memory in a computer readable medium, random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a computer-readable storage medium, on which a program is stored, where the program, when executed by a processor, implements the method for determining the cause of the script abnormality.
The embodiment of the invention provides a processor, which is used for running a program, wherein the method for determining the script exception reason is executed when the program runs.
As shown in fig. 5, an embodiment of the present invention provides an electronic device, where the electronic device 50 includes a processor, a memory, and a program stored in the memory and executable on the processor, and when the processor executes the program, the method for determining the reason for the script exception is implemented. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application also provides a computer program product adapted to perform a program of initializing the method steps of determining the cause of the above-mentioned script abnormality when executed on a data processing device.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for determining a script exception reason is characterized by comprising the following steps:
acquiring a test log of an abnormal script from target equipment, and acquiring an abnormal test step from the test log, wherein the abnormal script runs in the target equipment;
judging whether a test log in a database has a history test step which is the same as the abnormal test step;
under the condition that the test log in the database does not have the same historical test step as the abnormal test step, acquiring the occurrence time of the abnormal test step to obtain a target time;
judging whether the target equipment is abnormal at the target moment;
and under the condition that the target equipment has no abnormality, determining the abnormality reason of the abnormal script according to the historical operating condition of the abnormal script.
2. The method of claim 1, wherein after determining whether the same historical testing steps exist in the test log in the database as the exception testing steps, the method further comprises:
under the condition that the test log in the database has the same historical test steps as the abnormal test steps, judging whether historical abnormal reasons exist in the historical test steps;
and in the case that the historical test step has the historical abnormal reason, determining the historical abnormal reason as the abnormal reason of the abnormal script.
3. The method of claim 1, wherein after determining whether an anomaly exists at the target device at the target time, the method further comprises:
under the condition that the target equipment is abnormal at the target moment, determining a test result of the abnormal script and an abnormal phenomenon of the target equipment, and judging whether the test result is a preset result;
and under the condition that the test result is the preset result, determining the abnormal phenomenon as an abnormal reason of the abnormal script.
4. The method of claim 1, wherein determining the abnormal reason of the abnormal script according to the historical operating conditions of the abnormal script comprises:
judging whether the accuracy of the historical operating condition is greater than or equal to a first preset value or not;
judging whether the version of the abnormal script is changed or not under the condition that the accuracy of the historical running condition is greater than or equal to the first preset value;
determining the abnormal reason of the abnormal script as the version abnormality of the abnormal script under the condition that the version of the abnormal script is changed;
and under the condition that the version of the abnormal script is not changed, sending the test log to a server, and receiving an abnormal reason fed back by the server to obtain the abnormal reason.
5. The method of claim 4, wherein determining the abnormal reason of the abnormal script according to the historical operating conditions of the abnormal script comprises:
judging whether the accuracy of the historical operating condition is smaller than a second preset value, wherein the second preset value is smaller than the first preset value;
under the condition that the accuracy of the historical running condition is smaller than the second preset value, judging whether the version of the abnormal script is changed or not;
under the condition that the version of the abnormal script is not changed, determining that the stability of the abnormal script is abnormal as an abnormal reason of the abnormal script;
and under the condition that the version of the abnormal script is changed, sending the test log to a server, and receiving an abnormal reason fed back by the server to obtain the abnormal reason.
6. The method of claim 2, wherein after determining the historical exception cause as the exception cause of the exception script, the method further comprises:
determining whether the historical cause of the anomaly is resolved;
and under the condition that the historical abnormal reason is solved, executing the step of obtaining the occurrence time of the abnormal test step to obtain a target time.
7. The method of claim 3, wherein after determining the abnormal cause of the abnormal script according to the historical behavior of the abnormal script, the method further comprises:
storing the abnormal reason of the abnormal script and the abnormal testing step into the database in a correlation manner, and acquiring a solution of the abnormal reason from a server;
after the solution is obtained, the solution and the abnormal reason are associated and stored in the database.
8. An apparatus for determining a cause of a script abnormality, comprising:
a first obtaining unit, configured to obtain a test log of an exception script from a target device, and obtain an exception test step from the test log, where the exception script runs in the target device;
the first judging unit is used for judging whether the test logs in the database have the same history test steps as the abnormal test steps;
a second obtaining unit, configured to obtain an occurrence time of the abnormal testing step to obtain a target time when the historical testing step identical to the abnormal testing step does not exist in the test log in the database;
a second judging unit, configured to judge whether the target device is abnormal at the target time;
a first determining unit, configured to determine, when there is no abnormality in the target device, an abnormality cause of the abnormal script according to a historical operating condition of the abnormal script.
9. A computer storage medium for storing a program, wherein the program when executed controls a device in which the computer storage medium is located to execute the method for determining a cause of a script exception according to any one of claims 1 to 7.
10. An electronic device, comprising one or more processors and memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of determining a cause of a script exception of any of claims 1 to 7.
CN202211450899.8A 2022-11-18 2022-11-18 Method and device for determining script abnormal reason, storage medium and electronic equipment Pending CN115757138A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211450899.8A CN115757138A (en) 2022-11-18 2022-11-18 Method and device for determining script abnormal reason, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211450899.8A CN115757138A (en) 2022-11-18 2022-11-18 Method and device for determining script abnormal reason, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN115757138A true CN115757138A (en) 2023-03-07

Family

ID=85333248

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211450899.8A Pending CN115757138A (en) 2022-11-18 2022-11-18 Method and device for determining script abnormal reason, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115757138A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991747A (en) * 2023-09-26 2023-11-03 新华三技术有限公司 Method, device, electronic equipment and storage medium for analyzing test error item

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116991747A (en) * 2023-09-26 2023-11-03 新华三技术有限公司 Method, device, electronic equipment and storage medium for analyzing test error item
CN116991747B (en) * 2023-09-26 2023-12-15 新华三技术有限公司 Method, device, electronic equipment and storage medium for analyzing test error item

Similar Documents

Publication Publication Date Title
US8312322B2 (en) System for automated generation of computer test procedures
CN112269697B (en) Equipment storage performance testing method, system and related device
CN103186463B (en) Determine the method and system of the test specification of software
CN111625434A (en) Database OLTP benchmark performance test method, system and related components
CN110908903B (en) Test method based on editable YAML file
CN115757138A (en) Method and device for determining script abnormal reason, storage medium and electronic equipment
CN113094238A (en) Method and device for monitoring abnormity of business system
CN112148590B (en) Method, device and equipment for determining code coverage rate
CN112148599A (en) Performance pressure measurement method, device and equipment
CN116841653A (en) Execution method and device of operation and maintenance job, processor and electronic equipment
CN111666200A (en) Testing method and terminal for time consumption of cold start of PC software
CN107102938B (en) Test script updating method and device
CN115391110A (en) Test method of storage device, terminal device and computer readable storage medium
CN114791884A (en) Test environment construction method and device, storage medium and electronic equipment
CN111367796B (en) Application program debugging method and device
CN115080426A (en) Program file detection method and device, storage medium and electronic equipment
CN108845932B (en) Unit testing method and device of network library, storage medium and terminal
CN114579252A (en) Method, system, storage medium and equipment for monitoring application state
CN114500249A (en) Root cause positioning method and device
CN114490413A (en) Test data preparation method and device, storage medium and electronic equipment
CN113946509A (en) Buried point searching and comparing method and device, computing device and readable storage medium
CN113468029A (en) Log management method and device, electronic equipment and readable storage medium
CN113656318A (en) Software version testing method and device and computer equipment
CN113111009A (en) Software testing device and testing method
CN112631929A (en) Test case generation method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination