CN115080433A - Testing method and device based on flow playback - Google Patents

Testing method and device based on flow playback Download PDF

Info

Publication number
CN115080433A
CN115080433A CN202210744811.7A CN202210744811A CN115080433A CN 115080433 A CN115080433 A CN 115080433A CN 202210744811 A CN202210744811 A CN 202210744811A CN 115080433 A CN115080433 A CN 115080433A
Authority
CN
China
Prior art keywords
test
transaction
playback
data
production
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
CN202210744811.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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210744811.7A priority Critical patent/CN115080433A/en
Publication of CN115080433A publication Critical patent/CN115080433A/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/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • 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/3696Methods or tools to render software testable

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 disclosure provides a test method based on flow playback, which can be applied to the technical field of finance. The method comprises the following steps: recording production flow, wherein the production flow is production transaction information of a host flow branch in a production environment; performing data desensitization processing on the production transaction information to generate test data; performing a data adaptation operation on the test data to generate target input data, wherein the data adaptation operation is configured to adjust a production date and a transaction serial number of the test data to adapt a transaction playback scenario; performing transaction playback on the target input data in a test environment according to a test scene to output transaction return information, wherein the test scene comprises a switch test, a function test and a performance test; and comparing the transaction return information according to the assertion configuration to determine a test result. The present disclosure also provides a test apparatus, a device, a storage medium, and a program product based on the flow playback.

Description

Testing method and device based on flow playback
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to the field of automated testing technologies, and more particularly, to a testing method, apparatus, device, storage medium, and program product based on flow playback.
Background
Financial business scenes are very complex, general business tests are difficult to cover all possible scene branches, particularly in the process of migrating functions of a program from a host to an open platform, the functions before and after migration are required to be consistent, due to the diversity of production data, the existing test method is difficult to cover all the functions, few side leakage sides are easy to occur, and therefore actual production is affected.
It is noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure and therefore may include information that does not constitute prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
In view of the foregoing, the present disclosure provides a flow playback based testing method, apparatus, device, medium, and program product that improves test coverage.
According to a first aspect of the present disclosure, there is provided a test method based on traffic playback, including:
recording production flow, wherein the production flow is production transaction information of a host flow branch in a production environment;
performing data desensitization processing on the production transaction information to generate test data;
performing a data adaptation operation on the test data to generate target input data, wherein the data adaptation operation is configured to adjust a production date and a transaction serial number of the test data to adapt a transaction playback scenario;
performing transaction playback on the target input data in a test environment according to a test scene to output transaction return information, wherein the test scene comprises a switch test, a function test and a performance test; and
and comparing the transaction return information according to assertion configuration to determine a test result.
According to an embodiment of the present disclosure, the performing transaction playback on the target input data in a test environment according to a test scenario to output transaction return information includes:
when the test scene is determined to be a switch test, respectively carrying out at least one full transaction playback on the host flow branch and the open platform circulation branch of the target input data under the test environment so as to output at least one group of transaction return information;
when the test scene is determined to be a functional test, respectively carrying out at least one single transaction playback on the host flow branch and the open platform circulation branch of the target input data under the test environment so as to output at least one group of transaction return information; and
and when the test scene is determined to be a performance test, verifying the performance bearing capacity of the test environment according to the playback rate of the adjustment transaction playback.
According to an embodiment of the present disclosure, the comparing the transaction return information according to the assertion configuration to determine the test result includes:
determining a field to be compared and a comparison mode corresponding to the field to be compared according to assertion configuration, wherein the comparison mode comprises full character string comparison, front and back space removal comparison, converted number comparison and converted number dictionary comparison;
and comparing the fields of the transaction return information according to the comparison mode to determine a test result.
According to an embodiment of the present disclosure, verifying the performance-bearing capabilities of the test environment according to a playback rate that regulates playback of transactions includes:
the playback rate is set by adjusting thread count and/or thread latency and/or cycle count parameters to verify the performance-bearing capabilities of the test environment.
According to an embodiment of the present disclosure, the performing data desensitization processing on the production transaction information to generate test data includes:
identifying a sensitive information field in the production transaction information according to the flow audit component and/or the sensitive field configuration information; and
and completing deformation of the sensitive information field according to a preset desensitization rule to generate test data.
According to the embodiment of the present disclosure, after determining the test result, the method further includes:
determining a target test case according to the field comparison result; and
and generating a target test case set according to the target test cases.
A second aspect of the present disclosure provides a test apparatus based on traffic playback, including: the flow recording module is used for recording production flow, and the production flow is production transaction information of a host flow branch in a production environment;
the data desensitization module is used for carrying out data desensitization processing on the production transaction information to generate test data;
a data adaptation module, configured to perform a data adaptation operation on the test data to generate target input data, wherein the data adaptation operation is configured to adjust a production date and a transaction serial number of the test data to adapt a transaction playback scenario;
the transaction playback module is used for performing transaction playback on the target input data in a test environment according to a test scene to output transaction return information, wherein the test scene comprises a switch test, a function test and a performance test; and
and the test comparison module is used for comparing the transaction return information according to the assertion configuration so as to determine a test result.
According to an embodiment of the present disclosure, a transaction playback module includes:
the switch testing module is used for respectively carrying out at least one full transaction playback on the host flow branch and the open platform circulation branch of the target input data under the testing environment when the testing scene is determined to be a switch test so as to output at least one group of transaction return information;
the function test module is used for respectively carrying out at least one single transaction playback on the host flow branch and the open platform circulation branch of the target input data under the test environment when the test scene is determined to be a function test so as to output at least one group of transaction return information;
and the performance testing module is used for verifying the performance bearing capacity of the testing environment according to the playback rate of the regulated transaction playback when the testing scene is determined to be the performance test.
According to an embodiment of the present disclosure, the test alignment module includes:
the determining submodule is used for determining a field to be compared and a comparison mode corresponding to the field to be compared according to assertion configuration, wherein the comparison mode comprises full character string comparison, front and back space removal comparison, converted number comparison and converted number dictionary comparison;
and the comparison submodule is used for carrying out field comparison on the transaction return information according to the comparison mode so as to determine a test result.
According to an embodiment of the disclosure, the performance testing sub-module includes:
and the playback rate adjusting unit is used for setting the playback rate by adjusting the thread number and/or the thread waiting time and/or the loop number parameters so as to verify the performance bearing capacity of the test environment.
According to an embodiment of the present disclosure, a data desensitization module includes:
the sensitive information identification submodule is used for identifying a sensitive information field in the production transaction information according to the flow audit component and/or the sensitive field configuration information; and
and the generating submodule is used for completing deformation of the sensitive information field according to a preset desensitization rule so as to generate test data.
According to an embodiment of the present disclosure, the apparatus further comprises:
the test case determining module is used for determining a target test case according to the field comparison result;
and the test case set generating module is used for generating a target test case set according to the target test cases.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the above-described traffic playback based testing method.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-mentioned traffic playback-based testing method.
A fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the above-described flow playback based testing method.
According to the flow playback-based test method provided by the embodiment of the disclosure, production flow under a production environment is recorded, desensitization data adaptation and other processing are carried out on production transaction information, target input data are generated, transaction playback is carried out on the target input data under the test environment according to a test scene, and a transaction return result is compared according to assertion configuration. Compared with the prior art, the test method based on flow playback of the embodiment of the disclosure carries out transaction playback based on actual production transaction data, so that the test coverage is more comprehensive, and the full coverage of service functions is realized; and a test script does not need to be compiled for a single transaction, so that the test efficiency is improved.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be apparent from the following description of embodiments of the disclosure, which proceeds with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an application scenario diagram of a method, apparatus, device, medium and program product for traffic playback based testing in accordance with an embodiment of the present disclosure;
FIG. 2 schematically illustrates an architecture diagram of a test device based on flow playback in accordance with an embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow diagram of a method of testing based on traffic playback in accordance with an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart of a method of data desensitization according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates a flow diagram for transaction playback based on a test scenario according to an embodiment of the disclosure;
FIG. 6 schematically illustrates a flow diagram of a method of conducting a comparison test based on an assertion configuration, in accordance with an embodiment of the disclosure;
fig. 7a schematically illustrates a schematic diagram of a test case set generation method provided according to an embodiment of the present disclosure;
FIG. 7b is a flow diagram of transaction playback provided in accordance with an embodiment of the present disclosure;
FIG. 8 is a block diagram schematically illustrating a structure of a test apparatus based on traffic playback according to an embodiment of the present disclosure; and
fig. 9 schematically shows a block diagram of an electronic device adapted to implement a traffic playback based testing method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
The terms appearing in the present disclosure are explained first:
the host computer: the IBM mainframe computer, such as system/360, is an organic whole of hardware and dedicated software, and this closed system brings high reliability and security, and makes it difficult for general practitioners to enter this field, and the common programming languages in the industry are EGL and COBOL, and the common DB2 in database.
An open platform: the platform mode is open in technology, and software systems can mutually realize functions of the software systems by using an open application programming interface. The common programming language in the industry is JAVA, and the common database is MYSQL and the like.
Function migration: at present, in the IOE project removing process of banks, the functions of an original host (IBM mainframe) are migrated to an open platform for realization.
An embodiment of the present disclosure provides a test script generation method, including: recording production flow, wherein the production flow is production transaction information of a host flow branch in a production environment; performing data desensitization processing on the production transaction information to generate test data; performing a data adaptation operation on the test data to generate target input data, wherein the data adaptation operation is configured to adjust a production date and a transaction serial number of the test data to adapt a transaction playback scenario; performing transaction playback on the target input data in a test environment according to a test scene to output transaction return information, wherein the test scene comprises a switch test, a function test and a performance test; and comparing the transaction return information according to the assertion configuration to determine a test result.
Fig. 1 schematically illustrates an application scenario diagram of a test method, apparatus, device, medium, and program product based on traffic playback according to an embodiment of the present disclosure. Fig. 2 schematically shows an architecture diagram of a test device based on flow playback according to an embodiment of the present disclosure.
As shown in fig. 1, an application scenario 100 according to this embodiment may include a test scenario of transaction traffic playback. 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 tester may use the terminal devices 101, 102, 103 to interact with the server 105 over the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have installed thereon various communication client applications, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
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 test server, and performs a test for a test instruction sent by a tester, for example, in response to a test instruction sent by the tester using the terminal devices 101, 102, and 103, the test server may analyze and process the recorded production flow, perform transaction playback in a test environment, and automatically complete a comparison test.
It should be noted that the test method based on traffic playback provided by the embodiment of the present disclosure may be generally executed by the server 105. Accordingly, the test device based on the flow playback provided by the embodiment of the present disclosure may be generally disposed in the server 105. The test method based on traffic playback provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the test device based on the traffic playback provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
As shown in fig. 2, the testing apparatus provided in the embodiment of the present disclosure includes a flow recording apparatus, a data analyzing apparatus, and a flow playback apparatus, where the flow recording apparatus records a production flow. The Java program flow can be recorded by adopting a mechanism provided by JVM (Java agent) and the like and adopting a bytecode enhancement technology; SDK support can be provided in a development framework, and flow recording is completed by utilizing a basic framework layer; the data analysis device: and identifying the sensitive information of the recorded production transaction information, desensitizing the sensitive information field by a desensitizing tool, and then persisting and synchronizing the desensitized application transaction data to a test environment. A flow playback device: and (4) completing the transaction flow playback in the test environment after the production transaction data passes through automatic data adaptation. Wherein the data analysis device comprises a data desensitization module and a persistence module, wherein the data desensitization module is: sensitive information fields (such as customer names, identity cards, account numbers, mobile phone numbers and the like) are automatically identified by introducing flow audit products, manual identification and configuration of the sensitive information fields are supported, and automatic deformation desensitization is completed for the sensitive information fields. A persistence module: and (3) persisting the desensitized transaction application transaction data and storing the desensitized transaction application transaction data in a production database, and then synchronizing the recorded desensitized transaction data from production to a test environment in a mirror image synchronization or file copying mode.
The flow playback device comprises a data adaptation module, an assertion configuration module, a transaction playback module and a comparison verification module. A data adaptation module: and automatically modifying adaptive transaction data information, and if the original static data is replaced by a variable mode of using work _ date and event _ no for the transaction sequence number, automatically generating the current work date and the transaction sequence number during transaction playback, so as to avoid data errors of the transaction during playback. An assertion configuration module: and automatically configuring whether the fields are compared or not, supporting automatic analysis, and if the fields which return the same sample value for a plurality of times of playback are automatically configured to be compared, and manually configuring whether the corresponding fields are compared or not. A transaction playback module: and reinitiating the transaction request in the test environment by using the Input request information of the production transaction data after desensitization and adaptation, and recording the transaction Ouput return information of the test environment. A comparison verification module: and comparing and asserting Output return information after the transaction of the test environment to judge whether the program of the test environment is correct.
It should be noted that the test script generation method and apparatus determined in the embodiments of the present disclosure may be applied to the field of automation test in the financial field, and may also be applied to any field other than the financial field.
The following describes in detail a test method based on flow playback according to an embodiment of the present disclosure with reference to fig. 3 to 7b, based on the scenario described in fig. 1 and the structural diagram described in fig. 2.
Fig. 3 schematically shows a flow chart of a test method based on traffic playback according to an embodiment of the present disclosure. As shown in fig. 3, the testing method based on traffic playback of the embodiment includes operations S210 to S250, and the method may be executed by a server or other computing device.
In operation S210, the production flow is recorded.
According to an embodiment of the present disclosure, the production flow is production transaction information of a host flow branch in a production environment.
In one example, production traffic is recorded using bytecode enhancements or framework SDKs. Because the production transaction is complicated to call, in order to improve the efficiency, the on-off control can be carried out, and generally only the flow of a channel initiating end needs to be recorded, namely only the input and the output of the call of the application transaction service initiated by a customer at a mobile phone bank, an internet bank or a network counter need to be recorded, and the call of the application component service does not need to be recorded. The production flow is the production transaction information of the host flow branch in the production environment.
In operation S220, a data desensitization process is performed on the production transaction information to generate test data.
In an example, desensitization processing needs to be performed on the production transaction information recorded in operation S210, and sensitive information in the production transaction information, such as a customer name, an identity card number, and the like, is subjected to deformation processing to generate test data, and a specific data desensitization process may refer to operations S221 to S222 described in fig. 4, which is not described herein again.
In operation S230, a data adaptation operation is performed on the test data to generate target input data.
According to an embodiment of the disclosure, the data adaptation operation is configured to adjust a production date and a transaction serial number of the test data to adapt a transaction playback scenario.
In one example, because the transaction sequence number or the work date in the production flow is different from the transaction playback date or the transaction sequence number, in order to avoid that part of field data of the transaction cannot directly adopt recorded data (such as different recording and playback dates and different transaction sequence numbers), the transaction data information needs to be automatically modified and adapted, such as a work date word _ date field, a mode of replacing an originally recorded static date with a variable { word _ date } and a mode of replacing an originally recorded static transaction sequence number with a variable { event _ no } for a transaction sequence number event _ no field. When the transaction is actually played back, whether the field value is a variable or not is judged, if the field value is the variable, the field value is automatically replaced by the actual value of the current environment, for example, { work _ date } automatically generates the current working date, and { event _ no } automatically generates the current transaction serial number +1, so that the data of the transaction is correct during playback.
In operation S240, the target input data is transacted and played back in a test environment according to the test scenario to output transaction return information.
According to an embodiment of the present disclosure, the test scenario includes a switch test, a function test, and a performance test.
In one example, different transaction playback operations are performed based on different test scenarios, i.e., test requirements, where the test scenarios include a switch test, a function test, and a performance test, specifically, a transaction request is reinitiated in a test environment using Input request information of desensitized and adapted production transaction data, and transaction ouut return information of the test environment is recorded. During playback, a full number of cases can be selected, and a required case can be selected in a self-defined manner; during playback, the playback rate can be set through parameters such as thread number, waiting time, cycle number and the like, so that the performance test can be initiated adaptively. See operations S241 to S243 shown in fig. 5, which are not described herein again.
In operation S250, the transaction return information is compared according to the assertion configuration to determine a test result.
In an example, the assertion configuration in the embodiment of the present disclosure supports automatic configuration for field comparison and automatic analysis, and if a field that returns the same sample value for multiple playback is automatically configured to be compared, also supports manual configuration for field comparison, and performs field-level comparison on transaction return information according to the assertion configuration, where a specific process may refer to operation S251 to operation S252 shown in fig. 6, and details are not described here.
According to the flow playback-based test method provided by the embodiment of the disclosure, production flow under a production environment is recorded, desensitization data adaptation and other processing are carried out on production transaction information, target input data are generated, transaction playback is carried out on the target input data under the test environment according to a test scene, and a transaction return result is compared according to assertion configuration. Compared with the prior art, the test method based on flow playback of the embodiment of the disclosure carries out transaction playback based on actual production transaction data, so that the test coverage is more comprehensive, and the full coverage of service functions is realized; and a test script does not need to be compiled for a single transaction, so that the test efficiency is improved.
Fig. 4 schematically illustrates a flow chart of a method of data desensitization according to an embodiment of the present disclosure. As shown in FIG. 4, operation S220 includes operations S221 through S222
In operation S221, sensitive information fields in the production transaction information are identified according to the traffic audit component and/or the sensitive field configuration information.
In operation S222, the sensitive information field is deformed according to a preset desensitization rule to generate test data.
In one example, sensitive information fields (such as customer names, identity cards, account numbers, mobile phone numbers and the like) are automatically identified by introducing a flow audit product component, and special transaction information fields can also be manually configured into the sensitive fields, so that the contents of the sensitive information fields are automatically deformed according to a uniform desensitization rule, and desensitization is completed. Note that this desensitization rule needs to be consistent with the rules of existing test environment inventory data.
FIG. 5 schematically shows a flow diagram for transaction playback based on a test scenario according to an embodiment of the disclosure. As shown in fig. 5, operation S240 includes operations S241 to S243.
In operation S241, when it is determined that the test scenario is a switch test, the host flow branch and the open platform circulation branch of the target input data in the test environment are respectively subjected to at least one full transaction playback to output at least one set of transaction return information.
In operation S242, when it is determined that the test scenario is a functional test, the host flow branch and the open platform circulation branch of the target input data in the test environment are respectively subjected to at least one single transaction playback to output at least one set of transaction return information.
In operation S243, when the test scenario is determined to be a performance test, the performance tolerance of the test environment is verified according to the playback rate of the adjusted transaction playback.
According to the embodiment of the disclosure, the playback rate is set by adjusting the thread number and/or the thread waiting time and/or the loop number parameters to verify the performance bearing capacity of the test environment.
In one example, in the disclosed embodiment, the following test scenarios are divided:
(1) and (3) switch testing: in a test environment, performing large-batch centralized transaction playback aiming at different transaction branches, for example, firstly performing branch playback of full transaction in a host process, then performing playback of full transaction in a platform process, recording transaction return information of different branches, then performing field-level comparison on the return information of two branches according to assertion configuration, and judging whether the return fields of the two branches are the same, thereby judging whether a platform program is consistent with the functions of the host program.
(2) And (4) functional test: unlike full transaction playback for switch testing, functional testing supports the playback of a single execution stroke, verifying whether a program function in a test environment is abnormal.
(3) And (3) performance testing: by adjusting the playback rate of the transaction playback module, rapid playback of large-batch transaction data can be achieved, and the performance bearing capacity of the test environment is verified. The playback rate can be specifically controlled by adjusting the thread number and/or the thread waiting time and/or the cycle number parameter, the playback rate is faster when the number of parallel threads is larger, the playback rate is slower when the thread waiting time is longer, and the cycle number refers to the transaction playback number.
FIG. 6 schematically illustrates a flow chart of a method of conducting a comparison test based on an assertion configuration according to an embodiment of the disclosure. As shown in fig. 6, operation S250 includes operations S251 to S252.
In operation S251, the field to be compared and the comparison method corresponding to the field to be compared are determined according to the assertion configuration.
According to the embodiment of the disclosure, the comparison mode comprises full string comparison, front and back space removal comparison, converted number comparison and converted number dictionary comparison.
In operation S252, the field comparison is performed on the transaction return information according to the comparison manner to determine a test result.
In one example, the disclosed embodiments support automatically configuring whether to compare fields, e.g., by multiple playbacks during data debugging, automatically configuring to require comparison if fields with the same sample value are returned each time, and manually configuring whether to compare corresponding fields. For the field which is different from the host and the open platform and needs to be compared by special processing, the following comparison method can be configured:
(1) and comparing the full strings. The alignment method is default. The complete string comparison is performed on the fields of the host and the platform, and the length of the string, the content of the string and the like are required to be completely consistent.
(2) And removing the blank space before and after the comparison. The applicable scenes are as follows: the host returns data without blank space, but the data of the number of bits is complemented in a mode of pre-zero padding or post-zero padding in the open platform.
(3) Conversion to digital contrast. The applicable scenes are as follows: both the host and the open platform return strings containing pure numbers (e.g., amounts), but there may be pre-zero padding, so both may be converted to numbers for comparison.
(4) The digital dictionary comparisons are converted. The applicable scenes are as follows: the host and the open platform return enumerated values, but there may be a difference in the enumerated meanings of the two, for example, if the host considers that return 0 is successful and the open platform considers that return 1 is successful, then the corresponding actual values of the data dictionary can be used for comparison.
And analyzing the reason of playback failure by testing the returned field difference according to the character level comparison of the fields of the host and the platform. The position and the reason of the program problem in the test process can be quickly positioned.
Fig. 7a is a schematic diagram schematically illustrating a test case set generation method provided according to an embodiment of the present disclosure, and fig. 7b is a flowchart of transaction playback provided according to an embodiment of the present disclosure. As shown in fig. 7a, after the test result is obtained, operation 310 and operation 320 are also included.
In operation S310, a target test case is determined according to the field comparison result.
In operation S320, a target test case set is generated according to the target test cases.
In one example, in the comparison test process, transaction data which can be completely successfully compared is automatically recorded as a success case, transaction data which completely fails to be compared is automatically recorded as a failure case, the other cases are allowed cases, and through multiple rounds of tests, automatic screening is performed, so that a success case set is accumulated and used for the complete automatic test case, and the success case set can be directly used for daemon of program modification of the open platform, namely on the premise of taking the host process as the standard, if the daemon case fails to operate, the problem of program modification of the open platform can be judged, and further analysis and solution are needed.
Referring to fig. 7b, the overall transaction playback process in the embodiment of the present disclosure is described, as shown in fig. 7b, when performing automatic playback, a person initiating a test only needs to log in a playback tool page with a browser such as IE, select transaction data to be played back in a full or custom manner, and click to submit the transaction data, so that a test transaction request can be forwarded to a corresponding application service in the background, and an actual program to be tested can be scheduled. After the test transaction is completed, the returned information and the comparison information are recorded in a database of the test platform, and a tester can select to check the test assertion result of the playback through a browser such as an IE, for example, the same service method, different transaction data, and the detailed result of the two branch checks of the host (the output message) and the open platform (the output message) are compared, so that the playback execution is found to be successful, but the output messages are different. The reason for playback failure can be analyzed by looking up the failed transaction and the corresponding specific field failed in comparison and by testing the returned field differences.
Based on the test method based on flow playback, the disclosure also provides a test device based on flow playback. This system will be described in detail below in conjunction with fig. 8.
Fig. 8 schematically shows a block diagram of a test apparatus based on traffic playback according to an embodiment of the present disclosure.
As shown in fig. 8, the test apparatus 800 based on the flow playback of the embodiment includes; a flow recording module 810, a data desensitization module 820, a data adaptation module 830, a transaction playback module 840, and a test comparison module 850.
The flow recording module 810 is used for recording production flow, which is production transaction information of a host flow branch in a production environment. In an embodiment, the traffic recording module 810 may be configured to perform the operation S210 described above, which is not described herein again.
The data desensitization module 820 is configured to perform data desensitization processing on the production transaction information to generate test data. In an embodiment, the data desensitization module 820 may be configured to perform the operation S220 described above, which is not described herein again.
The data adaptation module 830 is configured to perform a data adaptation operation on the test data to generate target input data, wherein the data adaptation operation is configured to adjust a production date and a transaction serial number of the test data to adapt a transaction playback scenario. In an embodiment, the data adaptation module 840 may be configured to perform the operation S240 described above, which is not described herein again.
The transaction playback module 840 is configured to perform transaction playback on the target input data in a test environment according to a test scenario, where the test scenario includes a switch test, a function test, and a performance test, so as to output transaction return information. In an embodiment, the transaction playback module 840 may be configured to perform the operation S240 described above, which is not described herein again.
The test comparison module 850 is used for comparing the transaction return information according to the assertion configuration to determine a test result. In an embodiment, the test alignment module 850 may be configured to perform the operation S250 described above, which is not described herein again.
According to an embodiment of the present disclosure, the transaction playback module 840 includes: the device comprises a switch test module, a function test module and a performance test module.
And the switch test module is used for respectively carrying out at least one full transaction playback on the host flow branch and the open platform circulation branch of the target input data under the test environment when the test scene is determined to be a switch test so as to output at least one group of transaction return information. In an embodiment, the switch test module may be configured to perform the operation S241 described above, which is not described herein again.
And the functional test module is used for respectively carrying out at least one single transaction playback on the host flow branch and the open platform circulation branch of the target input data under the test environment when the test scene is determined to be a functional test so as to output at least one group of transaction return information. In an embodiment, the functional test module may be configured to perform the operation S242 described above, which is not described herein again.
And the performance testing module is used for verifying the performance bearing capacity of the testing environment according to the playback rate of the regulated transaction playback when the testing scene is determined to be a performance test. In an embodiment, the performance testing module 843 may be configured to perform the operation S243 described above, which is not described herein again.
According to an embodiment of the present disclosure, the test alignment module 850 includes: a determination submodule and an alignment submodule.
The determining submodule is used for determining a field to be compared and a comparison mode corresponding to the field to be compared according to assertion configuration, wherein the comparison mode comprises full character string comparison, front and back space removal comparison, converted number comparison and converted number dictionary comparison. In an embodiment, the determining submodule may be configured to perform the operation S251 described above, which is not described herein again.
And the comparison submodule is used for comparing the fields of the transaction return information according to the comparison mode so as to determine a test result. In an embodiment, the pair sub-module may be used to perform the operation S252 described above, and is not described herein again.
According to an embodiment of the disclosure, the performance testing sub-module includes: a playback rate adjustment unit.
The playback rate adjusting unit is used for setting the playback rate by adjusting the thread number and/or the thread waiting time and/or the loop number parameters so as to verify the performance bearing capacity of the test environment. In an embodiment, the playback rate adjusting unit may be configured to perform operation S243 described above, which is not described herein again.
According to an embodiment of the present disclosure, a data desensitization module includes: the sensitive information identification submodule and the generation submodule.
And the sensitive information identification submodule is used for identifying the sensitive information field in the production transaction information according to the flow audit component and/or the sensitive field configuration information. In an embodiment, the sensitive information identification submodule may be configured to perform operation S221 described above, which is not described herein again. And
and the generating submodule is used for completing deformation of the sensitive information field according to a preset desensitization rule so as to generate test data. In an embodiment, the generating submodule may be configured to perform the operation S222 described above, and is not described herein again.
According to an embodiment of the present disclosure, the apparatus further comprises: the test case generation module is used for generating a test case set.
The test case determining module is used for determining a target test case according to the field comparison result. In an embodiment, the test case determining module may be configured to perform the operation S310 described above, which is not described herein again.
The test case set generating module is used for generating a target test case set according to the target test cases. In an embodiment, the test case set generating module may be configured to perform the operation S320 described above, which is not described herein again.
According to the embodiment of the present disclosure, any plurality of the flow recording module 810, the data desensitization module 820, the data adaptation module 830, the transaction playback module 840 and the test comparison module 850 may be combined into one module to be implemented, or any one of them may be split into a plurality of modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the flow recording module 810, the data desensitization module 820, the data adaptation module 830, the transaction playback 840, and the test comparison module 850 may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or in hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or in any one of three implementations, or in any suitable combination of any of the three. Alternatively, at least one of the flow recording module 810, the data desensitization module 820, the data adaptation module 830, the transaction playback module 840, and the test comparison module 850 may be at least partially implemented as a computer program module that, when executed, may perform corresponding functions.
Fig. 9 schematically shows a block diagram of an electronic device adapted to implement a traffic playback based testing method according to an embodiment of the present disclosure.
As shown in fig. 9, an electronic apparatus 900 according to an embodiment of the present disclosure includes a processor 901 which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)902 or a program loaded from a storage portion 908 into a Random Access Memory (RAM) 903. Processor 901 may comprise, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 901 may also include on-board memory for caching purposes. The processor 901 may comprise a single processing unit or a plurality of processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 903, various programs and data necessary for the operation of the electronic apparatus 900 are stored. The processor 901, the ROM 902, and the RAM 903 are connected to each other through a bus 904. The processor 901 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 902 and/or the RAM 903. Note that the programs may also be stored in one or more memories other than the ROM 902 and the RAM 903. The processor 901 may also perform various operations of the method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 900 may also include input/output (I/O) interface 905, input/output (I/O) interface 905 also connected to bus 904, according to an embodiment of the present disclosure. The electronic device 900 may also include one or more of the following components connected to the I/O interface 905: an input portion 906 including a keyboard, a mouse, and the like; an output section 907 including components such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 908 including a hard disk and the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 910 is also connected to the I/O interface 905 as necessary. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 910 as necessary, so that a computer program read out therefrom is mounted into the storage section 908 as necessary.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer readable storage medium carries one or more programs which, when executed, implement a method for testing based on traffic playback according to an embodiment of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 902 and/or the RAM 903 described above and/or one or more memories other than the ROM 902 and the RAM 903.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method illustrated in the flow chart. When the computer program product runs in a computer system, the program code is used for causing the computer system to realize the test method based on flow playback provided by the embodiment of the disclosure.
The computer program performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure when executed by the processor 901. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed in the form of a signal on a network medium, and downloaded and installed through the communication section 909 and/or installed from the removable medium 911. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 909, and/or installed from the removable medium 911. The computer program, when executed by the processor 901, performs the above-described functions defined in the system of the embodiment of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (10)

1. A test method based on flow playback is characterized in that the test method comprises the following steps:
recording production flow, wherein the production flow is production transaction information of a host flow branch in a production environment;
performing data desensitization processing on the production transaction information to generate test data;
performing a data adaptation operation on the test data to generate target input data, wherein the data adaptation operation is configured to adjust a production date and a transaction serial number of the test data to adapt a transaction playback scenario;
performing transaction playback on the target input data in a test environment according to a test scene to output transaction return information, wherein the test scene comprises a switch test, a function test and a performance test; and
and comparing the transaction return information according to the assertion configuration to determine a test result.
2. The testing method of claim 1, wherein the transacting playback of the target input data in the testing environment according to the testing scenario to output transaction return information comprises:
when the test scene is determined to be a switch test, respectively carrying out at least one full transaction playback on the host flow branch and the open platform circulation branch of the target input data under the test environment so as to output at least one group of transaction return information;
when the test scene is determined to be a functional test, respectively carrying out at least one single transaction playback on the host flow branch and the open platform circulation branch of the target input data under the test environment so as to output at least one group of transaction return information; and
and when the test scene is determined to be a performance test, verifying the performance bearing capacity of the test environment according to the playback rate of the adjustment transaction playback.
3. The testing method of claim 1, wherein the comparing the transaction return information according to the assertion configuration to determine a test result comprises:
determining a field to be compared and a comparison mode corresponding to the field to be compared according to assertion configuration, wherein the comparison mode comprises full character string comparison, front and back space removal comparison, converted number comparison and converted number dictionary comparison;
and comparing the fields of the transaction return information according to the comparison mode to determine a test result.
4. The testing method of claim 2, wherein verifying performance-bearing capabilities of the testing environment based on the playback rate at which transaction playback is adjusted comprises:
the playback rate is set by adjusting thread count and/or thread latency and/or cycle count parameters to verify the performance-bearing capabilities of the test environment.
5. The testing method of claim 1, wherein the performing data desensitization processing on the production transaction information to generate test data comprises:
identifying a sensitive information field in the production transaction information according to the flow audit component and/or the sensitive field configuration information; and
and completing deformation of the sensitive information field according to a preset desensitization rule to generate test data.
6. The test method according to any one of claims 1 to 5, further comprising, after determining the test result:
determining a target test case according to the field comparison result; and
and generating a target test case set according to the target test cases.
7. A traffic playback based testing device comprising:
the flow recording module is used for recording production flow, and the production flow is production transaction information of a host flow branch in a production environment;
the data desensitization module is used for carrying out data desensitization processing on the production transaction information to generate test data;
the data adaptation module is used for carrying out data adaptation operation on the test data to generate target input data, wherein the data adaptation operation is configured to adjust the production date and the transaction serial number of the test data to adapt to a transaction playback scene;
the transaction playback module is used for performing transaction playback on the target input data in a test environment according to a test scene to output transaction return information, wherein the test scene comprises a switch test, a function test and a performance test; and
and the test comparison module is used for comparing the transaction return information according to assertion configuration so as to determine a test result.
8. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-6.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 6.
10. A computer program product comprising a computer program which, when executed by a processor, implements a method according to any one of claims 1 to 6.
CN202210744811.7A 2022-06-27 2022-06-27 Testing method and device based on flow playback Pending CN115080433A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210744811.7A CN115080433A (en) 2022-06-27 2022-06-27 Testing method and device based on flow playback

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210744811.7A CN115080433A (en) 2022-06-27 2022-06-27 Testing method and device based on flow playback

Publications (1)

Publication Number Publication Date
CN115080433A true CN115080433A (en) 2022-09-20

Family

ID=83255756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210744811.7A Pending CN115080433A (en) 2022-06-27 2022-06-27 Testing method and device based on flow playback

Country Status (1)

Country Link
CN (1) CN115080433A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117312175A (en) * 2023-11-29 2023-12-29 盛业信息科技服务(深圳)有限公司 Data processing method, device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117312175A (en) * 2023-11-29 2023-12-29 盛业信息科技服务(深圳)有限公司 Data processing method, device, computer equipment and storage medium
CN117312175B (en) * 2023-11-29 2024-03-22 盛业信息科技服务(深圳)有限公司 Data processing method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US11144437B2 (en) Pre-populating continuous delivery test cases
CN113326247B (en) Cloud data migration method and device and electronic equipment
US9329979B2 (en) Derivation of generalized test cases
CN113344523A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN113535577B (en) Application testing method and device based on knowledge graph, electronic equipment and medium
CN113918864A (en) Website page testing method, testing system, testing device, electronic equipment and medium
CN115080433A (en) Testing method and device based on flow playback
CN113362173A (en) Anti-duplication mechanism verification method, anti-duplication mechanism verification system, electronic equipment and storage medium
CN111930629A (en) Page testing method and device, electronic equipment and storage medium
CN111949543A (en) Testing method and device based on distributed platform, electronic equipment and storage medium
CN113238940B (en) Interface test result comparison method, device, equipment and storage medium
CN115292187A (en) Method and device for automatically testing code-free page, electronic equipment and medium
CN114115628A (en) U shield display information acquisition method, device, equipment, medium and program product applied to U shield test
CN113032256A (en) Automatic test method, device, computer system and readable storage medium
CN111881025A (en) Automatic test task scheduling method, device and system
CN111859403A (en) Method and device for determining dependency vulnerability, electronic equipment and storage medium
CN113360365A (en) Flow testing method and flow testing system
CN116452208B (en) Method, device, equipment and medium for determining change transaction code
CN115687079A (en) Test script public code generation method and device
CN114064484A (en) Interface testing method and device, electronic equipment and readable storage medium
CN117435464A (en) Software testing method and device, electronic equipment and computer readable storage medium
CN116894004A (en) Information display method and device, electronic equipment and computer readable storage medium
CN115687078A (en) Test case evaluation method, test case evaluation apparatus, test case evaluation device, test case evaluation medium, and program product
CN114625667A (en) Page testing method, device, equipment, storage medium and program product
CN113392014A (en) Test case generation method and device, electronic equipment and 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