CN112363921A - Code testing method and device, storage medium and computer equipment - Google Patents

Code testing method and device, storage medium and computer equipment Download PDF

Info

Publication number
CN112363921A
CN112363921A CN202011239141.0A CN202011239141A CN112363921A CN 112363921 A CN112363921 A CN 112363921A CN 202011239141 A CN202011239141 A CN 202011239141A CN 112363921 A CN112363921 A CN 112363921A
Authority
CN
China
Prior art keywords
code
version code
test
target version
target
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
CN202011239141.0A
Other languages
Chinese (zh)
Inventor
夏文静
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN202011239141.0A priority Critical patent/CN112363921A/en
Publication of CN112363921A publication Critical patent/CN112363921A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/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

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 discloses a code testing method, a code testing device, a storage medium and computer equipment, and relates to the technical field of computers. The method comprises the following steps: acquiring a target version code and an original version code corresponding to the target version code, and acquiring a code branch test point and a reference format of the original version code; constructing a test case according to the code branch test point and the parameter entering format of the original version code; respectively testing the target version code and the original version code through the test case to obtain test results of the target version code and the original version code; and comparing and analyzing the test results of the target version code and the original version code to obtain a test comparison and analysis result of the target version code. The method can improve the comprehensiveness of the code test, the accuracy and the comparison efficiency of the code test, and is favorable for accurately positioning the problem codes.

Description

Code testing method and device, storage medium and computer equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a code testing method, apparatus, storage medium, and computer device.
Background
With the continuous development of computer technology, the development of code languages has been improved rapidly, and at present, new code languages and new system architectures are coming up endlessly, and in order to adapt to new code languages and new system architectures, some software products start to choose to replace old languages with new code languages and old architectures with new architectures, so as to improve the performance of software products.
In the process of updating iteration of new and old codes, testing of the new codes becomes a very important task, and in the process of testing the new codes, a very important task is to test whether the new codes realize the existing functions of the old codes or not so as to confirm whether code replacement achieves the expected purpose or not.
However, since the old code is written in a long time and the required document is seriously lost, great difficulty is caused to the test, and the omission of the function test is easily caused.
Disclosure of Invention
In view of this, the present application provides a code testing method, system, storage medium and computer device, and mainly aims to solve the technical problems of incompleteness, low accuracy and poor efficiency of a new version code testing result.
According to a first aspect of the present invention, there is provided a code testing method, the method comprising:
acquiring a target version code and an original version code corresponding to the target version code, and acquiring a code branch test point and a reference format of the original version code;
constructing a test case according to the code branch test point and the parameter entering format of the original version code;
respectively testing the target version code and the original version code through the test case to obtain test results of the target version code and the original version code;
and comparing and analyzing the test results of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
According to a second aspect of the present invention, there is provided a code testing apparatus, comprising:
the test code acquisition module is used for acquiring a target version code and an original version code corresponding to the target version code, and acquiring a code branch test point and a parameter entering format of the original version code;
the test case building module is used for building a test case according to the code branch test point and the parameter entering format of the original version code;
the test result generation module is used for respectively testing the target version code and the original version code through the test case to obtain the test results of the target version code and the original version code;
and the test result comparison module is used for comparing and analyzing the test results of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
According to a third aspect of the present invention, there is provided a storage medium having stored thereon a computer program which, when executed by a processor, implements the code testing method described above.
According to a fourth aspect of the present invention, there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the code testing method when executing the program.
The invention provides a code testing method, a device, a storage medium and computer equipment, which are characterized in that a target version code and an original version code corresponding to the target version code are firstly obtained, a code branch test point and a reference format of the original version code are obtained, then a test case is constructed according to the code branch test point and the reference format of the original version code, then the target version code and the original version code are tested through the test case to obtain test results of the target version code and the original version code, and finally the test results of the target version code and the original version code are compared and analyzed to obtain a test comparison and analysis result of the target version code. The method constructs the test case according to the code branch test points and the reference format of the original version code, can cover the constructed test case to the test points on all code branches in the original version code, improves the comprehensiveness of the code test, and simultaneously tests, compares and analyzes the codes of the new version and the old version through the test case, can improve the accuracy and the comparison efficiency of the code test, and is beneficial to accurately positioning the problem code.
The foregoing description is only an overview of the technical solutions of the present application, and the present application can be implemented according to the content of the description in order to make the technical means of the present application more clearly understood, and the following detailed description of the present application is given in order to make the above and other objects, features, and advantages of the present application more clearly understandable.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a code testing method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another code testing method provided by the embodiment of the invention;
FIG. 3 is a schematic structural diagram of a code testing apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another code testing apparatus provided in the embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
In one embodiment, as shown in fig. 1, a code testing method is provided, which is described by taking the method as an example of being applied to a computer device such as a client or a server, and includes the following steps:
101. and acquiring a target version code and an original version code corresponding to the target version code, and acquiring a code branch test point and a reference format of the original version code.
Wherein, the target version code refers to the code of the current version to be tested; the original version code corresponding to the target version code refers to a code of a previous version that realizes the same function as the target version code. Specifically, before the code test, the computer device may first obtain a target version code to be tested and an original version code corresponding to the target version code, and for the original version code, since the original version code does not have sufficient documents to provide the required information under normal conditions, the code branching, the implementation function, the parameter entering format and the parameter exiting format of the original version code need to be combed in advance to obtain the code branching test point, the parameter entering format and the parameter exiting format of the original version code. In this embodiment, the code branch of the original version code may be organized according to each program branch in the original version code, or may be completed with the aid of a program code branch reading tool. Further, after obtaining the original version code, the computer device may further obtain a code branch test point and a reference format of the original version code.
102. And constructing a test case according to the code branch test point and the parameter entering format of the original version code.
Specifically, the computer device may construct a test case according to the code branch test point and the parameter entering format of the original version code. When the test case is constructed, the test case needs to cover the test points of all code branches in the original version code, and in this step, the test case can be constructed by adopting an equivalence method, and the test case can also be constructed by adopting other methods. It should be noted that the constructed test case not only needs to cover all code branches in the original version code, but also needs to correspond to test points of each code branch in the original version code, so as to achieve the effect of code path coverage.
103. And respectively testing the target version code and the original version code through the test case to obtain the test results of the target version code and the original version code.
Specifically, the computer device may respectively test the target version code and the original version code through the constructed test case, so as to obtain a test result of the target version code and a test result of the original version code, and then the computer device may further store the test result of the target version code and the test result of the original version code in the database.
In this embodiment, the computer device may first test the original version code through the test case to obtain a test result of the original version code, so as to facilitate comparison with the test result of the original version code as an expected result of the target version code. Specifically, before testing the original version code, the input parameter data of the original version code may be stored in the database, after the original version code is tested, the output parameter data of the original version code is converted into the output parameter format of the target version code and then stored in the database, and finally, the output parameter data of the format-converted original version code is used as an expected result of comparison of the test result of the target version code.
Further, while testing the original version code, the target version code may also be tested by creating multiple threads, so as to obtain a test result of the target version code, specifically, before testing the target version code, the input parameter data of the test case may be first converted into the input parameter format of the target version code, then the interface of the target version code is called, and after the test of the target version code is finished, the input parameter data and the output parameter data of the target version code are stored in the database as a comparison basis of the test result.
In this embodiment, after the execution of each test case is completed, a test comparison record may be generated in the database, so that after all the test cases are executed, all the test results are recorded in the database.
104. And comparing and analyzing the test results of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
Specifically, the computer device may compare the parameter output data of the target version code with the parameter output data of the original version code after format conversion one by one to obtain a comparison analysis result. In the process of alignment, the alignment results can be recorded in the following way: if the comparison of certain parameter data is consistent, marking the comparison field as Y; if the comparison of a certain parameter is inconsistent, the comparison field is marked as N, and the contents of the inconsistent field can be additionally recorded into other recording tables in the comparison process, so that the problem of positioning is facilitated.
Furthermore, for data with inconsistent comparison of the output parameter data, the interface of the target version code and the interface of the original version code can be called again, code path branches of the target version code and the interface of the original version code are respectively obtained through the path analysis plug-in, then, the comparison is carried out again according to key code points output by the plug-in, inconsistent key code points in the old code and the new code can be positioned and recorded in corresponding comparison fields, and finally, the comparison result of the output parameter data and the comparison result of the path are combined, so that the test comparison analysis result of the target version code can be obtained. The step verifies whether the test case is completely covered or not through the comparison analysis of the test result and the path analysis, and can help developers to locate the problems existing in the target version code.
The code testing method provided by the embodiment includes the steps of firstly obtaining a target version code and an original version code corresponding to the target version code, obtaining a code branch test point and a reference format of the original version code, then constructing a test case according to the code branch test point and the reference format of the original version code, then testing the target version code and the original version code through the test case to obtain test results of the target version code and the original version code, and finally comparing and analyzing the test results of the target version code and the original version code to obtain a test comparison and analysis result of the target version code. The method constructs the test case according to the code branch test points and the reference format of the original version code, can cover the constructed test case to the test points on all code branches in the original version code, improves the comprehensiveness of the code test, and simultaneously tests, compares and analyzes the codes of the new version and the old version through the test case, can improve the accuracy and the comparison efficiency of the code test, and is beneficial to accurately positioning the problem code.
Further, as a refinement and an extension of the specific implementation of the above embodiment, in order to fully illustrate the implementation process of the embodiment, a code testing method is provided, as shown in fig. 2, the method includes the following steps:
201. and acquiring a target version code and an original version code corresponding to the target version code, and acquiring a code branch test point and a reference format of the original version code.
Specifically, before the code test, the computer device may first obtain a target version code to be tested and an original version code corresponding to the target version code, and for the original version code, since the original version code does not have sufficient documents to provide the required information under normal conditions, the code branching, the implementation function, the parameter entering format and the parameter exiting format of the original version code need to be combed in advance to obtain the code branching test point, the parameter entering format and the parameter exiting format of the original version code. In this embodiment, the code branch of the original version code may be organized according to each program branch in the original version code, or may be completed with the aid of a program code branch reading tool. Further, after obtaining the original version code, the computer device may further obtain a code branch test point and a reference format of the original version code.
For example, the code branch example of the original version code is shown in the following table, wherein each row of data in the table may represent one code branch of the original version code, and the test point, the entry format and the exit format corresponding to each code branch may be determined according to the sorted code branch and the original version code itself.
Figure BDA0002767783610000061
Figure BDA0002767783610000071
202. And constructing a test case according to the code branch test point and the parameter entering format of the original version code.
Specifically, the computer device may construct a test case according to the code branch test point and the parameter entering format of the original version code. When the test case is constructed, the test case needs to cover the test points of all code branches in the original version code, and in this step, the test case can be constructed by adopting an equivalence method, and the test case can also be constructed by adopting other methods. It should be noted that the constructed test case not only needs to cover all code branches in the original version code, but also needs to correspond to test points of each code branch in the original version code, so as to achieve the effect of code path coverage.
In an optional embodiment, the method for constructing the test case according to the code branch test point and the entry format of the original version code may include the following steps: the method comprises the steps of firstly determining an equivalent test class according to a code branch test point and a reference format of an original version code, constructing an equivalent class list according to the equivalent test class, then configuring a test case number and a test case name for the equivalent test class in the equivalent class list, and finally constructing a test case according to information configured in the equivalent class list so that the test case can cover all code branch test points in the original version code. In this embodiment, the equivalence test classes may include an effective equivalence class and an ineffective equivalence class, when constructing a test case according to information configured in the equivalence class list, a batch of test cases may be first constructed to cover as much as possible the effective equivalence classes that are not yet covered, this step is repeated until all the effective equivalence classes are covered completely, then another batch of test cases is continuously constructed to cover as much as possible the ineffective equivalence classes that are not yet covered, this step is repeated until all the ineffective equivalence classes are covered completely, and the test case is constructed by the equivalence class method, so that the constructed test case can completely cover all code branches of the original version code, and the construction of the test case is more comprehensive.
For example, taking a code branch in the original version code as an example, the format of the constructed test case is shown in the following table, where the test case at least includes a code branch test point of the original version code, parameter data in the parameter format of the original version code, and parameters such as a test case number and a test case name, and in addition, the test case may further include parameters such as an expected test result and an actual test result.
Figure BDA0002767783610000081
203. And respectively testing the target version code and the original version code through the test case to obtain the test results of the target version code and the original version code.
Specifically, the computer device may respectively test the target version code and the original version code through the constructed test case, so as to obtain a test result of the target version code and a test result of the original version code, and then the computer device may further store the test result of the target version code and the test result of the original version code in the database. In this embodiment, after the execution of each test case is completed, a test comparison record is generated in the database, and after all the test cases are executed, all the test results are recorded in the database.
In an optional embodiment, the method for separately testing the target version code and the original version code through the test case may include the following steps: firstly, calling an interface of an original version code through input parameter data of a test case to obtain output parameter data of the original version code, then converting the output parameter data of the original version code into output parameter data of a target version code in an output parameter format, storing the converted output parameter data of the original version code in a database, then converting the input parameter data of the test case into input parameter data of the target version code, then calling the interface of the target version code, finally obtaining the output parameter data of the target version code, and storing the output parameter data of the target version code in the database. By the mode, one set of test case can simultaneously test the new set of codes and the old set of codes, and test results with consistent formats are output for direct comparison, so that the test comparison efficiency of the new codes and the old codes is effectively improved.
In another alternative embodiment, the target version code and the original version code may be tested simultaneously by creating multiple threads, so as to obtain the test results of the target version code and the original version code simultaneously, and in this way, the efficiency of the test may be further improved.
204. And comparing and analyzing the test results of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
Specifically, the computer device may compare the parameter output data of the target version code with the parameter output data of the original version code after format conversion one by one to obtain a comparison analysis result. In the process of alignment, the alignment results can be recorded in the following way: if the comparison of certain parameter data is consistent, marking the comparison field as Y; if the comparison of a certain parameter is inconsistent, the comparison field is marked as N, and the contents of the inconsistent field can be additionally recorded into other recording tables in the comparison process, so that the problem of positioning is facilitated.
Furthermore, for data with inconsistent comparison of the output parameter data, the interface of the target version code and the interface of the original version code can be called again, code path branches of the target version code and the interface of the original version code are respectively obtained through the path analysis plug-in, then, the comparison is carried out again according to key code points output by the plug-in, inconsistent key code points in the old code and the new code can be positioned and recorded in corresponding comparison fields, and finally, the comparison result of the output parameter data and the comparison result of the path are combined, so that the test comparison analysis result of the target version code can be obtained. The step verifies whether the test case is completely covered or not through the comparison analysis of the test result and the path analysis, and can help developers to locate the problems existing in the target version code.
In an alternative embodiment, the method for performing comparative analysis on the test results of the target version code and the original version code may include the following steps: firstly comparing parameter data of a target version code with parameter data of an original version code after format conversion one by one to obtain a test result comparison record of the target version code, then finding out a target test case with inconsistent parameter data comparison in the test result comparison record of the target version code, then retesting the target version code and the original version code respectively through the target test case to obtain code path branches of the target version code and the original version code, and finally comparing and analyzing the code path branches of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
In the above embodiment, the method for performing comparison analysis on the code path branches of the target version code and the original version code may further include the following steps: firstly, comparing key code points of code path branches of a target version code and an original version code to obtain difference code points, and then recording the difference code points in a comparison record of a test result of the target version code to obtain a test comparison analysis result of the target version code. By comparing the parameter data of the original version code with the parameter data of the target version code and analyzing the path of the data with inconsistent comparison, the accuracy of code testing can be effectively improved, and the problem code can be positioned.
For example, after the execution of the test case listed in step 202 is completed, a test record is automatically generated, and the test record can be regarded as a test record in the result of the test comparison analysis of the target version code, where the content of the test record is as follows:
target version code interface name: generateAnnualReport;
case numbering: WNNB _ 027;
policy number: p010000005123101;
database time: 2015-11-30;
ginseng introduction: { "dept No": "825", "endDate": "2012-11-01", "orphan register": "," planType ": "02", "polno": "P010000005123101", "printDate": "," regionCode ": "01", "repMonth": "," repType ": "3", "sourceCode": "app", "startDate": "2011-07-1" };
and (3) the code interface of the original version participates in: { "data": { "sequence": "S1", "pkgMessage": "program interface runs normally", "pkgSuccess": "0" }, "responseSts": { "flag": "0", "message": "program interface runs normally" };
the target version code interface is participated: { "responseSts": { "flag": "0", "message": "program interface operates normally" }, "data": { "sequence": "S0002488725", "pkgMessage": "program interface runs normally", "pkgSuccess": "0" };
table data to be compared by the original version code interface: { "responseSts": { "flag": "0", "message": "success of execution" }, "result": { "sqlRs": { "UlifeInfoDTO": [ { "IS _ EMAIL": "N", "INS _ NAME": "ceramic Yao. };
table data to be compared by the target version code interface: { "responseSts": { "flag": "0", "message": "success of execution" }, "result": { "sqlRs": { "UlifeInfoDTO": [ { "IS _ EMAIL": "N", "INS _ NAME": "ceramic Yao. };
whether the comparison is consistent: y;
and (5) comparing inconsistent information: none;
testing points: v _ ulife _ info. result _ sum _ ins: sum _ ins, v _ ulif _ info
From the test records, the test case simultaneously tests the interface of the original version code and the interface of the target version code, obtains the parameter output data of the original version code and the parameter output data of the target version code respectively, can directly compare the parameter output data of the original version code with the parameter output data of the target version code by automatically converting the parameter output data of the original version code into the parameter output format of the target version code, and directly outputs the test records to be stored in the test comparison analysis result of the target version code without subsequent path comparison because the parameter output data are compared consistently, and the test result is marked as Y.
205. And performing automatic regression testing on all interfaces of the target version code according to the interface name of the target version code to obtain a regression testing result of the target version code.
Specifically, after the unit test of the target version code is completed, the computer device may further perform an auto-regression test on all interfaces of the target version code according to the interface name of the target version code. Specifically, in the process of performing the regression test, the interface of the target version code may be directly called through the input parameter of the target version code stored in the database, that is, the regression test result of the available target version code.
206. And comparing and analyzing the regression test result of the target version code and the test result of the original version code, and updating the test comparison and analysis result of the target version code according to the comparison and analysis result.
Specifically, after obtaining the regression test result of the target version code, the parameter output data of the regression test result may be used to cover the parameter output data during the interface unit test in step 203, and the new parameter output data is used to compare with the parameter output data of the original version code after format conversion one by one again, and finally, the comparison result in step 204 is re-marked, if the comparison result is consistent, the comparison field is marked as Y; if the comparison is not consistent, the comparison field is marked as N. By the method, the test comparison analysis result of the target version code can be updated, and the regression test result is added into the updated test comparison analysis result of the target version code, so that the test result is more accurate. In addition, the regression test can also be applied to a scene that a certain interface is changed after the target version code is on line, and by the mode, after the certain interface of the target version code is modified, all the interfaces related to the interface do not need to be subjected to unit test, only the modified interface needs to be subjected to unit test, and the interface related to the interface are subjected to automatic regression test, so that the efficiency of interface test is improved.
The code testing method provided by the embodiment solves the problem that no unexpected requirement is needed for the code function test when the new code and the old code are replaced, and in the method, since the test case of the target version code is created based on the code branch of the original version code, thus, the test cases may cover test points on all code branches in the original version of code, based on which, in addition, the scheme effectively improves the efficiency and the accuracy of code testing through automatic conversion of input and output parameters, automatic comparison of test results, automatic analysis of code paths and automatic regression testing, is favorable for positioning problematic codes, and assists developers to solve practical problems.
Further, as a specific implementation of the method shown in fig. 1 and fig. 2, this embodiment provides a code testing apparatus, as shown in fig. 3, the apparatus includes: the test system comprises a test code acquisition module 31, a test case construction module 32, a test result generation module 33 and a test result comparison module 34.
A test code obtaining module 31, configured to obtain a target version code and an original version code corresponding to the target version code, and obtain a code branch test point and a reference format of the original version code;
the test case building module 32 is used for building a test case according to the code branch test point and the parameter entering format of the original version code;
the test result generation module 33 is configured to test the target version code and the original version code respectively through the test case to obtain test results of the target version code and the original version code;
the test result comparing module 34 may be configured to compare and analyze the test results of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
In a specific application scenario, the test case construction module 32 may be specifically configured to determine an equivalent test class according to a code branch test point and a reference format of an original version code, and construct an equivalent class list according to the equivalent test class; configuring a test case number and a test case name for an equivalent test class in the equivalent class list; and constructing a test case according to the information configured in the equivalence class list so that the test case covers all the code branch test points in the original version code.
In a specific application scenario, the test result generation module 33 may be specifically configured to call an interface of the original version code through an input parameter of the test case to obtain output parameter data of the original version code; converting the parameter data of the original version code into parameter data of a parameter format of the target version code, and storing the converted parameter data of the original version code in a database; the method comprises the steps of converting input parameter data of a test case into input parameter data of an input parameter format of a target version code, and calling an interface of the target version code to obtain output parameter data of the target version code; and storing the parameter data of the target version code in a database.
In a specific application scenario, the test result generating module 33 may be specifically configured to simultaneously test the target version code and the original version code in a multi-thread creating manner, so as to obtain a test result of the target version code and the original version code.
In a specific application scenario, the test result comparison module 34 is specifically configured to compare the parameter output data of the target version code with the parameter output data of the original version code after format conversion one by one to obtain a test result comparison record of the target version code; finding out target test cases with inconsistent parameter data in the comparison records of the test results of the target version codes; retesting the target version code and the original version code respectively through the target test case to obtain code path branches of the target version code and the original version code; and comparing and analyzing the code path branches of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
In a specific application scenario, the test result comparison module 34 may be specifically configured to compare key code points of code path branches of the target version code and the original version code to obtain a difference code point; and recording the difference code points in the comparison record of the test result of the target version code to obtain the test comparison analysis result of the target version code.
In a specific application scenario, as shown in fig. 4, the apparatus further includes an auto-regression testing module 35, where the auto-regression testing module 35 is specifically configured to perform auto-regression testing on all interfaces of the target version code according to the interface name of the target version code, so as to obtain a regression testing result of the target version code; the test result comparison module 34 may be further configured to compare and analyze the regression test result of the target version code and the test result of the original version code, and update the test comparison and analysis result of the target version code according to the comparison and analysis result.
It should be noted that other corresponding descriptions of the functional units related to the code testing apparatus provided in this embodiment may refer to the corresponding descriptions in fig. 1 and fig. 2, and are not repeated herein.
Based on the methods shown in fig. 1 and fig. 2, correspondingly, the present embodiment further provides a storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the code testing method shown in fig. 1 and fig. 2.
Based on such understanding, the technical solution of the present application may be embodied in the form of a software product, and the software product to be identified may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, or the like), and include several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the method according to the implementation scenarios of the present application.
Based on the above methods shown in fig. 1 and fig. 2 and the code testing apparatus embodiments shown in fig. 3 and fig. 4, to achieve the above object, this embodiment further provides a code testing entity device, which may specifically be a personal computer, a server, a smart phone, a tablet computer, a smart watch, or other network devices, and the entity device includes a storage medium and a processor; a storage medium for storing a computer program; a processor for executing the computer program to implement the above-mentioned methods as shown in fig. 1 and fig. 2.
Optionally, the entity device may further include a user interface, a network interface, a camera, a Radio Frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and the like. The user interface may include a Display screen (Display), an input unit such as a keypad (Keyboard), etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface), etc.
It will be understood by those skilled in the art that the physical device structure for code testing provided in the present embodiment does not constitute a limitation to the physical device, and may include more or less components, or combine some components, or arrange different components.
The storage medium may further include an operating system and a network communication module. The operating system is a program for managing the hardware of the above-mentioned entity device and the software resources to be identified, and supports the operation of the information processing program and other software and/or programs to be identified. The network communication module is used for realizing communication among components in the storage medium and communication with other hardware and software in the information processing entity device.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present application can be implemented by software plus a necessary general hardware platform, and can also be implemented by hardware. By applying the technical scheme of the application, the target version code and the original version code corresponding to the target version code are firstly obtained, the code branch test point and the reference format of the original version code are obtained, then the test case is constructed according to the code branch test point and the reference format of the original version code, then the target version code and the original version code are tested through the test case to obtain the test results of the target version code and the original version code, and finally the test results of the target version code and the original version code are compared and analyzed to obtain the test comparison and analysis result of the target version code. Compared with the prior art, the method constructs the test case according to the code branch test points and the reference format of the original version code, so that the constructed test case can cover the test points on all code branches in the original version code, the comprehensiveness of the code test is improved, and the method can improve the accuracy and the comparison efficiency of the code test and is beneficial to the accurate positioning of the problem code by simultaneously testing and comparing the codes of the new version and the old version through the test case.
Those skilled in the art will appreciate that the figures are merely schematic representations of one preferred implementation scenario and that the blocks or flow diagrams in the figures are not necessarily required to practice the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario may be distributed in the devices in the implementation scenario according to the description of the implementation scenario, or may be located in one or more devices different from the present implementation scenario with corresponding changes. The modules of the implementation scenario may be combined into one module, or may be further split into a plurality of sub-modules.
The above application serial numbers are for description purposes only and do not represent the superiority or inferiority of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of the present application, but the present application is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present application.

Claims (10)

1. A method for code testing, the method comprising:
acquiring a target version code and an original version code corresponding to the target version code, and acquiring a code branch test point and a reference format of the original version code;
constructing a test case according to the code branch test point and the parameter entering format of the original version code;
respectively testing the target version code and the original version code through the test case to obtain test results of the target version code and the original version code;
and comparing and analyzing the test results of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
2. The method of claim 1, wherein constructing the test case according to the code branch test point and the reference format of the original version code comprises:
determining an equivalent test class according to the code branch test point and the entry format of the original version code, and constructing an equivalent class list according to the equivalent test class;
configuring a test case number and a test case name for the equivalent test class in the equivalent class list;
and constructing a test case according to the information configured in the equivalence class list so that the test case covers all code branch test points in the original version code.
3. The method according to claim 1, wherein the obtaining the test results of the target version code and the original version code by testing the target version code and the original version code respectively through the test case comprises:
calling an interface of the original version code through the input parameter data of the test case to obtain the output parameter data of the original version code;
converting parameter data of the original version code into parameter data of a parameter format of a target version code, and storing the converted parameter data of the original version code in a database;
converting the input parameter data of the test case into input parameter data of an input parameter format of a target version code, and calling an interface of the target version code to obtain output parameter data of the target version code;
and storing the parameter data of the target version code in a database.
4. The method of claim 3, wherein the target version code and the original version code are tested through the test case to obtain test results of the target version code and the original version code, and further comprising:
and simultaneously testing the target version code and the original version code in a multithreading mode to obtain the test results of the target version code and the original version code.
5. The method of claim 3, wherein the comparing and analyzing the test results of the target version code and the original version code to obtain the test comparison and analysis result of the target version code comprises:
comparing the parameter output data of the target version code with the parameter output data of the original version code after format conversion one by one to obtain a test result comparison record of the target version code;
finding out target test cases with inconsistent parameter data in the test result comparison records of the target version codes;
retesting the target version code and the original version code respectively through the target test case to obtain code path branches of the target version code and the original version code;
and comparing and analyzing the code path branches of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
6. The method of claim 5, wherein comparing and analyzing the code path branches of the target version code and the original version code to obtain a test comparison analysis result of the target version code, comprises:
comparing the key code points of the code path branches of the target version code and the original version code to obtain a difference code point;
and recording the difference code points in a comparison record of the test result of the target version code to obtain a test comparison analysis result of the target version code.
7. The method of claim 1, further comprising:
performing automatic regression testing on all interfaces of the target version code according to the interface name of the target version code to obtain a regression testing result of the target version code;
and comparing and analyzing the regression test result of the target version code and the test result of the original version code, and updating the test comparison and analysis result of the target version code according to the comparison and analysis result.
8. A code testing apparatus, characterized in that the apparatus comprises:
the test code acquisition module is used for acquiring a target version code and an original version code corresponding to the target version code, and acquiring a code branch test point and a parameter entering format of the original version code;
the test case building module is used for building a test case according to the code branch test point and the parameter entering format of the original version code;
the test result generation module is used for respectively testing the target version code and the original version code through the test case to obtain the test results of the target version code and the original version code;
and the test result comparison module is used for comparing and analyzing the test results of the target version code and the original version code to obtain a test comparison and analysis result of the target version code.
9. A storage medium having a computer program stored thereon, the computer program, when being executed by a processor, realizing the steps of the method of any one of claims 1 to 7.
10. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 7 when executed by the processor.
CN202011239141.0A 2020-11-09 2020-11-09 Code testing method and device, storage medium and computer equipment Pending CN112363921A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011239141.0A CN112363921A (en) 2020-11-09 2020-11-09 Code testing method and device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011239141.0A CN112363921A (en) 2020-11-09 2020-11-09 Code testing method and device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN112363921A true CN112363921A (en) 2021-02-12

Family

ID=74509890

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011239141.0A Pending CN112363921A (en) 2020-11-09 2020-11-09 Code testing method and device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN112363921A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113297088A (en) * 2021-06-08 2021-08-24 北京百度网讯科技有限公司 Test method, test device, electronic apparatus, and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113297088A (en) * 2021-06-08 2021-08-24 北京百度网讯科技有限公司 Test method, test device, electronic apparatus, and storage medium
CN113297088B (en) * 2021-06-08 2023-11-07 北京百度网讯科技有限公司 Test method, test device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109828903B (en) Automatic testing method and device, computer device and storage medium
CN111159049B (en) Automatic interface testing method and system
CN109871326B (en) Script recording method and device
CN109726105B (en) Test data construction method, device, equipment and storage medium
CN109933520B (en) Software development testing method and device, computer device and storage medium
CN111897740B (en) User interface testing method and device, electronic equipment and computer readable medium
CN109828905B (en) Automatic test method, device, computer device and storage medium
CN111522942B (en) Training method and device for text classification model, storage medium and computer equipment
Yu et al. LIRAT: Layout and image recognition driving automated mobile testing of cross-platform
CN112817866A (en) Recording playback method, device, system, computer equipment and storage medium
CN111581083A (en) Interface testing method and device, electronic equipment and storage medium
CN112069068A (en) Automatic test data processing method, device, equipment and readable storage medium
CN114610286A (en) Development document generation method and device, computer equipment and storage medium
CN115794641A (en) Method, device and equipment for making number based on business process and storage medium
CN107368407B (en) Information processing method and device
CN109840212B (en) Function test method, device and equipment of application program and readable storage medium
CN112363921A (en) Code testing method and device, storage medium and computer equipment
CN114780386A (en) Software testing method, device, equipment and storage medium
CN112671878B (en) Block chain information subscription method, device, server and storage medium
CN109740074B (en) Method, device and equipment for processing parameter configuration information
CN110457219B (en) Method and device for selecting time when test script is recorded
CN114968960A (en) Log processing method and device, computer equipment and storage medium
Průcha Aspect optimalization of robotic process automation
CN111949510A (en) Test processing method and device, electronic equipment and readable storage medium
CN114546816B (en) Test method, platform, device, electronic 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