CN114281705A - Software defect positioning method and device, electronic equipment and medium - Google Patents

Software defect positioning method and device, electronic equipment and medium Download PDF

Info

Publication number
CN114281705A
CN114281705A CN202111647492.XA CN202111647492A CN114281705A CN 114281705 A CN114281705 A CN 114281705A CN 202111647492 A CN202111647492 A CN 202111647492A CN 114281705 A CN114281705 A CN 114281705A
Authority
CN
China
Prior art keywords
software
code
defect
software defect
executed
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
CN202111647492.XA
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.)
CERNET Corp
Original Assignee
CERNET Corp
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 CERNET Corp filed Critical CERNET Corp
Priority to CN202111647492.XA priority Critical patent/CN114281705A/en
Publication of CN114281705A publication Critical patent/CN114281705A/en
Pending legal-status Critical Current

Links

Images

Abstract

The present disclosure provides a software defect positioning method and device, the method comprising: acquiring a software test log, wherein the software test log comprises software defect information; extracting code coverage information in the software test log, wherein the code coverage information is used for representing the operation completion degree of each row of codes; obtaining an executed code according to the code coverage information; software bugs are located from the executed code. The method disclosed by the invention reduces the searching range of software defects, improves the software testing efficiency and lays a foundation for further software defect analysis.

Description

Software defect positioning method and device, electronic equipment and medium
Technical Field
The present disclosure relates to the field of software testing technologies, and in particular, to a method and an apparatus for locating software defects, an electronic device, and a medium.
Background
With the development and popularization of information technology, software is visible everywhere in our life, and becomes an essential component of informatization, so the quality of the software is very important. As the code constituting the software, the quality of the code is related to not only the cost of software development but also the experience of the user on the software. Defects in the code may have a serious impact on the quality of the code, and the later a potential defect is discovered, the more serious the consequences. As is well known, the application in software development relates to a plurality of fields and modules, the irregularity of software developers also causes the irregularity of code quality, and the defects in the inquiry and positioning of codes are very important.
Currently, in software testing, the center of gravity of a testing method is mostly to analyze tested defects or errors, for example, a white box testing method is used to test and detect the internal performance of a product, and to check whether a path in a program can complete work as required. And the function is tested by the black box test method. All methods aim to test whether software is normal or not, the characteristics of time, position and the like of the occurrence of defects are seldom concerned, and the software testing methods have more steps and high complexity and need a lot of time cost for testing personnel.
Disclosure of Invention
Technical problem to be solved
In view of the prior art, the present disclosure provides a method, an apparatus, an electronic device, and a medium for locating a software defect, which are used to at least partially solve the above technical problems.
(II) technical scheme
The present disclosure provides a software defect positioning method, including: acquiring a software test log, wherein the software test log comprises software defect information; extracting code coverage information in the software test log, wherein the code coverage information is used for representing the operation completion degree of each row of codes; obtaining an executed code according to the code coverage information; software bugs are located from the executed code.
Optionally, the software defect locating method further includes: the executed code is marked.
Optionally, obtaining the executed code according to the code coverage information includes: summarizing lines or paragraphs where marked codes are located according to marks of codes of each line to obtain code blocks; the executed code is obtained from the code block.
Optionally, locating the software defect from the executed code comprises: judging the code position of the software defect according to the executed code; uniformly coding different files and paragraphs containing defects and sequencing according to the defect level; software defects are located from the sorted code.
Optionally, the software defect locating method further includes: starting software testing to detect software defects; intercepting a screen interface image where the software defect is located; outputting an information character string of the software defect to obtain a software test log, wherein the information character string comprises the time of the defect; software defects are located from the executed code based on the screen interface image.
Optionally, the software defect locating method further includes: adding the code coverage information into the operation record of the detected software; and marking the code coverage information after the test is finished.
Optionally, after the software defect is located, the software defect locating method further includes: and storing the system state, wherein the system state comprises a process, a memory and a CPU load.
Another aspect of the present disclosure provides a software defect locating apparatus, including: the acquisition module is used for acquiring a software test log, and the software test log comprises software defect information; the extraction module is used for extracting code coverage information in the software test log, and the code coverage information is used for representing the operation completion degree of each row of codes; and the positioning module is used for obtaining the executed code according to the code coverage information and positioning the software defect from the executed code.
Another aspect of the present disclosure provides an electronic device including: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the software defect location method according to the embodiment of the disclosure.
Another aspect of the present disclosure provides a computer-readable storage medium storing computer-executable instructions for implementing a software defect localization method according to an embodiment of the present disclosure when the instructions are executed.
(III) advantageous effects
The present disclosure provides a software defect locating method, which determines code coverage information through software defect information in a software test log, i.e. distinguishes an executed code from an unexecuted code, and then locates a software defect from the executed code. The method disclosed by the invention reduces the searching range of software defects, improves the software testing efficiency and lays a foundation for further software defect analysis.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates a flow chart of a software defect localization method according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a software defect localization method according to another embodiment of the present disclosure;
FIG. 3 schematically illustrates a block diagram of a software defect locating apparatus according to an embodiment of the present disclosure;
FIG. 4 schematically shows a block diagram of an electronic device adapted to implement the software defect localization method according to an embodiment of the present disclosure.
Detailed Description
For the purpose of promoting a better understanding of the objects, aspects and advantages of the present disclosure, reference is made to the following detailed description taken in conjunction with the accompanying drawings.
It should be noted that in the drawings or description, the same drawing reference numerals are used for similar or identical parts. Features of the embodiments illustrated in the description may be freely combined to form new embodiments without conflict, and each claim may be individually referred to as an embodiment or features of the claims may be combined to form a new embodiment, and in the drawings, the shape or thickness of the embodiment may be enlarged and simplified or conveniently indicated. Further, elements or implementations not shown or described in the drawings are of a form known to those of ordinary skill in the art. Additionally, while exemplifications of parameters including particular values may be provided herein, it is to be understood that the parameters need not be exactly equal to the respective values, but may be approximated to the respective values within acceptable error margins or design constraints.
Unless a technical obstacle or contradiction exists, the above-described various embodiments of the present disclosure may be freely combined to form further embodiments, which are all within the scope of protection of the present disclosure.
While the present disclosure has been described in connection with the accompanying drawings, the embodiments disclosed in the drawings are intended to be illustrative of the preferred embodiments of the disclosure, and should not be construed as limiting the disclosure. The dimensional proportions in the drawings are merely schematic and are not to be understood as limiting the disclosure.
Although a few embodiments of the present general inventive concept have been shown and described, it would be appreciated by those skilled in the art that changes may be made in these embodiments without departing from the principles and spirit of the general inventive concept, the scope of which is defined in the claims and their equivalents.
FIG. 1 schematically shows a flow chart of a software defect locating method according to an embodiment of the present disclosure.
According to an embodiment of the present disclosure, as shown in fig. 1, a software defect locating method includes, for example:
s110, a software test log is obtained, and the software test log comprises software defect information.
According to the embodiment of the disclosure, after the software test is started, the defects in the software are gradually tested. When a software defect is found, a log output system of the software is activated to output a software defect information character string, namely, a software test log is generated. The log output system comprises a dump server module and/or a dump client module, for example. And the unloading server module can directly unload the software test log to the server. The log is firstly transferred to the client side by the transfer client side module, and then the server can directly read the coverage rate information in the memory of the client side running the target software through the interaction with the client side. Or, the coverage rate information may be downloaded from the memory of the client running the target software to the hard disk of the client where the target software is located, and then uploaded to the server.
According to an embodiment of the present disclosure, the software defect information string includes, for example, a time point when a defect occurs in the software. When the test is a manual test, the software defect information string is output, for example, by the user pressing an output control button. The software defect information string can also be automatically output through automatic testing.
And S120, extracting code coverage information in the software test log, wherein the code coverage information comprises the operation completion degree of each row of codes.
According to the embodiment of the disclosure, after a recording completion request sent by a test system is received, coverage information in a target software test process is obtained from running target software. The coverage information includes, for example, the operation status of each line of code, that is, the code that has been executed and the code that has not been executed. The coverage information is, for example, information recorded by code embedded in the target software during testing. The code that has been run during the software testing process can be determined from the coverage information.
It can be understood that, before the coverage information in the target software testing process is obtained, the coverage information in the target software to be tested can be cleared first, so as to eliminate the interference of non-target defects, reduce the data volume to be processed and accelerate the data processing speed. Namely, after receiving a request for starting recording sent by a client, sending an instruction to target software of the client, and clearing coverage rate information.
S130, obtaining the executed code according to the code coverage information, and positioning the software defect from the executed code.
According to an embodiment of the present disclosure, a software bug exists in code that was run during software testing. And marking the codes according to the running condition of each line of codes, and then summarizing the codes according to the marks of each line of codes. The codes with the marks representing the running are gathered together, and the code blocks containing the running are returned. For the convenience of query, the running status flag in the whole code block can be kept, and as before, different identifiers can be used to indicate the running and non-running rows of codes in the same code block. By returning the whole code block, the abnormal functional module in the target software can be positioned more easily, so that the defect positioning is more favorably realized.
Preferably, when a software defect is detected, the screen image of the current software with the defect is stored, and the software defect in the code block can be more conveniently and quickly positioned by combining the code block returned according to the software test log.
Preferably, in the software testing process, the coverage rate information acquired from the test log can be added to the operation record of the target software, and the coverage rate information recording the completion of the testing process is marked. By marking the coverage rate information in the operation record, the code coverage rate in the whole software testing process can be counted conveniently, and a basis is provided for evaluating the software testing effect on the whole.
According to the embodiment of the disclosure, after the code block containing the software defect is obtained, monitoring of quality problems can be carried out on the source code in use, and the selection of the source code address file is carried out according to the main direction of the source code in the running process. Then, by means of system analysis, the generated system problems are integrated, and if defect problems exist at the beginning of different system branches, systematic processing needs to be performed on the codes and paragraphs of different files, for example, adding a coding prefix to facilitate locating different files or paragraphs. When the system can grade and distinguish the source code quality with defect problems, operators can label the code defects with different colors according to different main degrees. And then, the information problems of different types are sequenced, so that the problem priority is conveniently checked, important problems are preferably solved, the system can reasonably and sequentially process the paragraphs with wrong information in the process of distinguishing the source codes, and the quality and the positioning efficiency of software defect positioning are improved.
According to the embodiment of the disclosure, after the software defect is located, the system state can be stored, and the system state includes, for example, a process, a memory, a CPU load, and the like. And the positioned software defects are analyzed by combining the system state, new analysis dimensionality is added for software defect positioning and analysis, and the comprehensiveness of software testing is improved.
FIG. 2 schematically shows a flowchart of a software defect locating method according to another embodiment of the present disclosure.
As shown in fig. 2, in order to facilitate the overall understanding of the method of the present disclosure, the software defect locating method proposed by the present disclosure is explained by specific embodiments, for example, including:
s210, the user starts the client and performs software testing.
And S220, activating a log output system when the software is found to have defects.
And S230, outputting a software defect information character string which comprises the time point when the defect occurs.
And S240, saving the screen image when the current software has defects.
And S250, acquiring coverage rate information in the target software testing process from the memory running the target software. The coverage rate information includes, for example, the operating condition of each line of codes and the marking of each line of codes according to the operating condition.
And S260, determining which types of codes are operated in the test process according to the operation condition and the mark in the coverage rate information, and performing specific information such as abnormal jump on which line. The marks of each line of codes in the test process can be different marks according to the running condition of the line of codes, for example, different identifiers are added behind the running codes and the non-running codes, the running codes can be determined through the marks, and the specific line number of the codes and the specific position information of the class to which the codes belong can be determined. And finally, summarizing the codes according to different marks, and collecting the codes with the same marks together so as to obtain all the operated codes in a centralized manner.
S270, eliminating the parts which are certainly not abnormal by means of marking, and performing investigation and positioning on the rest parts which possibly cause the abnormal, so that the software defects can be quickly positioned. The returned code may not only be all the code that has been run, but also return the code block in which the code that has the exception is located, that is, if only one row of code in a certain code block has the exception, return the whole code block. For the convenience of query, the running status flag in the whole code block can be reserved, and as before, identifiers can be used to indicate the running and non-running lines of codes in the same code block.
In summary, the embodiment of the present disclosure provides a software defect positioning method. And determining code coverage information through the software defect information in the software test log, distinguishing the executed code from the non-executed code, and then locating the software defect from the executed code. And the software defects can be quickly and accurately positioned by combining the code screenshots of the software defects.
FIG. 3 schematically shows a block diagram of a software defect locating apparatus according to an embodiment of the present disclosure.
According to an embodiment of the present disclosure, as shown in fig. 3, the software defect locating apparatus 300 includes, for example:
the obtaining module 310 is configured to obtain a software test log, where the software test log includes software defect information.
And the extracting module 320 is configured to extract code coverage information in the software test log, where the code coverage information is used to represent the operation completion of each row of codes.
And the positioning module 330 is configured to obtain an executed code according to the code coverage information, and position a software defect from the executed code.
The product embodiment is similar to the method embodiment in portions where details are not given, and please refer to the method embodiment, which is not described herein again.
FIG. 4 schematically shows a block diagram of an electronic device adapted to implement the software defect localization method according to an embodiment of the present disclosure.
According to an embodiment of the present disclosure, as shown in fig. 4, an electronic device 400 according to an embodiment of the present disclosure includes a processor 401 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. Processor 401 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 401 may also include onboard memory for caching purposes. Processor 401 may include a single processing unit or multiple processing units for performing the different actions of the method flows in accordance with embodiments of the present disclosure.
In the RAM 403, various programs and data necessary for the operation of the electronic apparatus 400 are stored. The processor 401, ROM 402 and RAM 403 are connected to each other by a bus 404. The processor 401 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 402 and/or the RAM 403. Note that the programs may also be stored in one or more memories other than the ROM 402 and RAM 403. The processor 401 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, electronic device 400 may also include an input/output (I/O) interface 405, input/output (I/O) interface 405 also being connected to bus 404. Electronic device 400 may also include one or more of the following components connected to I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A driver 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include ROM 402 and/or RAM 403 and/or one or more memories other than ROM 402 and RAM 403 described above.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems and methods according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (10)

1. A software defect locating method comprises the following steps:
acquiring a software test log, wherein the software test log comprises software defect information;
extracting code coverage information in the software test log, wherein the code coverage information is used for representing the operation completion degree of each row of codes;
obtaining an executed code according to the code coverage information;
locating software defects from the executed code.
2. The software defect locating method of claim 1, further comprising:
marking the executed code.
3. The software defect locating method of claim 2, wherein the obtaining the executed code according to the code coverage information comprises:
summarizing lines or paragraphs where marked codes are located according to marks of codes of each line to obtain code blocks;
the executed code is obtained from the code block.
4. The software defect locating method of claim 1, the locating a software defect from the executed code comprising:
judging the code position of the software defect according to the executed code;
uniformly coding different files and paragraphs containing defects and sequencing according to the defect level;
locating the software bug from the sorted code.
5. The software defect locating method of claim 1, further comprising:
starting a software test to detect the software defect;
intercepting a screen interface image where the software defect is located;
outputting an information character string of the software defect to obtain the software test log, wherein the information character string comprises the time of the defect;
and positioning software defects from the executed code according to the screen interface image.
6. The software defect locating method of claim 1, further comprising:
adding the code coverage information into an operation record of the detected software;
and marking the code coverage information after the test is finished.
7. The method of claim 1, wherein after the software defect is located, the method further comprises:
and storing a system state, wherein the system state comprises a process, a memory and a CPU load.
8. A software defect locating apparatus comprising:
the acquisition module is used for acquiring a software test log, and the software test log comprises software defect information;
the extraction module is used for extracting code coverage information in the software test log, wherein the code coverage information is used for representing the operation completion degree of each row of codes;
and the positioning module is used for obtaining an executed code according to the code coverage information and positioning the software defect from the executed code.
9. An electronic device, comprising:
one or more processors;
a 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 software defect localization method of any of claims 1-7.
10. A computer-readable storage medium storing computer-executable instructions for implementing the software defect localization method of any one of claims 1 to 7 when executed.
CN202111647492.XA 2021-12-29 2021-12-29 Software defect positioning method and device, electronic equipment and medium Pending CN114281705A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111647492.XA CN114281705A (en) 2021-12-29 2021-12-29 Software defect positioning method and device, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111647492.XA CN114281705A (en) 2021-12-29 2021-12-29 Software defect positioning method and device, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN114281705A true CN114281705A (en) 2022-04-05

Family

ID=80878372

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111647492.XA Pending CN114281705A (en) 2021-12-29 2021-12-29 Software defect positioning method and device, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN114281705A (en)

Similar Documents

Publication Publication Date Title
CN108073519B (en) Test case generation method and device
CN109726093B (en) Method, apparatus and computer program product for executing test cases
CN109302522B (en) Test method, test device, computer system, and computer medium
CN108388514B (en) Interface automation test method, device, equipment and computer readable storage medium
CN113114680B (en) Detection method and detection device for file uploading vulnerability
US9563541B2 (en) Software defect detection identifying location of diverging paths
CN110580220B (en) Method for measuring code segment execution time and terminal equipment
CN110688173B (en) Positioning method and device of components in cross-platform interface framework and electronic equipment
CN109992511B (en) Device and method for obtaining code test coverage rate
CN114281705A (en) Software defect positioning method and device, electronic equipment and medium
CN108628744B (en) Fault diagnosis method and device and electronic equipment
US11880470B2 (en) System and method for vulnerability detection in computer code
CN115373929A (en) Test method, device, equipment, readable storage medium and program product
CN111666200A (en) Testing method and terminal for time consumption of cold start of PC software
CN115269444A (en) Code static detection method and device and server
CN114519008A (en) Recommendation method, device, medium and equipment for regression test case
CN115373984A (en) Code coverage rate determining method and device
CN114647588A (en) Interface test method and device
CN110442370B (en) Test case query method and device
CN114676061A (en) Knowledge graph-based automatic firmware detection method
CN107102938B (en) Test script updating method and device
CN112631905A (en) Execution process data management method and device, computer equipment and storage medium
CN111338956A (en) Automatic pressure measurement method, device, equipment and storage medium
CN114116291B (en) Log detection method, log detection device, computer device and storage medium
US20070168969A1 (en) Module search failure analysis

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