CN114528201A - Abnormal code positioning method, device, equipment and medium - Google Patents

Abnormal code positioning method, device, equipment and medium Download PDF

Info

Publication number
CN114528201A
CN114528201A CN202111354968.0A CN202111354968A CN114528201A CN 114528201 A CN114528201 A CN 114528201A CN 202111354968 A CN202111354968 A CN 202111354968A CN 114528201 A CN114528201 A CN 114528201A
Authority
CN
China
Prior art keywords
abnormal
code
exception
interface
code segment
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
CN202111354968.0A
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.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202111354968.0A priority Critical patent/CN114528201A/en
Publication of CN114528201A publication Critical patent/CN114528201A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application belongs to the technical field of computers, and particularly relates to an abnormal code positioning method, an abnormal code positioning device, computer equipment and a computer readable storage medium, wherein the abnormal code positioning method comprises the following steps: when receiving the abnormal information returned by the tested interface in the test process, determining the interface address of the tested interface; based on the abnormal information and the interface address, remotely inquiring a log file of the tested interface from the tested server to obtain abnormal stack information corresponding to the abnormal information; determining an abnormal code relation chain of the abnormal code segment according to the abnormal stack information; and determining the content of the abnormal code from the abnormal code segment and the associated code segment according to the abnormal code relation chain. By applying the technical scheme provided by the embodiment of the application, the content of the abnormal code is determined in time, and the efficiency of positioning the abnormal code is improved.

Description

Abnormal code positioning method, device, equipment and medium
Technical Field
The invention belongs to the technical field of computers, and particularly relates to an abnormal code positioning method, an abnormal code positioning device, computer equipment and a computer readable storage medium.
Background
With the development of the internet, the functions and requirements of the application programs are higher and higher, and abnormal problems often occur when the application programs provide services for users and run or a system runs and tests. Although, existing anomaly detection schemes can determine the existence of an anomalous section from a test result or an execution log, for example, by detecting a log file of an application program, the existence of an anomalous service or the existence of an anomalous function in the application program is determined. However, when there is an abnormal service or the function implementation process is complicated, it is determined that there is an abnormal part and the script segment causing the abnormality cannot be traced, that is, the code segment causing the abnormality cannot be determined in time.
Disclosure of Invention
The application aims to provide an abnormal code positioning method, an abnormal code positioning device, computer equipment and a computer readable storage medium, so as to solve the problem that an abnormal code positioning mode method in the prior art timely determines a code segment causing an abnormality.
A first aspect of an embodiment of the present application provides an abnormal code positioning method, including:
when receiving abnormal information returned by a tested interface in the test process, determining an interface address of the tested interface; the tested interface is an interface of a tested server;
based on the abnormal information and the interface address, remotely inquiring a log file of the tested interface from the tested server to obtain abnormal stack information corresponding to the abnormal information;
determining an abnormal code relation chain of an abnormal code segment according to the abnormal stack information, wherein the abnormal code relation chain is used for describing the association range between the abnormal code segment and an associated code segment;
and determining the content of the abnormal code from the abnormal code segment and the associated code segment according to the abnormal code relation chain.
A second aspect of an embodiment of the present application provides an abnormal code locating apparatus, including:
the determining module is used for determining the interface address of the tested interface when receiving the abnormal information returned by the tested interface in the testing process; the tested interface is an interface of a tested server;
the query module is used for remotely querying the log file of the tested interface from the tested server based on the abnormal information and the interface address to obtain abnormal stack information corresponding to the abnormal information;
the relation module is used for determining an abnormal code relation chain of an abnormal code segment according to the abnormal stack information, and the abnormal code relation chain is used for describing a relation range between the abnormal code segment and a related code segment;
and the exception module is used for determining exception code contents from the exception code segment and the associated code segment according to the exception code relation chain.
A third aspect of the embodiments of the present application provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the computer device, where the processor implements the steps of the abnormal code locating method provided in the first aspect when executing the computer program.
A fourth aspect of embodiments of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the abnormal code locating method provided by the first aspect.
The abnormal code positioning method, the abnormal code positioning device, the computer equipment and the computer readable storage medium provided by the embodiment of the application have the following beneficial effects that:
according to the abnormal code positioning method, the abnormal code positioning device, the computer equipment and the computer readable storage medium, when the abnormal information returned by the tested interface in the test process is received, the interface address of the tested interface is determined; because the tested interface is the interface of the tested server, the log file of the tested interface can be remotely inquired from the tested server based on the abnormal information and the interface address to obtain the abnormal stack information corresponding to the abnormal information; the exception code relation chain of the exception code section is determined according to the exception stack information, and the exception code relation chain is used for describing the association range between the exception code section and the associated code section; and analyzing inheritance and calling relations between the abnormal code segments and the associated code segments, so that the abnormal code content is determined from the abnormal code segments and the associated code segments according to the abnormal code relation chain. The efficiency of locating the abnormal code is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the embodiments or drawings used in the prior art description, and obviously, the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a flowchart illustrating an implementation of an exception code locating method according to an embodiment of the present application;
fig. 2 is a block diagram illustrating an abnormal code locating apparatus according to an embodiment of the present disclosure;
fig. 3 is a block diagram of a computer device according to an embodiment of the present disclosure.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention more clearly apparent, the present invention is further described in 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 invention and are not intended to limit the invention.
In the abnormal code positioning method provided by this embodiment, the execution subject is a target server in the server cluster for positioning the abnormal code. Here, the server cluster may be a server cluster composed of a plurality of servers, and the distributed system is constructed based on the server cluster so that each component required for constructing the distributed system can be configured into each server in the server cluster, and the server configured with the distributed system component may also be referred to as a component server. Data sharing or data synchronization can be carried out among the servers in the server cluster. On this basis, a target script file is configured for any server in the server cluster, and the target script file describes the abnormal code positioning method provided by the embodiment, so that the server configured with the target script file can execute each step in the abnormal code positioning method by executing the target script file. Or, configuring a new server for the server cluster, configuring an object script file for the new server, and describing the abnormal code location method provided by this embodiment by the object script file, so that the new server can execute each step in the abnormal code location method by executing the object script file.
When the abnormal information returned by the tested interface in the test process is received, the target server determines the interface address of the tested interface. Because the tested interface is the interface of the tested server, the target server remotely queries the log file of the tested interface based on the abnormal information and the interface address, and the target server obtains the abnormal stack information corresponding to the abnormal information; the target server determines an abnormal code relation chain of the abnormal code segment according to the abnormal stack information, and the abnormal code relation chain is used for describing the association range between the abnormal code segment and the associated code segment; the target server can analyze inheritance and calling relations between the abnormal code segments and the management code segments, so that the target server can determine abnormal code contents from the abnormal code segments and the associated code segments according to the abnormal code relation chain. The efficiency of locating the abnormal code is improved.
Referring to fig. 1, fig. 1 is a flowchart illustrating an implementation of an exception code locating method according to an embodiment of the present application. The abnormal code positioning method comprises the following steps:
s11: when receiving abnormal information returned by a tested interface in the test process, determining an interface address of the tested interface; the tested interface is an interface of the tested server.
In step S11, when performing the interface test on the server under test, the target server typically receives the returned information of the server under test interface, and the obtained returned information can represent whether the expected result is returned. The target server is the server implementing the scheme, and the tested server is another server storing the abnormal code script file. The returned information refers to the interface calling condition that the interface returns to the interface when being called. And generating information returned by the interface according to the difference of the calling conditions of the interface and a preset rule. In the process that the terminal requests to call the interface, the interface return information received by the target server divides the normal condition and the abnormal condition according to the setting in the preset rule, namely, the normal and the abnormal condition of the call condition represented by the interface are represented by numerical values or character information. For example, if the interface return value should return to 1 under normal conditions, but the actual condition is that the interface return value acquired by the terminal is 0 or-1, the returned information of the tested interface is abnormal information, and the abnormal information indicates that the tested interface cannot normally operate and an abnormal operation condition occurs. Different functions are realized according to the interface. The interface is actually a specific function in the background. The interface test is the implementation process of the interface, and the interface test is used for verifying whether the implementation of the interface is correct.
The exception information refers to information of an exception return value of the calling interface. The exception information comprises an exception code, exception time and an exception type, wherein the exception time refers to specific time for returning to the tested interface. The exception type refers to preset exception error reporting information, and includes a message prompt, an exception code and the like. The interface address refers to the address of the server under test deployed by the system providing the interface under test. The interface address is determined so as to log in the address of the tested server and find out the log file corresponding to the abnormal information.
As an implementation manner of the embodiment of the present application, step S11 includes:
sending a request for calling a tested interface to a tested server to receive test information returned by the tested server according to the request;
and when preset abnormal information exists in the test information, determining the interface address of the tested interface.
Specifically, when the interface test of the server under test is performed, a request for calling the interface under test is sent to the server under test through the target server, the server under test receives the request of the target server, and the server under test processes the request and returns test information to the target server. Returned test information
As an example, when the tested server is preset to return test information when the calling of the interface is successful or failed, and when the test information is preset abnormal information, the code may be abnormal, and the interface address of the tested server needs to be registered to find the abnormal code and correct and revise the abnormal code.
S12: and remotely inquiring the log file of the tested interface from the tested server based on the abnormal information and the interface address to obtain abnormal stack information corresponding to the abnormal information.
In step S12, the log file refers to a file that records events occurring during the operation of the operating system or other software. The program log added in the software can track the track of the software code during operation and reflect the historical operation condition of the software, so that developers and testers can solve the problem of error or abnormality of the code by means of log files. The remote inquiry log file can remotely log in the interface address of the tested server through the obtained login permission, and the content of the log file is obtained by obtaining the directory for storing the log file by using a command. The authority mode for logging in the address of the tested server can adopt an SSH mode or remotely connect and log in the tested server according to the IP address and the password so as to inquire the log file. The content of the log file can be printed on a console or viewed through a background file. The log file includes exception information, and also includes time information for recording the date and time at which the event was written to the log, the event type, state information of the application, and the like.
The exception stack information is an error reporting information set prompting an error in the log file. The exception stack information includes exception information and a file path of the exception code section, wherein the file path of the exception code section includes a package name of the exception code section, a class name of the exception code section, a method name of the exception code section, and a number of rows of the exception code section. And when the abnormal time and the abnormal type on the log file are the same as the abnormal time and the abnormal type returned by the interface, finding corresponding error reporting information, and forming abnormal stack information by the error reporting information.
As an implementation manner of the embodiment of the present application, step S12 includes:
obtaining the login authority of the tested server;
logging in the interface address based on the login authority, and inquiring a log file corresponding to the tested interface;
and positioning the log file according to the abnormal information to obtain abnormal stack information corresponding to the abnormal information.
Specifically, the login authority of the server to be tested may be obtained by logging in the interface address of the server to be tested in an SSH manner or in an IP address and password input manner, and querying the location of the log file and viewing the log file using the command. And actually searching corresponding abnormal stack information of the log file content according to the abnormal time and the abnormal type in the abnormal information when the log file is positioned according to the abnormal information. For example, the message prompt in the returned abnormal information is "during system clearing, please try again later", and according to "during system clearing, please try again later" to retrieve the content of the log file, the content of the log file containing the message prompt is found. Taking this as an example, all exception stack information is found according to the exception code, exception time and exception type of the returned exception information.
S13: and determining an abnormal code relation chain of the abnormal code segment according to the abnormal stack information, wherein the abnormal code relation chain is used for describing the association range between the abnormal code segment and the associated code segment.
In step S13, since the exception stack information includes the file path of the exception code section, the file path of the exception code section includes the package name of the exception code section, the class name of the exception code section, the method name of the exception code section, and the number of rows of the exception code section. According to the file path of the abnormal code segment in the abnormal stack information, the corresponding position of the abnormal code segment can be found from the source code, so that the content of the abnormal code segment can be found. The abnormal code relation chain can trace the source to find the associated code segment with calling and inheritance relations with the abnormal code segment based on the content of the abnormal code segment with error report, and find the bottom abnormal code content from local to whole.
An exception code relationship chain refers to the extent of association between an exception code segment and an associated code segment. The exception code relationship chain includes the calling relationship and the inheritance relationship of classes of methods between the exception code segment and the associated code segment. The child class in the general exception code section inherits the parent class of other codes, and the exception code section also calls methods of other codes, wherein the associated code section is the codes of the parent class inherited by the exception code section and the called methods. Determining the exception code relationship chain is to find the inheritance relationship and the method calling relationship of all classes of the exception code segment. Among them, the calling relationship of the method is that a new method is executed by calling the method in the code writing process. A class is a type of data that includes methods and attributes. A class may include multiple methods. The inheritance relationship of the class is that the subclass can only call the attribute and the method of the parent class, and the parent class cannot call the subclass. And subclasses may add methods and properties not found in parent classes.
Because the inheritance relationship of the class exists in the abnormal code segment, the inheritance relationship of the class of the abnormal code segment is sorted out from the abnormal code segment. And because one class can call a plurality of methods, after the succession relation of the class in the associated code is cleared up, the method calling relation under the calling class is cleared up. For example, if the exception code section calls the property of the parent class, but calls the method of the child class, then the resulting exception code is a child class rather than a parent class. There are call relationships between methods in the exception code section. Determining the relationship chain of the exception code may be accomplished by obtaining the method names of the exception code segment and the associated code segment. The calling relationship may also be determined according to the position relationship of the abnormal code segment or the method of the associated code segment in the abnormal code segment or the associated code segment. For example, a method located in a row before the associated code segment is called by a method of the associated code segment in a row after.
As an implementation manner of the embodiment of the present application, step S13 includes:
positioning an abnormal code segment in a source code based on the number of rows of the abnormal code segment in the abnormal stack information; wherein the exception code section is code in a source code line indicated by a line number of the exception code section;
extracting the class name and the method name of the abnormal code segment, and positioning an associated code segment from the source code;
and determining an abnormal code relation chain according to the abnormal code segment and the related code segment.
Specifically, the association code segment is a class inherited by the exception code segment or a related code of the calling method. The class name and the method name of the abnormal code segment are extracted, and the inheritance relationship of the class of the abnormal code segment and the calling relationship of the method can be orderly worked out. And finding the related code segment from the source code according to the class name inherited by the abnormal code segment and the called method name. And the inheritance relationship of the class of the associated code segment and the calling relationship of the method are also ordered to the associated code segment by the same method, and finally the abnormal code relation chain can be determined.
As an implementation manner of the embodiment, the above step of locating an abnormal code segment in the source code based on the line number of the abnormal code segment in the abnormal stack information includes:
determining a code line number of at least one line of code from the source code based on a line number of exception code segments in the exception stack information;
and positioning the code line number of the at least one line of codes, and taking the codes in the code line with the code line number consistent with the line number of the abnormal code segment as the abnormal code segment.
Specifically, because the number of rows of the abnormal code segment exists in the abnormal stack information, the number of code rows is determined in the source code according to the number of rows of the abnormal code segment, and because the number of code rows of the source code corresponds to the code content, the specific code content of the abnormal code segment can be determined from the source code according to the number of rows of the abnormal code segment. The abnormal code segment is positioned in the source code, and the content of the abnormal code segment can be determined from the source code according to the package class of the abnormal code segment in the abnormal stack information, the method name of the abnormal code segment and the like.
S14: and according to the abnormal code relation chain, determining abnormal code content from the abnormal code segment and the related code segment.
In step S14, it is determined that the exception code relationship chain between the exception code segment and the associated code segment is found from the exception code segment in the source code, and the finally obtained exception code content causing the exception is the lowest code that does not call other methods according to the exception code relationship chain. When the abnormal information returned by the interface in the test process is received, the abnormal code content is positioned by the method of the embodiment, and then the abnormal code content is analyzed, so that the code with the abnormal code can be positioned in real time only by arranging the abnormal code relation chain of the abnormal code segment without performing mass analysis on the source code, and the efficiency of positioning the abnormal code is high.
When receiving the abnormal information returned by the tested interface in the test process, determining the interface address of the tested interface; because the tested interface is the interface of the tested server; therefore, based on the abnormal information and the interface address, the log file of the tested interface can be remotely inquired from the tested server to obtain the abnormal stack information corresponding to the abnormal information; the exception code relation chain of the exception code segment is determined according to the exception stack information, and the exception code relation chain is used for describing the association range between the exception code segment and the associated code segment; and analyzing inheritance and calling relations between the abnormal code segments and the associated code segments, so that the abnormal code content is determined from the abnormal code segments and the associated code segments according to the abnormal code relation chain. The efficiency of locating the abnormal code is improved.
As an implementation manner of the embodiment of the present application, step S14 includes:
determining a code segment without a calling relation from the abnormal code segment and the associated code segment as a bottom code segment according to the abnormal code relation chain;
and taking the content of the bottom code segment and the line number of the bottom code segment as the content of the abnormal code.
Specifically, the exception code relation chain is to find the associated code segment associated with the exception code segment according to the error-reported exception code segment, and sort out the call and inheritance relation from the exception code segment and the associated code segment. Finally, finding the abnormal code content needs to find the code segment which is not called at the bottom layer from the abnormal code relation chain, and the content and the line number of the code segment at the bottom layer are used as the abnormal code content to check whether the abnormal code content has an abnormality.
As an implementation manner of the embodiment of the present application, after step S14, the method may further include:
and generating an abnormal notification according to the abnormal code content, and pushing the abnormal notification.
Specifically, the content of the abnormal code is pushed to a developer as a notification message, and the developer modifies the abnormal code according to the notification message. When the exception code content is determined, an exception notification may be generated based on the exception code content to notify developers based on the exception notification. When the abnormal notification is generated, the abnormal notification can be generated according to the original batch notes of the abnormal code content, or the abnormal code content can be arranged into language characters for pushing.
Corresponding to the above method embodiment, an embodiment of the present invention further provides an exception code locating apparatus, as shown in fig. 2, where the apparatus 30 may include the following modules:
the determining module 31 is configured to determine an interface address of the interface to be tested when receiving abnormal information returned by the interface to be tested in the testing process; the tested interface is an interface of a tested server;
the query module 32 is configured to remotely query the log file of the tested interface from the tested server based on the exception information and the interface address to obtain exception stack information corresponding to the exception information;
the relation module 33 is configured to determine an exception code relation chain of an exception code segment according to the exception stack information, where the exception code relation chain is used to describe an association range between the exception code segment and an association code segment;
and the exception module 34 is configured to determine exception code content from the exception code segment and the associated code segment according to the exception code relationship chain.
It should be understood that, in the structural block diagram of the exception code positioning apparatus shown in fig. 2, each module is used to execute each step in the embodiment corresponding to fig. 1, and each step in the embodiment corresponding to fig. 1 has been explained in detail in the foregoing embodiment, and please refer to the relevant description in the embodiment corresponding to fig. 1 specifically, which is not described herein again.
Fig. 3 is a block diagram of a computer device according to an embodiment of the present application. As shown in fig. 3, the computer device 40 of this embodiment includes: a processor 41, a memory 42 and a computer program 43, such as a program of an exception code location method, stored in said memory 42 and executable on said processor 41. The processor 41, when executing the computer program 43, implements the steps of the above-mentioned embodiments of the abnormal code locating method, such as S11 to S14 shown in fig. 1. Alternatively, when the processor 41 executes the computer program 43, the functions of the modules in the embodiment corresponding to fig. 2, for example, the functions of the modules 31 to 34 shown in fig. 2, are implemented, for which reference is specifically made to the relevant description in the embodiment corresponding to fig. 2, which is not repeated herein.
Illustratively, the computer program 43 may be partitioned into one or more modules that are stored in the memory 42 and executed by the processor 41 to accomplish the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 43 in the computer device 40.
The turntable device may include, but is not limited to, a processor 41, a memory 42. Those skilled in the art will appreciate that fig. 3 is merely an example of a computer device 40 and is not intended to limit the computer device 40 and may include more or fewer components than shown, or some components may be combined, or different components, such as the turntable device may also include input output devices, network access devices, buses, etc.
The Processor 41 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 42 may be an internal storage unit of the computer device 40, such as a hard disk or a memory of the computer device 40. The memory 42 may also be an external storage device of the computer device 40, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 40. Further, the memory 42 may also include both internal storage units and external storage devices of the computer device 40. The memory 42 is used for storing the computer program and other programs and data required by the turntable device. The memory 42 may also be used to temporarily store data that has been output or is to be output.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the method for locating abnormal code in the above-described embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by hardware instructions of a computer program, which may be stored in a computer-readable storage medium, and when executed, the computer program may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other computer-readable storage medium used in the embodiments provided herein can 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 above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the present disclosure, and are intended to be included within the scope thereof.

Claims (10)

1. An abnormal code positioning method, comprising:
when receiving abnormal information returned by a tested interface in the test process, determining an interface address of the tested interface; the tested interface is an interface of a tested server;
based on the abnormal information and the interface address, remotely inquiring a log file of the tested interface from the tested server to obtain abnormal stack information corresponding to the abnormal information;
determining an abnormal code relation chain of an abnormal code segment according to the abnormal stack information, wherein the abnormal code relation chain is used for describing the association range between the abnormal code segment and an associated code segment;
and determining the content of the abnormal code from the abnormal code segment and the associated code segment according to the abnormal code relation chain.
2. The method of claim 1, wherein determining the interface address of the interface under test when receiving exception information returned by the interface under test during the test process comprises:
sending a request for calling a tested interface to a tested server to receive test information returned by the tested server according to the request;
and when preset abnormal information exists in the test information, determining the interface address of the tested interface.
3. The method of claim 1, wherein the remotely querying a log file of the interface under test from the server under test based on the exception information and the interface address to obtain exception stack information corresponding to the exception information comprises:
obtaining the login authority of the tested server;
logging in the interface address based on the login authority, and inquiring a log file corresponding to the tested interface;
and positioning the log file according to the abnormal information to obtain abnormal stack information corresponding to the abnormal information.
4. The method of claim 1, wherein determining an exception code relationship chain for an exception code segment based on the exception stack information comprises:
positioning an abnormal code segment in a source code based on the number of rows of the abnormal code segment in the abnormal stack information; wherein the exception code section is code in a source code line indicated by a line number of the exception code section;
extracting the class name and the method name of the abnormal code segment, and positioning an associated code segment from the source code;
and determining an abnormal code relation chain according to the abnormal code segment and the related code segment.
5. The method of claim 4, wherein locating an exception code section in source code based on the number of rows of exception code sections in the exception stack information comprises:
determining a code line number of at least one line of code from the source code based on a line number of exception code segments in the exception stack information;
and positioning the code line number of the at least one line of codes, and taking the code in the code line with the code line number consistent with the line number of the abnormal code segment as the abnormal code segment.
6. The method of claim 1, wherein said determining exception code content from said exception code section and said associated code section according to said exception code relationship chain comprises:
determining a code segment without a calling relation from the abnormal code segment and the associated code segment as a bottom code segment according to the abnormal code relation chain;
and taking the content of the bottom code segment and the line number of the bottom code segment as the content of the abnormal code.
7. The method of any of claims 1 to 6, further comprising:
and generating an abnormal notification according to the abnormal code content, and pushing the abnormal notification.
8. An exception code locating apparatus, comprising:
the determining module is used for determining the interface address of the tested interface when receiving the abnormal information returned by the tested interface in the testing process; the tested interface is an interface of a tested server;
the query module is used for remotely querying the log file of the tested interface from the tested server based on the abnormal information and the interface address to obtain abnormal stack information corresponding to the abnormal information;
the relation module is used for determining an abnormal code relation chain of an abnormal code segment according to the abnormal stack information, and the abnormal code relation chain is used for describing a relation range between the abnormal code segment and a related code segment;
and the exception module is used for determining exception code contents from the exception code segment and the associated code segment according to the exception code relation chain.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of a method according to any one of claims 1 to 7.
CN202111354968.0A 2021-11-16 2021-11-16 Abnormal code positioning method, device, equipment and medium Pending CN114528201A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111354968.0A CN114528201A (en) 2021-11-16 2021-11-16 Abnormal code positioning method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111354968.0A CN114528201A (en) 2021-11-16 2021-11-16 Abnormal code positioning method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN114528201A true CN114528201A (en) 2022-05-24

Family

ID=81619061

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111354968.0A Pending CN114528201A (en) 2021-11-16 2021-11-16 Abnormal code positioning method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114528201A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114880247A (en) * 2022-07-04 2022-08-09 成都行远捷科技有限公司 BUG analysis method based on log guidance system under distributed condition
CN116126735A (en) * 2023-04-13 2023-05-16 紫光同芯微电子有限公司 Code exception handling method, device, equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114880247A (en) * 2022-07-04 2022-08-09 成都行远捷科技有限公司 BUG analysis method based on log guidance system under distributed condition
CN116126735A (en) * 2023-04-13 2023-05-16 紫光同芯微电子有限公司 Code exception handling method, device, equipment and storage medium
CN116126735B (en) * 2023-04-13 2023-08-15 紫光同芯微电子有限公司 Code exception handling method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109032824B (en) Database verification method, database verification device, computer equipment and storage medium
CN111240994B (en) Vulnerability processing method and device, electronic equipment and readable storage medium
CN109446068B (en) Interface test method, device, computer equipment and storage medium
US9990501B2 (en) Diagnosing and tracking product vulnerabilities for telecommunication devices via a database
CN110134658B (en) Log monitoring method, device, computer equipment and storage medium
CN114528201A (en) Abnormal code positioning method, device, equipment and medium
CN111552632B (en) Interface testing method and device
CN109542764B (en) Webpage automatic testing method and device, computer equipment and storage medium
US9513997B2 (en) Test data management
CN111782456B (en) Anomaly detection method, device, computer equipment and storage medium
CN112650688A (en) Automated regression testing method, associated device and computer program product
CN111666205A (en) Data auditing method, system, computer equipment and storage medium
CN112866319B (en) Log data processing method, system and storage medium
CN108650123B (en) Fault information recording method, device, equipment and storage medium
CN114816993A (en) Full link interface test method, system, medium and electronic equipment
CN111522881B (en) Service data processing method, device, server and storage medium
CN112612706A (en) Automated testing method, computer device and storage medium
CN116599881A (en) Cloud platform tenant modeling test method, device, equipment and storage medium
US9354962B1 (en) Memory dump file collection and analysis using analysis server and cloud knowledge base
CN113259154B (en) Method and device for informing middle station data verification, computer equipment and storage medium
CN115269424A (en) Automatic regression testing method, device, equipment and storage medium for production flow
CN110618943B (en) Security service test method and device, electronic equipment and readable storage medium
CN114500249A (en) Root cause positioning method and device
CN112035471A (en) Transaction processing method and computer equipment
CN113672278B (en) Service node version control method and device under micro-service architecture

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