CN111666201A - Regression testing method, device, medium and electronic equipment - Google Patents

Regression testing method, device, medium and electronic equipment Download PDF

Info

Publication number
CN111666201A
CN111666201A CN201910176662.7A CN201910176662A CN111666201A CN 111666201 A CN111666201 A CN 111666201A CN 201910176662 A CN201910176662 A CN 201910176662A CN 111666201 A CN111666201 A CN 111666201A
Authority
CN
China
Prior art keywords
test
execution result
data
version
interface
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
CN201910176662.7A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910176662.7A priority Critical patent/CN111666201A/en
Publication of CN111666201A publication Critical patent/CN111666201A/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 embodiment of the invention provides a regression testing method, a regression testing device, a computer readable medium and electronic equipment, and relates to the technical field of software testing. The method comprises the following steps: collecting log data of an online version of an application program; determining test data required by the test task of the application program from the log data; acquiring a first execution result of the online version of the test task by using the test data, and acquiring a second execution result of the test task in the to-be-tested version of the application program; and comparing the first execution result with the second execution result, and determining the test result of the version to be tested according to the comparison result. The technical scheme of the embodiment of the invention can improve the efficiency of regression testing.

Description

Regression testing method, device, medium and electronic equipment
Technical Field
The invention relates to the technical field of software testing, in particular to a regression testing method, a regression testing device, a computer readable medium and electronic equipment.
Background
With the rapid development of network technology, application software is developed endlessly, and the iteration cycle is shorter and shorter.
In order to meet the requirements of users, application software is frequently modified and perfected after being pushed out, and new versions are continuously pushed out. After the application software is modified, the test engineer needs to test the modified application to ensure that no new problems are introduced. With the continuous release of new versions of application software, regression testing is more and more frequent and workload is more and more heavy. In order to ensure that the modified code does not affect the published version, it is necessary to compare whether the execution results of the modified application software and the published application software are the same in the same operation, so that a large amount of online data of the application software needs to be collected when performing the regression test. The on-line data generally includes a plurality of test cases, and input data, execution conditions, and output results of the test cases. At present, the acquisition code of the online data is coupled in the application software, and the acquired data cannot be dynamically changed. In addition, in order to avoid affecting the online version of data, only the output result of the data reading interface can be obtained, and the data writing interface cannot be tested.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present invention and therefore may include information that does not constitute prior art known to a person of ordinary skill in the art.
Disclosure of Invention
Embodiments of the present invention provide a regression testing method, a regression testing apparatus, a computer readable medium, and an electronic device, so as to overcome the problem of low regression testing efficiency at least to a certain extent.
Additional features and advantages of the invention will be set forth in the detailed description which follows, or may be learned by practice of the invention.
According to a first aspect of embodiments of the present invention, there is provided a regression testing method, including: collecting log data of an online version of an application program; determining test data required by the test task of the application program from the log data; acquiring a first execution result of the online version of the test task by using the test data, and acquiring a second execution result of the test task in the version to be tested of the application program; and comparing the first execution result with the second execution result, and determining the test result of the version to be tested according to the comparison result.
Optionally, determining, from the log data, test data required for the test task of the application program may include: determining the type of an interface contained in the test task; and if the interface is the preset type interface, determining the input parameters corresponding to the preset type interface and the output result matched with the input parameters from the log data.
Optionally, the obtaining of the first execution result of the online version of the test task using the test data may include: when the test task comprises the interface of the preset type, determining an input value to be responded by the interface of the preset type in the test task; inquiring input parameters matched with the input values from the test data, and determining output results matched with the input parameters as output values of the preset type of interface; simulating a calling result of the interface of the preset type according to the output value when the online version executes the test task so as to obtain a first execution result of the test task; and when the interface of the preset type is called by other interfaces in the test task, returning the calling result to the other interfaces so as to obtain a first execution result of the test task.
Optionally, the test task of the application program may include a plurality of interfaces to be tested, and a dependency relationship exists between the plurality of interfaces to be tested.
Optionally, the obtaining a first execution result of the online version of the test task by using the test data, and obtaining a second execution result of the to-be-tested version of the test task by using the test data may include: inserting test data into a test case corresponding to a test task through a byte code injection technology; executing the test case on the online version to obtain a first execution result; and executing the test case on the version to be tested to obtain a second execution result.
Optionally, the obtaining a first execution result of the online version of the test task by using the test data, and obtaining a second execution result of the test task in the version of the application program to be tested may include: determining a first identification number for a plurality of interfaces to be tested contained in the same test task, and determining a second identification number for the interfaces to be tested according to the dependency relationship among the interfaces to be tested; testing each interface to be tested on the online version and the version to be tested respectively, and determining a first test result and a second test result of each interface to be tested according to the first identification number and the second identification number; and determining a first execution result and a second execution result of each test task according to a first test result and a second test result of each interface to be tested contained in each test task.
Optionally, comparing the first execution result with the second execution result, and determining the test result of the version to be tested according to the comparison result may include: comparing the first execution result and the second execution result of each test task; and when the first execution result is different from the second execution result, determining that the version to be tested does not pass the test.
According to a second aspect of the embodiments of the present invention, there is provided a regression test apparatus including: the data acquisition unit is used for acquiring log data of an online version of the application program; the test data determining unit is used for determining test data required by the test task of the application program from the log data; the test unit is used for acquiring a first execution result of the online version of the test task by using the test data and acquiring a second execution result of the test task in the to-be-tested version of the application program; and the test result comparison unit is used for comparing the first execution result with the second execution result and determining the test result of the version to be tested according to the comparison result.
Alternatively, the test data determination unit may include: the interface determining unit is used for determining the type of an interface contained in the test task; and the first data acquisition unit is used for determining input parameters corresponding to the interface of the preset type and an output result matched with the input parameters from the log data when the interface is the interface of the preset type.
Alternatively, the test unit may include: the input determining unit is used for determining an input value to be responded by the interface of the preset type in the test task when the test task comprises the interface of the preset type; the output determining unit is used for inquiring the input parameters matched with the input values from the test data and determining the output results matched with the input parameters as the output values of the interfaces of the preset type; a first result obtaining unit, configured to simulate, according to the output value, a call result of the interface of the preset type when the online version executes the test task, so as to obtain a first execution result of the test task; and the second result acquisition unit is used for returning the calling result to other interfaces when the preset type of interface is called by other interfaces in the test task so as to acquire a first execution result of the test task.
Optionally, in the regression testing apparatus, the test task of the application program may include a plurality of interfaces to be tested, and a dependency relationship may exist between the plurality of interfaces to be tested.
Optionally, the test unit may further include: the case determining unit is used for inserting the test data into the test case corresponding to the test task; a third result obtaining unit, configured to execute the test case on the online version to obtain the first execution result; and the fourth result acquisition unit is used for executing the test case on the version to be tested so as to acquire the second execution result.
Optionally, the test unit may include: the identification unit is used for determining a first identification number for a plurality of interfaces to be tested contained in the same test task and determining a second identification number for the interfaces to be tested according to the dependency relationship; and a fifth result obtaining unit, configured to test the interface to be tested on the online version and the version to be tested, and determine a first execution result and a second execution result of each of the test tasks according to the first identification number and the second identification number.
Optionally, the test result comparing unit may include: a matching unit, configured to compare the first execution result and the second execution result of each of the test tasks; and the determining unit is used for determining that the version to be tested does not pass the test when the first execution result is different from the second execution result.
Optionally, the test data determining unit may include: the application unit is used for acquiring the configuration conditions corresponding to the test tasks from a third-party application through a byte code injection technology; and the data screening unit is used for determining the test data from the log data according to the configuration conditions.
According to a third aspect of embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which program, when executed by a processor, implements the regression testing method as described in the first aspect of the embodiments above.
According to a fourth aspect of embodiments of the present invention, there is provided an electronic apparatus, including: one or more processors; storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a regression testing method as described in the first aspect of the embodiments above.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
according to the regression testing method in the exemplary embodiment, on one hand, by collecting log data of an online version of an application program, test data required by a test task of the application program can be determined from the log data, and the diversity and the authenticity of the test data can be improved; and the test data can adapt to the requirements of the test task, so that the flexibility of the test data can be improved. On the other hand, the test data can be used for obtaining a first execution result of the online version of the test task and a second execution result of the version to be tested, and then the test result of the version to be tested can be determined by comparing the execution results of the two times, so that the regression test is completed. Because the test data is selected from the log of the online version, the data of the online version cannot be changed, and the test accuracy can be improved; in addition, the interface for writing data can be tested by using the test data, so that the automation degree of the test is improved, and the test efficiency is greatly improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 schematically shows a system architecture diagram for implementing a data monitoring method according to an embodiment of the invention;
FIG. 2 schematically illustrates a first flowchart of a regression testing method according to an embodiment of the invention;
FIG. 3 schematically illustrates a second flow chart of a regression testing method according to an embodiment of the present invention;
FIG. 4 schematically illustrates a third flow chart of a regression testing method according to an embodiment of the present invention;
FIG. 5 schematically illustrates a fourth flowchart of a regression testing method according to an embodiment of the invention;
FIG. 6 schematically illustrates a fifth flowchart of a regression testing method according to an embodiment of the invention;
FIG. 7 schematically illustrates a sixth flow chart of a regression testing method according to an embodiment of the present invention;
FIG. 8 schematically illustrates a seventh flow diagram of a regression testing method according to an embodiment of the invention;
FIG. 9 schematically illustrates an eighth flow diagram of a regression testing method according to an embodiment of the invention;
FIG. 10 schematically illustrates a block diagram of a regression test apparatus according to an embodiment of the present invention;
FIG. 11 illustrates a schematic structural diagram of a computer system suitable for use with the electronic device to implement an embodiment of the invention.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known methods, devices, implementations or operations have not been shown or described in detail to avoid obscuring aspects of the invention.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. I.e. these functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor means and/or microcontroller means.
The flow charts shown in the drawings are merely illustrative and do not necessarily include all of the contents and operations/steps, nor do they necessarily have to be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
At present, for a test case only containing a single interface, the same input parameters are respectively input into an online version and a version to be tested, and then the output result is compared. For some test cases including both interfaces for reading data and interfaces for writing data, the data of the online version may be changed during online version test, and further the test case may not be executed or fails to be executed.
In view of this, the present exemplary embodiment first provides a system architecture for implementing the regression testing method. Referring to fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send request instructions or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a shopping application, a web browser application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for shopping-like websites browsed by users using the terminal devices 101, 102, 103. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the regression testing method provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the regression testing apparatus is generally disposed in the terminal device 101.
Based on the system architecture 100, a regression testing method is first provided in this example. As shown in fig. 2, the method may include steps S210, S220, S230, S240. Wherein:
step S210, collecting log data of an online version of an application program;
step S220, determining test data required by the test task of the application program from the log data;
step S230, obtaining a first execution result of the online version of the test task by using the test data, and obtaining a second execution result of the test task in the to-be-tested version of the application program;
step S240, comparing the first execution result with the second execution result, and determining the test result of the version to be tested according to the comparison result.
According to the regression testing method in the exemplary embodiment, on one hand, by collecting log data of an online version of an application program, test data required by a test task of the application program can be determined from the log data, and the diversity and the authenticity of the test data can be improved; and the test data can adapt to the requirements of the test task, so that the flexibility of the test data can be improved. On the other hand, the test data can be used for obtaining a first execution result of the online version of the test task and a second execution result of the version to be tested, and then the test result of the version to be tested can be determined by comparing the execution results of the two times, so that the regression test is completed. Because the test data is selected from the log of the online version, the data of the online version cannot be changed, and the test accuracy can be improved; in addition, the interface for writing data can be tested by using the test data, so that the automation degree of the test is improved, and the test efficiency is greatly improved.
Hereinafter, each step of the regression testing method in the present exemplary embodiment will be described in more detail with reference to fig. 2 to 9.
As shown in fig. 2, in step S210, log data of an online version of an application program is collected.
After the application program is developed, the application program can be deployed in a network, and a user can access the application through the network. For example, an installation package of an application is obtained through a network address, and the application is deployed on the terminal device. The online version may be a version of an application that has been released for use by the user. Log data is generated when the user uses the online version. The log data may include a plurality of log files. The log file may record events sent in online versions, or user actions. Log data can be collected by obtaining a log file; the log data may be collected by various tools, such as data collection software, agent tools, and the like, and the exemplary embodiment is not particularly limited in this regard. The acquired log data can be stored in a database or a storage device; but also to other applications such as kafka, message middleware, etc.
In step S220, test data required for the test task of the application program is determined from the log data.
In the present exemplary embodiment, the test task may include a plurality of test cases, or may be a code file or a code fragment. The test tasks may be used to test individual modules, functional methods, or interfaces in an application. And determining the test data required by the test task from the log data according to the requirement of the test task. The test data may include input parameters and execution conditions of the interface, for example, the test task is an interface for testing read data, and the test data may be input parameters and execution conditions required by the read data interface; in addition, the test data may also include the execution result of the interface or the function, for example, the test task is to test multiple interfaces, which is A, B, C respectively, where a calls B, B to C, then the execution condition of a may include the execution result of B, and the execution condition of B includes the execution result of C, and then the test data may be the input parameter of C, the execution result of B.
In this exemplary embodiment, the code for acquiring the test data from the log data may be written in advance according to the test data to be acquired, and the written code is triggered to be executed when the test data needs to be acquired, so as to acquire the test data from the log data. Alternatively, test data is collected using an agent tool. When requesting data through the port of the agent, the agent can collect target data according to the set configuration and then return corresponding data. Of course, the test data may be obtained in other manners, for example, the log data is analyzed to obtain the input parameters of each module recorded in the log data, and the input parameters are used as the test data.
The obtained test data can be stored in a database; alternatively, the test data may be recorded in a log recording manner; in addition, the test data can also be stored in other forms, such as in a memory, in a message middleware, in a data collector, etc.; this exemplary embodiment is not particularly limited to this.
In step S230, a first execution result of the online version of the test task is obtained by using the test data, and a second execution result of the test task in the version of the application program to be tested is obtained.
In this exemplary embodiment, the executable code corresponding to the test task may be obtained by using the test data, and then the executable code corresponding to the test task is executed on the online version or the version to be tested, and then the execution result of the online version, that is, the first execution result is obtained, and the execution result of the version to be tested is the second execution result. In detail, the test data may be used to replace corresponding parameters in the test task code, and then the replaced code of the test task is executed, so as to obtain a first execution result and a second execution result; or supplementing the test data to the corresponding position of the test task code to form an executable test task code, and further acquiring a first execution result of the online version and a second execution result of the version to be tested. That is, the logic code of the test task may be edited first, and after the test data is obtained, each data is filled in the logic code according to the data attribute of each data included in the test data, so as to generate an executable complete code; or the test task can also be a form template, the test data is filled into the form template after the test data is obtained, and then a complete test case is generated according to the form template.
In step S240, the first execution result and the second execution result are compared, and the test result of the version to be tested is determined according to the comparison result.
In this example embodiment, the first execution result and the second execution result may be execution results of an online version and a version to be tested of the test task. The execution result can include various information, and the information can be a visual page, and images, characters, numbers and the like can be contained in the page; the execution result may also include other information, such as sound, and the like, which is not limited in this exemplary embodiment. If the first execution result is consistent with the second execution result in content, it may be determined that the test of the version to be tested passes, for example, the first execution result and the second execution result are both "5000", both are "Xiaoming", and the like. If the first execution result is inconsistent with the second execution result, for example, the first execution result is an image and the second execution result is a table, it may be determined that the test of the version to be tested does not pass.
To more flexibly determine the test data, in some embodiments, determining the test data required for the test task from the log data may include step S301 and step S302, as shown in fig. 3. In step S301, a third-party application may be started during the regression test by using a bytecode injection technology, and then a tester may configure test data required by the test task in the third-party application in real time, where the configuration of the tester received from the third-party application is used as a configuration condition. In detail, when the regression test is executed, the agent toolkit injected into the bytecode file can be loaded, and then the http service can be pulled up from the agent code by the java agent parameter, so that the third-party application is called. The third-party application may include a visualization page, or may also include application software, such as a management system, data collection software, etc.; and when the application is entered, security authority verification can be set, so that data security is guaranteed. In this application, a tester may enter configuration conditions in a page according to a test task. The configuration condition may be used to screen test data from the log data. And, the configuration condition may include the type of test data required by the test task, or an attribute, for example, the configuration condition may be to screen an interface from log data, determine an input parameter of the interface according to a name of the interface, output a result, and the like.
In step S302, corresponding data is collected according to the configuration condition, for example, if the tester configures the interface, data is collected according to the interface (for example, input parameters, output parameters, etc. of the interface are collected), and then the collected data, that is, the test data, is returned. In addition, after the test data is acquired, the test data may be saved in the form of a log record, or may be directly sent to a database for saving, which is not particularly limited in this exemplary embodiment.
In some embodiments, determining the test data required for the test task of the application from the log data may further include step S401 and step 402, as shown in fig. 4. In step S401, the type of interface included in the test task may be determined. The test task may include a plurality of interfaces, and the types of the interfaces may be different, such as a write data interface, a read data interface, and the like. The type of interface may be determined from an interface specification document corresponding to the application, which typically includes a description of all interfaces of the application. Or, the type of each interface may be identified, and the type of each interface may be determined by using the identification information of the interface.
In step S402, if it is determined that the interface included in the test task is the preset type of interface, the input parameter corresponding to the preset type of interface and the output result matching the input parameter may be determined from the log data. The preset type of interface may be an interface for operating data, and such interfaces may include an interface for writing data, such as an interface for inserting data, an interface for deleting data, and the like; interfaces for modifying data, such as interfaces for ordering data, modifying data, computing, and so forth, may also be included. And if the test task contains the interface of the preset type, determining the input parameter corresponding to the interface and the output result matched with the input parameter from the log data. In detail, the log data is real data generated when the user uses the online version, so that in order to input real input parameters generated by user behavior to the interface in response to user operation, the interface can realize the function of the interface when receiving the input parameters, and then output a result.
Thus, in some embodiments, obtaining a first execution result of an online version of a test task using test data may include steps S501-S504, as shown in FIG. 5. In step S501, if the test task includes a preset type of interface, it may be determined that the interface needs to respond to the input value in the test task. Since the test task may include a plurality of interfaces, the sequence of execution between the interfaces may affect the input value of the interface, for example, the input value of the a interface is a value calculated in the B interface, when the online version executes the test task, the input value of the interface may be determined when the interface is executed.
In step S502, an input parameter matching the input value is searched for from the test data. The test data may include input parameters of a plurality of interfaces and output results corresponding to the input parameters. Therefore, after the input value of the interface of the preset type in the test task is determined, whether the input parameter of the interface is matched with the input value is searched from the test data, and then the output result corresponding to the input parameter matched with the input value is determined as the output value of the interface of the preset type. That is, if the interface of the preset type is executed in online version, the execution result of the interface is the output value.
In step S503, when the online version executes the test task, the calling result of the preset type of interface is simulated according to the output value, and then the first execution result of the test task is obtained. In detail, for a preset type of interface, if the interface is a data deleting interface, the interface is called and a parameter is input for the interface, and then the data corresponding to the parameter is deleted from the online version of data, so that the online version of data is modified. Therefore, after the output value corresponding to the input value is determined from the generated data in the historical data, the calling result of the interface of the preset type can be directly simulated, the data of the online version can be determined not to be modified, and the safety of the data is enhanced; and the problem that the interface of the data writing type cannot be automatically tested can be solved, the automation degree of the test is improved, and the labor is saved.
In step S504, if there are multiple interfaces in the test task and the preset type of interface is called by other interfaces in the test task, the simulated calling result is returned to other interfaces, so that the test task proceeds smoothly to obtain the first execution result.
In addition, when the first result is obtained, a program of a preset type interface can be simulated through the MOCK, then the MOCK interface is executed to replace a real interface, and then the calling result of the interface is obtained.
Because the version to be tested is not on line and is only in the testing stage, the interface can be directly called on the version to be tested when the preset type interface exists in the testing task, the operations of adding, modifying, deleting and the like are carried out on the data of the version to be tested, a second execution result is obtained, the calling result of the interface does not need to be simulated, the operation is reduced, and the regression testing efficiency is improved.
Since most of the test tasks may include a plurality of interfaces to be tested, and there may be a dependency relationship between the interfaces to be tested, the obtaining of the first execution result and the second execution result may further include steps S601 to S602, as shown in fig. 6.
In this exemplary embodiment, in step S601, a first identification number may be determined for a plurality of interfaces to be tested included in the same test task, and a second identification number may be determined for each interface to be tested according to a dependency relationship between each interface to be tested. For example, if there are multiple test tasks, the test tasks may be numbered in sequence, the first identification number of the interface to be tested in the first test task is "1", the first identification number of the interface to be tested in the second test task is "2", and so on; if the first test task comprises 3 interfaces to be tested A, B, C, A depends on B, B depends on C, the execution sequence of A, B, C is C, B, A, and the second identification numbers of A, B, C are 1-3, 1-2, and 1-1, respectively. The first identification number can identify the test task to which the interface to be tested belongs, and the second identification number can identify the dependency relationship of the interface to be tested. In addition, the interfaces to be tested in the test task may also be identified in other manners, for example, each interface to be tested is identified by using symbols and characters.
In step S602, each interface to be tested may be tested on the online version and the version to be tested, and a first execution result and a second execution result of each test task may be determined according to the first identification number and the second identification number. In detail, after the identification number of each interface to be tested is determined, each interface to be tested may be sequentially called according to the dependency relationship of the interface to be tested in each test task and the identification number of each interface to be tested, so as to obtain the calling result of each interface to be tested, and further determine the first execution result and the second execution result of the test task. For example, the identification number of the test task is "1", the test task includes 2 interfaces to be tested, the first identification number is "1", and the output result of the interface to be tested with the second identification number of "1-2" is the first execution result of the test task.
In some embodiments of the present invention, acquiring the first execution result and the second execution result may further include steps S701 to S703, as shown in fig. 7. In step S701, the test data may be inserted into the test case corresponding to the test task. The test data can contain a plurality of test cases, and the test data can be inserted into the test cases according to the attributes of the test data, so that the test cases are executed. Or, the parameters with different attributes in the test data may be predetermined to correspond to different parameters in the test case, and then the corresponding parameters in the test case are replaced according to the attributes of the parameters included in the test data to generate a new test case. In addition, for the interface to be tested of the preset type, a test case corresponding to the type of interface can be generated, the test case can include a mock program corresponding to the type of interface, and then the test data is inserted into the mock program. In step S702, the test case is executed on the online version to obtain a first execution result, and in step S703, the test case is executed on the version to be tested to obtain a second execution result.
As shown in fig. 8, in some embodiments, the present invention may further include steps S801 to S806. In step S801, after the regression test is started, a kit for loading agent. The load toolkit may be initiated by a java command. Then, in step S802, the management side may be started through the http service. The management side may be an application for managing regression testing and may include a plurality of user interfaces at which a tester may input configuration conditions. Then, in step S803, test data may be collected according to the configuration conditions received from the management terminal. The data may include data generated by an online version of the application. The collected test data may be saved in the form of a log record, thereby generating a log file of the log. In step S804, the collected test data is collected by the data collector, and the collected data is uploaded to the message middleware kafka. Then, in step S805, kafka processes the test data, for example, determines input parameters and output parameters corresponding to each interface, determines the type of each interface, and the like. Finally, in step S806, the corresponding data is inserted into the test case according to the analysis result of kafka to obtain a first execution result of the online version and a second execution result of the version to be tested, and the test result of the version to be tested is determined by comparing the two execution results.
As shown in fig. 9, when the online version and the version to be tested obtain the first execution result and the second execution result, steps S901 to S902 may be included. In step S901, after the test data is determined according to the configuration conditions of the management end, the input parameters included in the test data are input into the interface to be tested. In step S902, when the interface to be tested includes a preset type of interface, the input parameter may be input into the mock program corresponding to the preset type of interface, so as to simulate an output result. And for the online version and the version to be tested, the management end can configure whether a mock interface method is needed. And finally, acquiring a final execution result of the test task by using the output result of each interface to be tested.
Embodiments of the apparatus of the present invention are described below, which can be used to perform the regression testing method of the present invention described above. As shown in fig. 10, the regression test apparatus 10 may include: a data acquisition unit 1001 configured to acquire log data of an online version of an application; a test data determining unit 1002, configured to determine, from the log data, test data required by a test task of the application program; the test unit 1003 is configured to obtain a first execution result of the online version of the test task by using the test data, and obtain a second execution result of the test task in the to-be-tested version of the application program; a test result comparing unit 1004, configured to compare the first execution result with the second execution result, and determine a test result of the version to be tested according to the comparison result.
Alternatively, the test data determination unit may include: the interface determining unit is used for determining the type of an interface contained in the test task; and the first data acquisition unit is used for determining input parameters corresponding to the interface of the preset type and an output result matched with the input parameters from the log data when the interface is the interface of the preset type.
Alternatively, the test unit may include: the input determining unit is used for determining an input value to be responded by the interface of the preset type in the test task when the test task comprises the interface of the preset type; the output determining unit is used for inquiring the input parameters matched with the input values from the test data and determining the output results matched with the input parameters as the output values of the interfaces of the preset type; a first result obtaining unit, configured to simulate, according to the output value, a call result of the interface of the preset type when the online version executes the test task, so as to obtain a first execution result of the test task; and the second result acquisition unit is used for returning the calling result to other interfaces when the preset type of interface is called by other interfaces in the test task so as to acquire a first execution result of the test task.
Optionally, in the regression testing apparatus, the test task of the application program may include a plurality of interfaces to be tested, and a dependency relationship may exist between the plurality of interfaces to be tested.
Optionally, the test unit may further include: the case determining unit is used for inserting the test data into the test case corresponding to the test task; a third result obtaining unit, configured to execute the test case on the online version to obtain the first execution result; and the fourth result acquisition unit is used for executing the test case on the version to be tested so as to acquire the second execution result.
Optionally, the test unit may include: the identification unit is used for determining a first identification number for a plurality of interfaces to be tested contained in the same test task and determining a second identification number for the interfaces to be tested according to the dependency relationship; and a fifth result obtaining unit, configured to test the interface to be tested on the online version and the version to be tested, and determine a first execution result and a second execution result of each of the test tasks according to the first identification number and the second identification number.
Optionally, the test result comparing unit may include: a matching unit, configured to compare the first execution result and the second execution result of each of the test tasks; and the determining unit is used for determining that the version to be tested does not pass the test when the first execution result is different from the second execution result.
Optionally, the test data determining unit may include: the application unit is used for acquiring the configuration conditions corresponding to the test tasks from a third-party application through a byte code injection technology; and the data screening unit is used for determining the test data from the log data according to the configuration conditions.
Since each functional module of the regression testing apparatus in the exemplary embodiment of the present invention corresponds to the steps of the exemplary embodiment of the regression testing method, please refer to the above embodiment of the regression testing method of the present invention for details that are not disclosed in the embodiment of the apparatus of the present invention.
Referring now to FIG. 11, shown is a block diagram of a computer system 1100 suitable for use in implementing an electronic device of an embodiment of the present invention. The computer system 1100 of the electronic device shown in fig. 11 is only an example, and should not bring any limitation to the function and the scope of use of the embodiments of the present invention.
As shown in fig. 11, the computer system 1100 includes a Central Processing Unit (CPU)1101, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)1102 or a program loaded from a storage section 1108 into a Random Access Memory (RAM) 1103. In the RAM 1103, various programs and data necessary for system operation are also stored. The CPU 1101, ROM 1102, and RAM 1103 are connected to each other by a bus 1104. An input/output (I/O) interface 1105 is also connected to bus 1104.
The following components are connected to the I/O interface 1105: an input portion 1106 including a keyboard, mouse, and the like; an output portion 1107 including a signal output unit such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 1108 including a hard disk and the like; and a communication section 1109 including a network interface card such as a LAN card, a modem, or the like. The communication section 1109 performs communication processing via a network such as the internet. A driver 1110 is also connected to the I/O interface 1105 as necessary. A removable medium 1111 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 1110 as necessary, so that a computer program read out therefrom is mounted into the storage section 1108 as necessary.
In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the invention include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication portion 1109 and/or installed from the removable medium 1111. The above-described functions defined in the system of the present application are executed when the computer program is executed by a Central Processing Unit (CPU) 1101.
It should be noted that the computer readable medium shown in the present invention can 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 invention, 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 the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, 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: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present invention may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; 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 implement the regression testing method as described in the above embodiments.
For example, the electronic device may implement the following as shown in fig. 1: step S210, collecting log data of an online version of an application program; step S220, determining test data required by the test task of the application program from the log data; step S230, obtaining a first execution result of the online version of the test task by using the test data, and obtaining a second execution result of the test task in the to-be-tested version of the application program; step S240, comparing the first execution result with the second execution result, and determining the test result of the version to be tested according to the comparison result.
As another example, the electronic device may implement the steps shown in fig. 3.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the invention. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiment of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the embodiment of the present invention.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (11)

1. A regression testing method, comprising:
collecting log data of an online version of an application program;
determining test data required by the test task of the application program from the log data;
acquiring a first execution result of the online version of the test task by using the test data, and acquiring a second execution result of the test task in the to-be-tested version of the application program;
and comparing the first execution result with the second execution result, and determining the test result of the version to be tested according to the comparison result.
2. The regression testing method of claim 1, wherein said determining test data required for testing tasks of said application from said log data comprises:
determining the type of an interface contained in the test task;
and if the interface is the interface of the preset type, determining the input parameters corresponding to the interface of the preset type and the output result matched with the input parameters from the log data.
3. The regression testing method of claim 2, wherein said using said test data to obtain a first execution result of said online version of said test task comprises:
when the test task comprises the interface of the preset type, determining an input value of the interface response of the preset type in the test task;
inquiring input parameters matched with the input values from the test data, and determining output results matched with the input parameters as output values of the preset type of interface;
simulating a calling result of the interface of the preset type according to the output value when the online version executes the test task so as to obtain a first execution result of the test task;
and when the interface of the preset type is called by other interfaces in the test task, returning the calling result to the other interfaces so as to obtain a first execution result of the test task.
4. The regression testing method according to claim 1, wherein a testing task of the application program includes a plurality of interfaces to be tested, and a dependency relationship exists between the plurality of interfaces to be tested.
5. The regression testing method of claim 1, wherein said obtaining a first execution result of the online version of the test task using the test data and obtaining a second execution result of the test task on the version of the application under test comprises:
inserting the test data into a test case corresponding to the test task;
executing the test case on the online version to obtain the first execution result;
and executing the test case on the version to be tested to obtain the second execution result.
6. The regression testing method of claim 4, wherein said obtaining a first execution result of the online version of the test task using the test data and obtaining a second execution result of the test task on the version of the application under test comprises:
determining a first identification number for a plurality of interfaces to be tested contained in the same test task, and determining a second identification number for the interfaces to be tested according to the dependency relationship;
and testing the interface to be tested on the online version and the version to be tested respectively, and determining a first execution result and a second execution result of each test task according to the first identification number and the second identification number.
7. The regression testing method of claim 1, wherein comparing the first execution result with the second execution result and determining the testing result of the version to be tested according to the comparison result comprises:
comparing the first execution result and the second execution result of each test task;
and when the first execution result is different from the second execution result, determining that the version to be tested does not pass the test.
8. The regression testing method of claim 1, wherein said determining test data required for testing tasks of said application from said log data comprises:
acquiring configuration conditions corresponding to the test tasks from a third-party application through a byte code injection technology;
and determining the test data from the log data according to the configuration conditions.
9. A regression testing apparatus, comprising:
the data acquisition unit is used for acquiring log data of an online version of the application program;
the test data determining unit is used for determining test data required by the test task of the application program from the log data;
the test unit is used for acquiring a first execution result of the online version of the test task by using the test data and acquiring a second execution result of the test task in the to-be-tested version of the application program;
and the test result comparison unit is used for comparing the first execution result with the second execution result and determining the test result of the version to be tested according to the comparison result.
10. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the regression testing method according to any one of claims 1 to 8.
11. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the regression testing method of any one of claims 1 to 8.
CN201910176662.7A 2019-03-08 2019-03-08 Regression testing method, device, medium and electronic equipment Pending CN111666201A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910176662.7A CN111666201A (en) 2019-03-08 2019-03-08 Regression testing method, device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910176662.7A CN111666201A (en) 2019-03-08 2019-03-08 Regression testing method, device, medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN111666201A true CN111666201A (en) 2020-09-15

Family

ID=72382407

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910176662.7A Pending CN111666201A (en) 2019-03-08 2019-03-08 Regression testing method, device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111666201A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112965910A (en) * 2021-03-19 2021-06-15 携程旅游信息技术(上海)有限公司 Automatic regression testing method and device, electronic equipment and storage medium
CN113760722A (en) * 2021-01-13 2021-12-07 北京京东振世信息技术有限公司 Test system and test method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113760722A (en) * 2021-01-13 2021-12-07 北京京东振世信息技术有限公司 Test system and test method
CN112965910A (en) * 2021-03-19 2021-06-15 携程旅游信息技术(上海)有限公司 Automatic regression testing method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108415832B (en) Interface automation test method, device, equipment and storage medium
CN109062780B (en) Development method of automatic test case and terminal equipment
CN107608901B (en) Jmeter-based testing method and device, storage medium and electronic equipment
CN103530292A (en) Webpage displaying method and device
CN111522728A (en) Method for generating automatic test case, electronic device and readable storage medium
CN110858172A (en) Automatic test code generation method and device
CN111045653A (en) System generation method and device, computer readable medium and electronic equipment
CN110598135A (en) Network request processing method and device, computer readable medium and electronic equipment
CN111324510B (en) Log processing method and device and electronic equipment
CN111563257A (en) Data detection method and device, computer readable medium and terminal equipment
CN111666201A (en) Regression testing method, device, medium and electronic equipment
CN107368407B (en) Information processing method and device
CN114116505A (en) Code testing method and device
CN113836014A (en) Interface testing method and device, electronic equipment and storage medium
CN112035092A (en) Form processing method, device, equipment and readable medium
CN116483888A (en) Program evaluation method and device, electronic equipment and computer readable storage medium
CN110716859A (en) Method for automatically pushing test cases for modified codes and related device
CN110716866A (en) Code quality scanning method and device, computer equipment and storage medium
CN111400623B (en) Method and device for searching information
CN113377648A (en) Software system diagnosis method and device, electronic equipment and computer readable medium
CN112579428A (en) Interface testing method and device, electronic equipment and storage medium
CN109697141B (en) Method and device for visual testing
CN112286802A (en) Method and device for testing program performance and electronic equipment
CN111694729A (en) Application testing method and device, electronic equipment and computer readable medium
CN112860538A (en) Method and device for performing interface regression test based on online log

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