CN114443484A - Program testing method, device, equipment and storage medium - Google Patents
Program testing method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN114443484A CN114443484A CN202210105285.XA CN202210105285A CN114443484A CN 114443484 A CN114443484 A CN 114443484A CN 202210105285 A CN202210105285 A CN 202210105285A CN 114443484 A CN114443484 A CN 114443484A
- Authority
- CN
- China
- Prior art keywords
- program
- target
- source code
- source
- analysis result
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3692—Test management for test results analysis
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 embodiment of the invention discloses a program testing method, which comprises the following steps: acquiring a source code of a program to be tested, analyzing the source code to acquire an analysis result table; and comparing the analysis result table with the test reference table, and taking the comparison result as the test result of the program to be tested. The program testing method provided by the embodiment of the invention can verify whether the program is correct according to the field processing logic in the source code of the program to be tested, only needs to compare the test reference table with the analysis result table obtained by analyzing the source code, does not need to actually execute the program, does not need to load test data, can improve the efficiency and accuracy of program testing, and can also carry out program testing under the condition that program execution conditions are not available.
Description
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a program testing method, apparatus, device, and storage medium.
Background
The working mode of the batch program is that after the task request is received, the tasks are processed according to the sequence, and after all the tasks are processed, the processing results are output uniformly. The batch program is executed in a mode of manual intervention or system automatic program calling by establishing an operation plan template, the template comprises a plurality of nodes which are arranged according to the sequence of business logic processing, and the nodes can call the corresponding batch transaction program, process the data and output the result. The batch program has the characteristics of large data processing amount and long processing time.
The bank system has large data volume and more batch transactions, and a scene that a plurality of business logics are simple but table fields related to processing are more exists. There are two main methods for testing the correctness of data for such batch programs: firstly, executing batch transaction by using a large amount of desensitized production data, comparing batch results with historical data, and if the batch results are consistent with the historical data, determining that the program is correct; secondly, the tester analyzes the requirements, makes numbers in a targeted manner according to the business rules, compares the manually calculated results with the results of batch programs, and if the results are consistent, the programs are considered to be correct.
For the first approach, this test approach is limited by the completeness and richness of the historical data: firstly, the required data is required to be kept in the database, and if the historical data is cleaned, the data cannot be recovered; secondly, some relatively cold transactions have a very small transaction amount, which results in less recoverable historical data, and due to the small transaction amount, the data diversity is not enough, which cannot cover the extreme situations of special scenes. For the second method, if there are many processed fields in the table, the difficulty of manufacturing is increased, and errors are likely to occur in the test process. Both the above two methods can reduce the testing efficiency and the testing quality of testers to a certain extent.
Disclosure of Invention
The embodiment of the invention provides a program testing method, a program testing device, program testing equipment and a storage medium, which can improve the efficiency and accuracy of program testing and do not need to execute a program to be tested.
In a first aspect, an embodiment of the present invention provides a program testing method, including:
acquiring a source code of a program to be tested, analyzing the source code to acquire an analysis result table;
and comparing the analysis result table with a test reference table, and taking a comparison result as a test result of the program to be tested.
Furthermore, the analysis result table and the test reference table are generated by using the same template, and the template comprises a source table name, a target table name, a field value and an association rule.
Further, parsing the source code to obtain a parsing result table includes:
extracting service information in the source code, wherein the service information comprises a source table name, a target table name, a field value and an association rule;
and filling the service information into a blank analysis result table, and determining the filled blank analysis result table as the analysis result table.
Further, extracting the service information in the source code includes:
determining a keyword list corresponding to the service information;
searching in the source code according to the sequence of the keyword list, and determining a target character string;
and splitting and reading the target character string to obtain the service information.
Further, before comparing the analysis result table with the test reference table, the method further includes:
and establishing the test reference table according to the service requirement.
Further, establishing the test reference table according to the service requirement includes:
determining a source table and a target table according to the service requirement;
and compiling the source table and the target table to generate the test reference table.
Further, assembling the source table and the target table includes:
determining each target field and field value in the target table;
determining source table fields and corresponding association rules in a source table corresponding to the target fields according to the field values;
and filling the target fields, the field values, the source table fields and the association rules into a blank test reference table.
In a second aspect, an embodiment of the present invention further provides a program testing apparatus, including:
the analysis result table acquisition module is used for acquiring a source code of a program to be tested, analyzing the source code and acquiring an analysis result table;
and the test result acquisition module is used for comparing the analysis result table with the test reference table and taking the comparison result as the test result of the program to be tested.
Optionally, the parsing result table obtaining module is further configured to:
extracting service information in the source code, wherein the service information comprises a source table name, a target table name, a field value and an association rule;
and filling the service information into a blank analysis result table, and determining the filled blank analysis result table as the analysis result table.
Optionally, the parsing result table obtaining module is further configured to:
determining a keyword list corresponding to the service information;
searching in the source code according to the sequence of the keyword list, and determining a target character string;
and splitting and reading the target character string to acquire the service information.
Optionally, the program testing apparatus further includes a test reference table establishing module, configured to establish the test reference table according to a service requirement.
Optionally, the test reference table establishing module is further configured to:
determining a source table and a target table according to the service requirement;
and compiling the source table and the target table to generate the test reference table.
Optionally, the test reference table establishing module is further configured to:
determining each target field and field value in the target table;
determining source table fields and corresponding association rules in a source table corresponding to the target fields according to the field values;
and filling the target fields, the field values, the source table fields and the association rules into a blank test reference table.
In a third aspect, an embodiment of the present invention further provides a computer device for program testing, including:
the device comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the program testing method according to any one of the embodiments of the invention.
In a fourth aspect, an embodiment of the present invention further provides a storage medium for program testing, where a computer program is stored, and when the program is executed by a processing device, the program implements the program testing method according to any one of the embodiments of the present invention.
The method comprises the steps of firstly obtaining a source code of a program to be tested, analyzing the source code to obtain an analysis result table; and then comparing the analysis result table with the test reference table, and taking the comparison result as the test result of the program to be tested. The program testing method provided by the embodiment of the invention can verify whether the program is correct according to the field processing logic in the source code of the program to be tested, only needs to compare the test reference table with the analysis result table obtained by analyzing the source code, does not need to actually execute the program, does not need to load test data, can improve the efficiency and accuracy of program testing, and can also carry out program testing under the condition that program execution conditions are not available.
Drawings
FIG. 1 is a flowchart of a program testing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a program testing process according to one embodiment of the present invention;
FIG. 3 is a flowchart of a program testing method according to a second embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a program testing apparatus according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer device in the fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1 is a flowchart of a program testing method according to an embodiment of the present invention, where the embodiment is applicable to a case where a program is tested without executing the program, and the method may be executed by a program testing apparatus, where the apparatus may be composed of hardware and/or software, and may be generally integrated into a device with a program testing function, where the device may be an electronic device such as a server or a server cluster. As shown in fig. 1, the method specifically comprises the following steps:
and 110, acquiring a source code of the program to be tested, analyzing the source code and acquiring an analysis result table.
The program to be tested is a program that a tester needs to test, and typically, the program to be tested may be a batch program such as a data mart, that is, after a task request is received, tasks are processed in sequence, and after all tasks are processed, processing results are output uniformly. Source code refers to an uncompiled text file written according to a certain programming language specification and a series of human-readable computer language instructions. The analysis result table may be a table obtained by analyzing the source code, and the table may include a table name, a field name, and values of each field of the target table, and a table name and a corresponding field name of the source table having an association relationship with each field.
Code parsing may be converting the source code into other forms, such as charts, etc., according to the syntax in the source code. Optionally, a code analysis program may be written in advance, the source code is input into the program, and the output of the program is an analysis result table of the source code. The code analysis program can disassemble the statements in the source code according to the grammar structure, extract the required information and fill the information into the blank analysis result table.
And step 120, comparing the analysis result table with the test reference table, and taking the comparison result as the test result of the program to be tested.
The test reference table may be a chart determined according to the service requirement and the service rule, and includes table names, field values, association relations and other contents involved in the task processing of the program to be tested.
In this embodiment, after the analysis result table and the test reference table are obtained, the contents of the two tables can be compared, and if the comparison result shows that the contents of the two tables are consistent, the program to be tested is correct; if the comparison result shows that the contents of the two tables are inconsistent, the program to be tested is wrong.
In this embodiment, the analysis result table and the test reference table are generated by using the same template, where the template includes a source table name, a target table name, a field value, and an association rule.
Preferably, for the convenience of alignment, the parsing result table and the test reference table can be generated by using the same template.
In this embodiment, before comparing the analysis result table with the test reference table, the following steps may be further performed: and establishing a test reference table according to the service requirement.
Optionally, the test reference table may be established according to a service requirement, and the service requirement may be acquired from a requirement document. The invention requires the test personnel to intervene as early as possible in the stage of requirement development, and in the process of compiling the requirement document, the test reference is defined and drawn together with the service personnel, the table name, the field type, the field value and the incidence relation between the table and the table related in the service rule are determined, and each record in the test reference is ensured to have a clear source and target, so that the later period is used as a test basis and a basis for developing and compiling codes.
Optionally, the method for establishing the test reference table according to the service requirement may be: determining a source table and a target table according to service requirements; and compiling the source table and the target table to generate a test reference table.
Specifically, the requirement document may include a plurality of service requirements, and the service requirements may determine a generation rule of the target table and determine the source table and the target table. And processing the target table according to the source table to generate the target table. Preferably, after the source table and the target table are determined, each field and the corresponding field value of the target table may be filled in the blank test reference table. Values of partial fields possibly existing in the target table are related to one or more fields in the source table, and at this time, the source table names corresponding to the partial fields and the fields in the corresponding source table need to be filled in corresponding positions of the test reference table; for the field of the target table whose value is not related to the source table, the source table name corresponding to this part of the field and the field in the source table may be filled with "none". All fields in the target table should be included in the test reference table.
Further, the way to assemble the source table and the target table may be: determining each target field and field value in the target table; determining source table fields and corresponding association rules in a source table corresponding to each target field according to the field values; and filling each target field, field value, source table field and association rule into a blank test reference table.
For example, let table one be a source table, table two be a target table, where table one includes field 1, field 2, field 3, field 4 and field 5, and table two includes field a, field B, field C, field D and field E, where a value of field a is "new valid data", values of field B and field C copy field 1 and field 2 in table one, a value of field D is "current data", and a value of field F is 1, the source table and the target table are assembled, and the generated test reference table may be:
fig. 2 is a schematic diagram of a program testing process according to an embodiment of the present invention, as shown in the figure, after acquiring a service requirement, a source table, and a target table, a test reference table may be established according to the service requirement and table contents, when a program test is required, a code parsing program may be used to parse a source code of a program to be tested into a parsing result table, and whether the program to be tested is correct may be determined by comparing whether contents in the parsing result table and the test reference table are consistent.
The method comprises the steps of firstly obtaining a source code of a program to be tested, analyzing the source code to obtain an analysis result table; and then comparing the analysis result table with the test reference table, and taking the comparison result as the test result of the program to be tested. The program testing method provided by the embodiment of the invention can verify whether the program is correct according to the field processing logic in the source code of the program to be tested, only needs to compare the test reference table with the analysis result table obtained by analyzing the source code, does not need to actually execute the program, does not need to load test data, can improve the efficiency and accuracy of program testing, and can also carry out program testing under the condition that program execution conditions are not available.
Example two
Fig. 3 is a flowchart of a program testing method according to a second embodiment of the present invention, which is applicable to a case where a program is tested without executing the program. As shown in fig. 3, the method specifically includes the following steps:
step 210, obtaining a source code of a program to be tested.
In this embodiment, the source code of the program to be tested may be obtained from a service person.
Step 220, extracting the service information in the source code.
The service information comprises a source table name, a target table name, a field value and an association rule.
In this embodiment, after the source code is acquired, information such as a source table name, a target table name, a field value, and an association rule may be extracted from the source code.
Optionally, the manner of extracting the service information in the source code may be: determining a keyword list corresponding to the service information; searching in the source code according to the sequence of the keyword list, and determining a target character string; and splitting and reading the target character string to obtain the service information.
Specifically, for the source code of the SQL statement, the keywords corresponding to the service information may include "insert", "inter", "select", and "from", and the keyword list may be defined as: list0 ═ select, insert, from, inner, join, leftjoin, rightjoin ], and defines the schema structure: lisi 1 ═ insert, into, select, from ]; lisi 2 ═ insert, into, select, from, where ]; lisi 3 ═ insert, into, select, from, where, and ]; lisi 4 ═ insert, intro, select, from, inner, join, where ]; lisi 5 ═ insert, into, select, from, join, where, and. And sequentially searching target character strings in the source code according to the keyword list, and removing the annotation content between/'and'. The character string can be split by taking a space as a separator, and the split character string is placed in a target character string list.
Further, the target character strings are sequentially read, and the service information in the target character strings can be acquired. For example: reading the content between 'insert' and 'to obtain the name of the target table, reading the content between' insert 'and' select 'to obtain the name list of the target table field, splitting according to' and 'from' to obtain the name list of the source table.
And step 230, filling the service information into a blank analysis result table, and determining the filled blank analysis result table as an analysis result table.
In this embodiment, after the service information in the source code is obtained, the service information may be filled in the blank analysis result table, so as to obtain the analysis result table.
And 240, comparing the analysis result table with the test reference table, and taking the comparison result as the test result of the program to be tested.
In this embodiment, after the analysis result table is obtained, the analysis result table may be compared with a pre-programmed test reference table, if the comparison result indicates that the contents of the two tables are consistent, the program to be tested is correct, and if the comparison result indicates that the contents of the two tables are inconsistent, the program to be tested is faulty.
The method comprises the steps of firstly obtaining a source code of a program to be tested, then extracting service information in the source code, then filling the service information into a blank analysis result table, determining the filled blank analysis result table as an analysis result table, finally comparing the analysis result table with a test reference table, and taking a comparison result as a test result of the program to be tested. The program testing method provided by the embodiment of the invention can verify whether the program is correct according to the field processing logic in the source code of the program to be tested, only needs to compare the test reference table with the analysis result table obtained by analyzing the source code, does not need to actually execute the program, does not need to load test data, can improve the efficiency and accuracy of program testing, and can also carry out program testing under the condition that program execution conditions are not available.
EXAMPLE III
Fig. 4 is a schematic structural diagram of a program testing apparatus according to a third embodiment of the present invention. As shown in fig. 4, the apparatus includes: a parsing result table obtaining module 310 and a test result obtaining module 320.
The analysis result table obtaining module 310 is configured to obtain a source code of the program to be tested, and analyze the source code to obtain an analysis result table.
Optionally, the parsing result table obtaining module 310 is further configured to:
extracting service information in the source code, wherein the service information comprises a source table name, a target table name, a field value and an association rule; and filling the service information into a blank analysis result table, and determining the filled blank analysis result table as an analysis result table.
Optionally, the parsing result table obtaining module 310 is further configured to:
determining a keyword list corresponding to the service information; searching in the source code according to the sequence of the keyword list, and determining a target character string; and splitting and reading the target character string to obtain the service information.
The test result obtaining module 320 is configured to compare the analysis result table with the test reference table, and use the comparison result as a test result of the program to be tested.
Optionally, the program testing apparatus further includes a test reference table establishing module 330, configured to establish a test reference table according to the service requirement.
Optionally, the test reference table establishing module 330 is further configured to:
determining a source table and a target table according to service requirements; and compiling the source table and the target table to generate a test reference table.
Optionally, the test reference table establishing module 330 is further configured to:
determining each target field and field value in the target table; determining source table fields and corresponding association rules in a source table corresponding to each target field according to the field values; and filling each target field, field value, source table field and association rule into a blank test reference table.
The device can execute the methods provided by all the embodiments of the disclosure, and has corresponding functional modules and beneficial effects for executing the methods. For technical details that are not described in detail in this embodiment, reference may be made to the methods provided in all the foregoing embodiments of the disclosure.
Example four
Fig. 5 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention. FIG. 5 illustrates a block diagram of a computer device 412, which is suitable for use in implementing embodiments of the present invention. The computer device 412 shown in FIG. 5 is only one example and should not impose any limitations on the functionality or scope of use of embodiments of the present invention. Device 412 is a typical program test computing device.
As shown in FIG. 5, computer device 412 is in the form of a general purpose computing device. Components of computer device 412 may include, but are not limited to: one or more processors 416, a storage device 428, and a bus 418 that couples the various system components including the storage device 428 and the processors 416.
The computer device 412 may also communicate with one or more external devices 414 (e.g., keyboard, pointing device, camera, display 424, etc.), with one or more devices that enable a user to interact with the computer device 412, and/or with any devices (e.g., network card, modem, etc.) that enable the computer device 412 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 422. Also, computer device 412 may communicate with one or more networks (e.g., a Local Area Network (LAN), Wide Area Network (WAN), and/or a public Network, such as the internet) through Network adapter 420. As shown, network adapter 420 communicates with the other modules of computer device 412 over bus 418. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the computer device 412, including but not limited to: microcode, device drivers, Redundant processing units, external disk drive Arrays, disk array (RAID) systems, tape drives, and data backup storage systems, to name a few.
The processor 416 executes various functional applications and data processing by executing programs stored in the storage device 428, for example, to implement the program test method provided by the above-described embodiment of the present invention.
EXAMPLE five
Embodiments of the present invention provide a computer-readable storage medium on which a computer program is stored, where the computer program, when executed by a processing device, implements a program testing method as in embodiments of the present invention. The computer readable medium of the present invention described above may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, 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), an optical fiber, 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. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a source code of a program to be tested, analyzing the source code to acquire an analysis result table; and comparing the analysis result table with the test reference table, and taking the comparison result as the test result of the program to be tested.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products 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 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.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, 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), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (10)
1. A program testing method, comprising:
acquiring a source code of a program to be tested, analyzing the source code to acquire an analysis result table;
and comparing the analysis result table with a test reference table, and taking the comparison result as the test result of the program to be tested.
2. The method according to claim 1, wherein the parsing result table and the test reference table are generated by using the same template, and the template includes a source table name, a target table name, a field value and an association rule.
3. The method of claim 1, wherein parsing the source code to obtain a parsing result table comprises:
extracting service information in the source code, wherein the service information comprises a source table name, a target table name, a field value and an association rule;
and filling the service information into a blank analysis result table, and determining the filled blank analysis result table as the analysis result table.
4. The method of claim 3, wherein extracting the service information from the source code comprises:
determining a keyword list corresponding to the service information;
searching in the source code according to the sequence of the keyword list to determine a target character string;
and splitting and reading the target character string to obtain the service information.
5. The method of claim 1, wherein before comparing the parsing result table with the test reference table, further comprising:
and establishing the test reference table according to the service requirement.
6. The method of claim 5, wherein building the test reference table according to the service requirement comprises:
determining a source table and a target table according to the service requirement;
and compiling the source table and the target table to generate the test reference table.
7. The method of claim 6, wherein assembling the source table with the target table comprises:
determining each target field and field value in the target table;
determining source table fields and corresponding association rules in a source table corresponding to the target fields according to the field values;
and filling the target fields, the field values, the source table fields and the association rules into a blank test reference table.
8. A program test apparatus, comprising:
the analysis result table acquisition module is used for acquiring a source code of a program to be tested, analyzing the source code and acquiring an analysis result table;
and the test result acquisition module is used for comparing the analysis result table with the test reference table and taking the comparison result as the test result of the program to be tested.
9. A computer device, comprising: memory, processor and computer program stored on the memory and executable on the processor, which when executed by the processor implements a program testing method according to any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processing means, carries out a program testing method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210105285.XA CN114443484A (en) | 2022-01-28 | 2022-01-28 | Program testing method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210105285.XA CN114443484A (en) | 2022-01-28 | 2022-01-28 | Program testing method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114443484A true CN114443484A (en) | 2022-05-06 |
Family
ID=81370715
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210105285.XA Pending CN114443484A (en) | 2022-01-28 | 2022-01-28 | Program testing method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114443484A (en) |
-
2022
- 2022-01-28 CN CN202210105285.XA patent/CN114443484A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11487539B2 (en) | Systems and methods for automating and monitoring software development operations | |
CN111078729B (en) | Medical data tracing method, device, system, storage medium and electronic equipment | |
CN112783786A (en) | Test case generation method, device, equipment, medium and program product | |
CN113626558B (en) | Intelligent recommendation-based field standardization method and system | |
CN113448869B (en) | Method and device for generating test case, electronic equipment and computer readable medium | |
CN114185791A (en) | Method, device and equipment for testing data mapping file and storage medium | |
CN113419740A (en) | Program data stream analysis method and device, electronic device and readable storage medium | |
CN116185393A (en) | Method, device, equipment, medium and product for generating interface document | |
CN114328700B (en) | Data checking method and device in medical data ETL task | |
CN111124541A (en) | Configuration file generation method, device, equipment and medium | |
CN116361522A (en) | Data display method and device | |
CN114443484A (en) | Program testing method, device, equipment and storage medium | |
CN113138767B (en) | Code language conversion method, device, electronic equipment and storage medium | |
CN114265966A (en) | Data processing method and device, electronic equipment and storage medium | |
CN113312195A (en) | Data processing method, device, equipment and storage medium | |
CN113807056A (en) | Method, device and equipment for correcting error of document name sequence number | |
CN111367791A (en) | Method, device, medium and electronic equipment for generating test case | |
CN112416727A (en) | Batch processing operation checking method, device, equipment and medium | |
CN113742225B (en) | Test data generation method, device, equipment and storage medium | |
CN113419963B (en) | Method, device, equipment and storage medium for integrating programming language items | |
CN113986381A (en) | Data analysis method, device, equipment and storage medium | |
CN113641585B (en) | Test data generation method, device, equipment and storage medium | |
CN110737757B (en) | Method and apparatus for generating information | |
CN116450416A (en) | Redundancy check method and device for software test cases, electronic equipment and medium | |
CN116661857A (en) | Data extraction method, device, equipment and storage medium |
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 |