CN116521556A - Code testing method, device, equipment and medium - Google Patents

Code testing method, device, equipment and medium Download PDF

Info

Publication number
CN116521556A
CN116521556A CN202310503464.3A CN202310503464A CN116521556A CN 116521556 A CN116521556 A CN 116521556A CN 202310503464 A CN202310503464 A CN 202310503464A CN 116521556 A CN116521556 A CN 116521556A
Authority
CN
China
Prior art keywords
code
test
coverage rate
increment
task
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
CN202310503464.3A
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.)
Kangjian Information Technology Shenzhen Co Ltd
Original Assignee
Kangjian Information Technology Shenzhen 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 Kangjian Information Technology Shenzhen Co Ltd filed Critical Kangjian Information Technology Shenzhen Co Ltd
Priority to CN202310503464.3A priority Critical patent/CN116521556A/en
Publication of CN116521556A publication Critical patent/CN116521556A/en
Pending legal-status Critical Current

Links

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/3676Test management for coverage 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/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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 invention relates to the technical field of testing, and discloses a code testing method, a device, equipment and a medium, wherein the method comprises the following steps: acquiring a first coverage rate report containing codes to be tested, and determining incremental codes in the first coverage rate report; displaying an annotation task input interface; generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface; obtaining a test case in the annotating task, and testing the increment code according to the test case; after the test is finished, a second coverage rate report is obtained; judging whether the incremental code is covered or not in the second coverage rate report, and judging whether the annotating task of the incremental code is closed or not at the same time; when the delta code is covered and the annotation task of the delta code is closed in the second coverage report, the delta code is published to an online environment. The invention can effectively avoid the defect of missing the incremental code, and greatly improves the testing effect of the incremental code.

Description

Code testing method, device, equipment and medium
Technical Field
The present invention relates to the field of testing technologies, and in particular, to a code testing method, device, apparatus, and medium.
Background
In the complete production and research flow, the test is a reduction acceptance test for requirements and designs, and testers write complete test cases according to the requirements and design documents, and find out system problems and defects through test links such as evaluation, smoke test, functional test, regression test, online test and the like.
However, in the existing code test, the incremental code is easy to miss test, which is unfavorable for improving the accuracy of the code test. The reason is that in the software development process, some functional points need to be added, so that incremental codes exist, and if the test is not notified, the incremental codes are easy to miss, so that the accuracy of the code test is not beneficial to improvement.
Disclosure of Invention
The invention provides a code testing method, a device, computer equipment and a medium, which are used for solving the technical problems that in the existing code testing, incremental codes are easy to miss test and are not beneficial to improving the accuracy of the code testing.
In a first aspect, a code testing method is provided, including:
acquiring a first coverage rate report containing codes to be tested, and determining incremental codes in the first coverage rate report;
displaying an annotation task input interface;
generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface;
obtaining a test case in the annotating task, and testing the increment code according to the test case;
after the test is finished, a second coverage rate report is obtained;
judging whether the incremental code is covered or not in the second coverage rate report, and judging whether the annotating task of the incremental code is closed or not at the same time;
when the delta code is covered and the annotation task of the delta code is closed in the second coverage report, the delta code is published to an online environment.
In a second aspect, there is provided a code testing device comprising:
the code module is used for acquiring a first coverage rate report containing codes to be tested and determining increment codes in the first coverage rate report;
the display module is used for displaying the annotating task input interface;
the generation module is used for generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface;
the test module is used for obtaining the test cases in the annotating task and testing the increment codes according to the test cases;
the acquisition module is used for acquiring a second coverage rate report after the test is finished;
the judging module is used for judging whether the incremental code is covered in the second coverage rate report or not, and judging whether the annotating task of the incremental code is closed or not at the same time;
and the issuing module is used for issuing the increment code to an online environment when the increment code is covered and the annotating task of the increment code is closed in the second coverage rate report.
In a third aspect, a computer device is provided comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the code testing method described above when executing the computer program.
In a fourth aspect, a computer readable storage medium is provided, the computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the code testing method described above.
In the scheme realized by the code testing method, the code testing device, the computer equipment and the storage medium, a first coverage rate report containing codes to be tested is obtained, and incremental codes in the first coverage rate report are determined; displaying an annotation task input interface; generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface; obtaining a test case in the annotating task, and testing the increment code according to the test case; after the test is finished, a second coverage rate report is obtained; judging whether the incremental code is covered or not in the second coverage rate report, and judging whether the annotating task of the incremental code is closed or not at the same time; when the delta code is covered and the annotation task of the delta code is closed in the second coverage report, the delta code is published to an online environment. In the invention, aiming at the increment code, the defect of missing measurement of the increment code can be effectively avoided by using the mode that the increment code is covered and the annotation task of the increment code is closed in the second coverage rate report, and the test effect of the increment code is greatly and efficiently improved, thereby greatly improving the accuracy of code test.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an application environment of a code testing method according to an embodiment of the invention;
FIG. 2 is a flow chart of a code testing method according to an embodiment of the invention;
FIG. 3 is a flowchart illustrating the step S21 in FIG. 1;
FIG. 4 is a flowchart of step S24 in FIG. 1;
FIG. 5 is a flowchart illustrating the step S27 in FIG. 1;
FIG. 6 is a schematic diagram of a code testing device according to an embodiment of the invention;
FIG. 7 is a schematic diagram of a computer device according to an embodiment of the invention;
fig. 8 is a schematic diagram of another configuration of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The code testing method provided by the embodiment of the invention can be applied to an application environment as shown in fig. 1, wherein a client communicates with a server through a network. Acquiring a first coverage rate report containing codes to be tested, and determining incremental codes in the first coverage rate report; displaying an annotation task input interface; generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface; obtaining a test case in the annotating task, and testing the increment code according to the test case; after the test is finished, a second coverage rate report is obtained; judging whether the incremental code is covered or not in the second coverage rate report, and judging whether the annotating task of the incremental code is closed or not at the same time; when the delta code is covered and the annotation task of the delta code is closed in the second coverage report, the delta code is published to an online environment. In the invention, aiming at the increment code, the defect of missing measurement of the increment code can be effectively avoided by using the mode that the increment code is covered and the annotation task of the increment code is closed in the second coverage rate report, and the test effect of the increment code is greatly and efficiently improved, thereby greatly improving the accuracy of code test.
The clients may be, but are not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
The server may be implemented by a stand-alone server or a server cluster formed by a plurality of servers. The present invention will be described in detail with reference to specific examples.
Referring to fig. 2, fig. 2 is a schematic flow chart of a code testing method according to an embodiment of the invention, which includes the following steps:
s21, acquiring a first coverage rate report containing codes to be tested, and determining increment codes in the first coverage rate report;
after a developer submits a code to be tested, code testing is carried out, a first coverage rate report containing the code to be tested is obtained, and incremental codes in the first coverage rate report are determined.
For example, when a user needs to test a code to be tested, the user may initiate a test request of a test case required by the code to be tested to the server.
The server responds to the test request, and obtains a first coverage rate report containing the code to be tested through Jacoco, namely Java Code Coverage, which is a Java code coverage rate statistical tool of open source.
Referring to fig. 3, fig. 3 is a flowchart of step S21 in fig. 1, which is described in detail below:
s31, acquiring a first coverage rate report containing codes to be tested, and determining that coverage rate is acquired in the first coverage rate report;
s32, judging whether the coverage rate reaches a preset coverage rate or not;
and S33, when the coverage rate does not reach the preset coverage rate, determining that an uncovered code is acquired from the first coverage rate report, and determining the uncovered code as an increment code.
S22, displaying an annotating task input interface;
the displaying of the annotation task input interface comprises:
displaying the increment code on an interface, and detecting whether a triggering operation of the increment code exists or not;
and when the triggering operation of the increment code exists, displaying the annotating task input interface, wherein the triggering operation comprises at least one operation of verification operation of the increment code, modification operation of the increment code and annotating operation of the increment code.
S23, generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface;
s24, obtaining a test case in the annotating task, and testing the increment code according to the test case;
in operation, the test cases are classified into different grades according to the system requirements:
the test case of the core function, namely the smoking test, is a test case for determining whether the version is measurable. If the test is not passed, the part of test cases need to be returned to the development stage for modification, and after the modification is finished, the test requirements are again raised. If the test passes, the part of test cases enter into a functional stage test.
There are two embodiments of step S24, and the first embodiment of step S24 is as follows:
referring to fig. 4, fig. 4 is a flowchart of step S24 in fig. 1, which is described in detail below:
s41, generating a test keyword based on input content in the annotation task input interface;
s42, acquiring test contents, and inquiring the test keywords in the test contents;
s43, when the test key words are inquired in the test content, the test cases corresponding to the test content are obtained, and the increment codes are tested by adopting the test cases.
Exemplary, S43, includes:
when the test keyword is queried in the test content, acquiring the test case corresponding to the test content;
judging whether the test cases corresponding to the test contents are multiple or not;
when a plurality of test cases corresponding to the test content are obtained, obtaining the test times of each test case;
and sequencing the test times according to the sequence from high to low, and testing the increment code by adopting the test case with the first test time sequencing.
The second embodiment of step S24 is as follows:
and acquiring the test case modified or supplemented by the tester in the annotating task, and testing the increment code according to the test case.
Illustratively, a test case is a set of collections provided to a system under test for testing, the set of collections comprising: test environment, operation steps, test data, expected results. The expected results are: the expected result of the test execution is provided, the expected result is generally obtained according to the requirement, the test is passed if the actual result is consistent with the expected result, and the test is not passed if the actual result is inconsistent with the expected result.
S25, after the test is finished, a second coverage rate report is obtained;
after the test is finished, the method further comprises the following steps of:
determining the first coverage report and deleting a blank row or an annotation row in the second coverage report.
Determining the first coverage report and deleting a blank or comment line in the second coverage report is performed after S26, or before S26, or simultaneously with S26, without limitation.
S26, judging whether the incremental code is covered in the second coverage report, and judging whether the annotating task of the incremental code is closed at the same time;
wherein after the determining whether the incremental code is covered in the second coverage report and determining whether the annotation task of the incremental code is closed, the method further includes:
and when the incremental code is not covered or the annotating task of the incremental code is not closed in the second coverage report, not publishing the incremental code to an online environment.
And S27, when the incremental code is covered in the second coverage report and the annotating task of the incremental code is closed, publishing the incremental code to an online environment.
The method comprises the steps of establishing two monitoring processes in a system, wherein the first monitoring process is used for monitoring a result of judging whether an incremental code is covered in the second coverage rate report, and the second monitoring process is used for monitoring a result of judging whether an annotation task of the incremental code is closed;
and when the first monitoring process monitors that the result of judging whether the incremental code is covered in the second coverage rate report is that the incremental code is covered, and the second monitoring process monitors that the result of judging whether the annotation task of the incremental code is closed is that the annotation task is closed, the incremental code is issued to an online environment.
Referring to fig. 5, fig. 5 is a flowchart of step S27 in fig. 1, which is described in detail below:
s51, acquiring the second coverage rate report, and acquiring a new coverage rate in the second coverage rate report;
s52, judging whether the new coverage rate reaches a preset coverage rate or not, and judging whether the annotating task of the incremental code is closed or not;
and S53, when the new coverage rate reaches the preset coverage rate and the annotating task of the incremental code is closed, the incremental code is issued to an online environment.
When the new coverage rate reaches the preset coverage rate and the annotating task of the incremental code is closed, the incremental code is issued to the online environment, so that the untested incremental code can be prevented from being missed, and the safety of the online environment is maintained.
Therefore, aiming at the increment code, the defect of missing measurement of the increment code can be effectively avoided by using the mode that the increment code is covered and the annotating task of the increment code is closed in the second coverage rate report, and the test effect of the increment code is greatly and efficiently improved, so that the accuracy of code test is greatly improved.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
In one embodiment, a code testing device is provided, where the code testing device corresponds to the code testing method in the above embodiment one by one.
Referring to fig. 6, fig. 6 is a schematic structural diagram of a code testing device according to an embodiment of the invention, and as shown in fig. 6, the code testing device includes a code module 101, a display module 102, a generating module 103, a testing module 104, an obtaining module 105, a judging module 106 and a publishing module 107. The functional modules are described in detail as follows:
the code module 101 is configured to obtain a first coverage report containing a code to be tested, and determine an incremental code in the first coverage report;
the display module 102 is used for displaying an annotation task input interface;
the generating module 103 is configured to generate an annotation task corresponding to the incremental code according to the input content in the annotation task input interface;
the test module 104 is configured to obtain a test case in the annotation task, and test the incremental code according to the test case;
the acquiring module 105 is configured to acquire a second coverage report after the test is completed;
a judging module 106, configured to judge whether the incremental code is covered in the second coverage report, and meanwhile judge whether an annotation task of the incremental code is closed;
a publishing module 107, configured to publish the incremental code to an online environment when the incremental code is covered and the annotation task of the incremental code is closed in the second coverage report.
In one embodiment, the code module 101 is specifically configured to:
acquiring a first coverage rate report containing codes to be tested, and determining the coverage rate acquired in the first coverage rate report;
judging whether the coverage rate reaches a preset coverage rate or not;
and when the coverage rate does not reach the preset coverage rate, determining that an uncovered code is obtained in the first coverage rate report, and determining the uncovered code as an incremental code.
In one embodiment, the display module 102 is specifically configured to:
displaying the increment code on an interface, and detecting whether a triggering operation of the increment code exists or not;
and when the triggering operation of the increment code exists, displaying the annotating task input interface, wherein the triggering operation comprises at least one operation of verification operation of the increment code, modification operation of the increment code and annotating operation of the increment code.
In one embodiment, the test module 104 is specifically configured to:
generating a test keyword based on input content in the annotation task input interface;
acquiring test contents, and inquiring the test keywords in the test contents;
when the test key words are inquired in the test contents, the test cases corresponding to the test contents are obtained, and the increment codes are tested by adopting the test cases.
In one embodiment, the test module 104 is specifically configured to:
and acquiring the test case modified or supplemented by the tester in the annotating task, and testing the increment code according to the test case.
In one embodiment, the test module 104 is specifically configured to:
when the test keyword is queried in the test content, acquiring the test case corresponding to the test content;
judging whether the test cases corresponding to the test contents are multiple or not;
when a plurality of test cases corresponding to the test content are obtained, obtaining the test times of each test case;
and sequencing the test times according to the sequence from high to low, and testing the increment code by adopting the test case with the first test time sequencing.
In one embodiment, the publishing module 107 is specifically configured to:
acquiring the second coverage rate report, and acquiring a new coverage rate in the second coverage rate report;
judging whether the new coverage rate reaches a preset coverage rate or not, and judging whether the annotating task of the incremental code is closed or not at the same time;
and when the new coverage rate reaches a preset coverage rate and the annotating task of the incremental code is closed, the incremental code is issued to an online environment.
In one embodiment, the code testing device further comprises:
and the non-publishing module is used for not publishing the increment code to an online environment when the increment code is not covered or the annotating task of the increment code is not closed in the second coverage report.
In one embodiment, the code testing device further comprises:
and the deleting module is used for determining the first coverage rate report and deleting blank lines or comment lines in the second coverage rate report.
The invention provides a code testing device, which aims at increment codes, and can effectively avoid the defect of missing test of the increment codes by using a mode that the increment codes are covered and annotation tasks of the increment codes are closed in the second coverage rate report, so that the testing effect of the increment codes is greatly and efficiently improved, and the accuracy of code testing is greatly improved.
For specific limitations of the code testing device, reference may be made to the above limitation of the intelligent question-answering method, and no further description is given here. The modules in the code testing device may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present invention, and in one embodiment, a computer device is provided, where the computer device may be a server, and an internal structure diagram of the computer device may be as shown in fig. 7. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes non-volatile and/or volatile storage media and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is for communicating with an external client via a network connection. The computer program, when executed by a processor, performs functions or steps of a server side of a code testing method.
Referring to fig. 8, fig. 8 is another schematic structural diagram of a computer device according to an embodiment of the present invention, and in one embodiment, a computer device is provided, and the computer device may be a client, and an internal structure diagram thereof may be as shown in fig. 8. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is for communicating with an external server via a network connection. The computer program, when executed by a processor, performs a function or steps on a client side of a code testing method
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program:
acquiring a first coverage rate report containing codes to be tested, and determining incremental codes in the first coverage rate report;
displaying an annotation task input interface;
generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface;
obtaining a test case in the annotating task, and testing the increment code according to the test case;
after the test is finished, a second coverage rate report is obtained;
judging whether the incremental code is covered or not in the second coverage rate report, and judging whether the annotating task of the incremental code is closed or not at the same time;
when the delta code is covered and the annotation task of the delta code is closed in the second coverage report, the delta code is published to an online environment.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a first coverage rate report containing codes to be tested, and determining incremental codes in the first coverage rate report;
displaying an annotation task input interface;
generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface;
obtaining a test case in the annotating task, and testing the increment code according to the test case;
after the test is finished, a second coverage rate report is obtained;
judging whether the incremental code is covered or not in the second coverage rate report, and judging whether the annotating task of the incremental code is closed or not at the same time;
when the delta code is covered and the annotation task of the delta code is closed in the second coverage report, the delta code is published to an online environment.
It should be noted that, the functions or steps implemented by the computer readable storage medium or the computer device may correspond to the relevant descriptions of the server side and the client side in the foregoing method embodiments, and are not described herein for avoiding repetition.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a graphics processor (Graphics Processing Unit, GPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
The above description and the drawings illustrate embodiments of the disclosure sufficiently to enable those skilled in the art to practice them. Other embodiments may involve structural, logical, electrical, process, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the sequence of operations may vary. Portions and sub-samples of some embodiments may be included in or substituted for portions and sub-samples of other embodiments. Moreover, the terminology used in the present application is for the purpose of describing embodiments only and is not intended to limit the claims. As used in the description of the embodiments and the claims, the singular forms "a," "an," and "the" (the) are intended to include the plural forms as well, unless the context clearly indicates otherwise. Similarly, the term "and/or" as used in this application is meant to encompass any and all possible combinations of one or more of the associated listed. In addition, when used in this application, the terms "comprises," "comprising," and/or "includes," and variations thereof, mean the presence of the stated sub-sample, integer, step, operation, element, and/or component, but do not exclude the presence or addition of one or more other sub-samples, integers, steps, operations, elements, components, and/or groups of these. Without further limitation, an element defined by the phrase "comprising one …" does not exclude the presence of other like elements in a process, method or apparatus comprising such elements. In this context, each embodiment may be described with emphasis on the differences from the other embodiments, and the same similar parts between the various embodiments may be referred to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method sections disclosed in the embodiments, the description of the method sections may be referred to for relevance.
Those of skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. The skilled person may use different methods for each particular application to achieve the described functionality, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again.
In the embodiments disclosed herein, the disclosed methods, articles of manufacture (including but not limited to devices, apparatuses, etc.) may be practiced in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of elements may be merely a logical functional division, and there may be additional divisions in actual implementation, e.g., multiple elements or components may be combined or integrated into another system, or some sub-samples may be omitted, or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form. The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to implement the present embodiment. In addition, each functional unit in the embodiments of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to 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). 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. In the description corresponding to the flowcharts and block diagrams in the figures, operations or steps corresponding to different blocks may also occur in different orders than that disclosed in the description, and sometimes no specific order exists between different operations or steps. For example, two consecutive operations or steps may actually be performed substantially in parallel, they may sometimes be performed in reverse order, which may be dependent on the functions involved. Each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/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.

Claims (10)

1. A code testing method, comprising:
acquiring a first coverage rate report containing codes to be tested, and determining incremental codes in the first coverage rate report;
displaying an annotation task input interface;
generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface;
obtaining a test case in the annotating task, and testing the increment code according to the test case;
after the test is finished, a second coverage rate report is obtained;
judging whether the incremental code is covered or not in the second coverage rate report, and judging whether the annotating task of the incremental code is closed or not at the same time;
when the delta code is covered and the annotation task of the delta code is closed in the second coverage report, the delta code is published to an online environment.
2. The code testing method of claim 1, wherein the obtaining a first coverage report containing codes under test, determining incremental codes in the first coverage report, comprises:
acquiring a first coverage rate report containing codes to be tested, and determining the coverage rate acquired in the first coverage rate report;
judging whether the coverage rate reaches a preset coverage rate or not;
and when the coverage rate does not reach the preset coverage rate, determining that an uncovered code is obtained in the first coverage rate report, and determining the uncovered code as an incremental code.
3. The code testing method of claim 1, wherein displaying an annotation task input interface comprises:
displaying the increment code on an interface, and detecting whether a triggering operation of the increment code exists or not;
and when the triggering operation of the increment code exists, displaying the annotating task input interface, wherein the triggering operation comprises at least one operation of verification operation of the increment code, modification operation of the increment code and annotating operation of the increment code.
4. The code testing method according to claim 1, wherein the obtaining the test case in the annotating task, and testing the incremental code according to the test case, includes:
generating a test keyword based on input content in the annotation task input interface;
acquiring test contents, and inquiring the test keywords in the test contents;
when the test key words are inquired in the test contents, the test cases corresponding to the test contents are obtained, and the increment codes are tested by adopting the test cases.
5. The code testing method according to claim 1, wherein the obtaining the test case in the annotating task, and testing the incremental code according to the test case, includes:
and acquiring the test case modified or supplemented by the tester in the annotating task, and testing the increment code according to the test case.
6. The code testing method of claim 4, wherein when the test keyword is queried in the test content, obtaining the test case corresponding to the test content, and testing the incremental code by using the test case, comprises:
when the test keyword is queried in the test content, acquiring the test case corresponding to the test content;
judging whether the test cases corresponding to the test contents are multiple or not;
when a plurality of test cases corresponding to the test content are obtained, obtaining the test times of each test case;
and sequencing the test times according to the sequence from high to low, and testing the increment code by adopting the test case with the first test time sequencing.
7. The code testing method of any of claims 1 to 6, wherein the publishing the delta code to an online environment when the delta code is covered and the annotating task of the delta code is closed in the second coverage report comprises:
acquiring the second coverage rate report, and acquiring a new coverage rate in the second coverage rate report;
judging whether the new coverage rate reaches a preset coverage rate or not, and judging whether the annotating task of the incremental code is closed or not at the same time;
and when the new coverage rate reaches a preset coverage rate and the annotating task of the incremental code is closed, the incremental code is issued to an online environment.
8. A code testing apparatus, comprising:
the code module is used for acquiring a first coverage rate report containing codes to be tested and determining increment codes in the first coverage rate report;
the display module is used for displaying the annotating task input interface;
the generation module is used for generating annotation tasks corresponding to the increment codes according to the input content in the annotation task input interface;
the test module is used for obtaining the test cases in the annotating task and testing the increment codes according to the test cases;
the acquisition module is used for acquiring a second coverage rate report after the test is finished;
the judging module is used for judging whether the incremental code is covered in the second coverage rate report or not, and judging whether the annotating task of the incremental code is closed or not at the same time;
and the issuing module is used for issuing the increment code to an online environment when the increment code is covered and the annotating task of the increment code is closed in the second coverage rate report.
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 code testing method according to any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the code testing method according to any of claims 1 to 7.
CN202310503464.3A 2023-05-05 2023-05-05 Code testing method, device, equipment and medium Pending CN116521556A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310503464.3A CN116521556A (en) 2023-05-05 2023-05-05 Code testing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310503464.3A CN116521556A (en) 2023-05-05 2023-05-05 Code testing method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN116521556A true CN116521556A (en) 2023-08-01

Family

ID=87391847

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310503464.3A Pending CN116521556A (en) 2023-05-05 2023-05-05 Code testing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN116521556A (en)

Similar Documents

Publication Publication Date Title
US9405662B2 (en) Process for displaying test coverage data during code reviews
CN104252481A (en) Dynamic check method and device for consistency of main and salve databases
US10657028B2 (en) Method for replicating production behaviours in a development environment
CN111522728A (en) Method for generating automatic test case, electronic device and readable storage medium
CN111026647B (en) Method and device for acquiring code coverage rate, computer equipment and storage medium
CN111211929A (en) Fault positioning method, fault positioning device, control equipment and intelligent equipment
CN110580220B (en) Method for measuring code segment execution time and terminal equipment
CN113946983A (en) Method and device for evaluating weak links of product reliability and computer equipment
CN112882948A (en) Stability testing method, device and system for application and storage medium
CN112685316A (en) Code execution path acquisition method and device, computer equipment and storage medium
CN105912467B (en) Performance test method and device
US20030237032A1 (en) Method for electronically testing memory modules
CN116521556A (en) Code testing method, device, equipment and medium
CN115269431A (en) Interface testing method and device, electronic equipment and storage medium
CN114968751A (en) Program debugging method and program debugging device of code-free development platform
CN112631905A (en) Execution process data management method and device, computer equipment and storage medium
CN109697141B (en) Method and device for visual testing
US8458523B2 (en) Meta attributes in functional coverage models
Chen et al. Analyzing execution path non-determinism of the Linux kernel in different scenarios
CN112650679B (en) Test verification method, device and computer system
Cai Coverage-based testing strategies and reliability modeling for fault-tolerant software systems
CN113901731B (en) Electric quantity prediction method, device, medium and equipment
CN117033208A (en) Interface contract checking method and device, electronic equipment and storage medium
CN117806943A (en) Test method, test device and storage medium
CN117130909A (en) Test analysis method, apparatus, device, storage medium, and program product

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