CN114143236A - Business system testing method and device, electronic equipment and readable storage medium - Google Patents

Business system testing method and device, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN114143236A
CN114143236A CN202010812151.2A CN202010812151A CN114143236A CN 114143236 A CN114143236 A CN 114143236A CN 202010812151 A CN202010812151 A CN 202010812151A CN 114143236 A CN114143236 A CN 114143236A
Authority
CN
China
Prior art keywords
data
execution
shadow
identifier
processing logic
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
CN202010812151.2A
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.)
NetsUnion Clearing Corp
Original Assignee
NetsUnion Clearing Corp
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 NetsUnion Clearing Corp filed Critical NetsUnion Clearing Corp
Priority to CN202010812151.2A priority Critical patent/CN114143236A/en
Publication of CN114143236A publication Critical patent/CN114143236A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a service system testing method, a service system testing device, electronic equipment and a readable storage medium. The method comprises the following steps: acquiring service data consisting of shadow data and production data, wherein the service data comprises a data identifier capable of distinguishing the shadow data from the production data; generating an execution identifier corresponding to the business data according to the execution thread and the data identifier corresponding to the business data, and distinguishing shadow data from production data according to the execution identifier; and according to the execution identifier, executing the execution thread in the functional component by using the processing logic corresponding to the execution identifier so as to test the business system, wherein the processing logic of the shadow data is independent of the processing logic of the production data. According to the scheme, the processing logics of the production data and the shadow data are decoupled by adopting the modes of identifying, adding the shadow data processing logics and the like, and the original business logic does not need to be modified, so that the development difficulty and the system modification risk are reduced, the possibility of generating bugs is reduced, and the method has better universality.

Description

Business system testing method and device, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for testing a service system, an electronic device, and a readable storage medium.
Background
The full link pressure test is to simulate massive requests and data to perform pressure test on the whole service chain based on actual production service scenes and system environments. At present, shadow traffic data (shadow traffic) is widely used for full link pressure testing, and the specific method is to copy a request sent to a production environment to generate shadow data, and input the shadow data and the production data into a service system to be tested together, so as to achieve the purposes of pressure testing and correctness testing.
The general service system has a plurality of service modules, the situation that partial service modules have shadow pressure measurement and partial service has no shadow pressure measurement may exist, and the existing pressure measurement mode is usually realized by modification on the basis of invading the core service code of the system, the invasion of the core service code needs to be completed by mastering the service logic details, so that the modification cost and risk are higher, and the reusability is low.
Disclosure of Invention
In view of the above, the present application is proposed to provide a business system testing method, apparatus, electronic device and readable storage medium that overcome or at least partially solve the above problems.
The embodiment of the application adopts the following technical scheme:
in a first aspect, an embodiment of the present application provides a service system testing method, which is executed by a service system server, where the method includes:
acquiring service data consisting of shadow data and production data, wherein the service data comprises a data identifier capable of distinguishing the shadow data from the production data;
generating an execution identifier corresponding to the service data according to an execution thread and a data identifier corresponding to the service data, wherein the execution identifier can distinguish the shadow data from the production data;
and executing the execution thread in the functional component by using the processing logic corresponding to the execution identifier according to the execution identifier so as to test the business system, wherein the processing logic corresponding to the shadow data is independent of the processing logic corresponding to the production data.
Optionally, the generating, according to the execution thread and the data identifier corresponding to the service data, an execution identifier corresponding to the execution thread includes:
respectively acquiring data identifications from each service data by using a component realized based on a section-oriented programming technology;
and generating a corresponding execution identifier according to the acquired data identifier, and storing the generated execution identifier in a context data structure, wherein the context data structure stores the corresponding relation between the thread identifier of the execution thread of the service data and the execution identifier.
Optionally, the executing the execution thread in the functional component according to the execution identifier with the processing logic corresponding to the execution identifier includes:
acquiring an execution identifier corresponding to the current execution thread from the context data structure according to the thread identifier of the current execution thread;
under the condition that the execution identifier indicates that the business data corresponding to the current execution thread is shadow data, executing the current execution thread by using processing logic corresponding to the shadow data in a functional component;
and in the case that the execution identifier indicates that the business data corresponding to the current execution thread is production data, executing the current execution thread in the functional component by using the processing logic corresponding to the production data.
Optionally, the functional component specifically includes an SQL database, a shadow data table corresponding to each production data table is preset in the SQL database, and executing the execution thread in the functional component with a processing logic corresponding to the execution identifier according to the execution identifier includes:
intercepting a database operation request related to business data;
under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, analyzing the table name of the production data table to be operated from the intercepted database operation request;
modifying the table name of the production data table in the database operation request into the table name of the corresponding shadow data table to obtain a modified database operation request;
and executing the modified database operation request.
Optionally, the executing the execution thread in the functional component with the processing logic corresponding to the execution identifier further includes:
and under the condition that the table name of the production data table is matched with a preset table name list, the intercepted database operation request is not modified, and the intercepted database operation request is executed.
Optionally, the functional component specifically includes a Redis client, and the executing the execution thread in the functional component by using the processing logic corresponding to the execution identifier according to the execution identifier includes:
modifying a key identifier of shadow data in the Redis client under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, and caching the shadow data for preset time according to the modified key identifier;
the processing logic corresponding to the shadow data is realized by inheriting a class in the processing logic corresponding to the production data, and the Redis client is an enhanced client comprising the processing logic corresponding to the shadow data and the processing logic corresponding to the production data.
Optionally, the functional component specifically includes a log component, and the executing the execution thread in the functional component by using the processing logic corresponding to the execution identifier according to the execution identifier includes:
under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, outputting the log of the shadow data to a preset log directory of the shadow data based on a log output component of the shadow data according to a filter return value of the shadow data;
wherein the filter return value of the shadow data is different from the filter return value of the production data; the log catalog of the shadow data is independent from the log catalog of the production data, and the data in the log catalog of the shadow data can be cleaned according to an automatic failure mechanism; and the log output component of the shadow data is obtained by copying the log output component of the production data.
Optionally, the method further comprises:
acquiring a timing task related to the service data; the timed task comprises a shadow task and a production task, wherein the shadow task is obtained by copying the production task, and the usability of the shadow task can be controlled based on a switch;
intercepting a timing task at an execution entrance of the timing task by a component realized based on a section-oriented programming technology, and analyzing task parameters for distinguishing a shadow task and a production task from the intercepted timing task;
and executing each timing task according to the task parameters.
Optionally, the method further comprises:
monitoring the process of the service system test, wherein the monitoring comprises one or more of physical resource monitoring, service monitoring and component monitoring, and acquiring one or more of the following information in the test process: the state of the central processing unit, the state of the memory, the state of the disk, the processing success rate of the service data, the time consumed by interface connection and the time consumed by data operation.
In a second aspect, an embodiment of the present application further provides a service system testing apparatus, which is applied to a service system server, and the apparatus includes:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is suitable for acquiring service data consisting of shadow data and production data, and the service data comprises a data identifier capable of distinguishing the shadow data from the production data;
the generating unit is suitable for generating an execution identifier corresponding to the business data according to an execution thread and a data identifier corresponding to the business data, and the execution identifier can distinguish the shadow data from the production data;
and the execution unit is suitable for executing the execution thread in the functional component by using the processing logic corresponding to the execution identifier according to the execution identifier so as to test the business system, and the processing logic corresponding to the shadow data is independent of the processing logic corresponding to the production data.
In a third aspect, an embodiment of the present application further provides an electronic device, including:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to perform any of the methods described above.
In a fourth aspect, this application embodiment also provides a computer-readable storage medium storing one or more programs which, when executed by an electronic device including a plurality of application programs, cause the electronic device to perform any of the methods described above.
The embodiment of the application adopts at least one technical scheme which can achieve the following beneficial effects:
according to the scheme, the mode of adding the shadow data processing logic and the like is adopted, the production data processing logic and the shadow data processing logic are decoupled, and the original business logic does not need to be modified, so that the development difficulty and the system modification risk are reduced, the possibility of generating bugs is reduced, and the method has good universality.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart of a service system testing method in an embodiment of the present application;
FIG. 2 is a schematic flow chart illustrating isolation of shadow data from production data in an SQL database according to an embodiment of the present application;
FIG. 3 is a schematic flow chart illustrating isolation of shadow data from production data in a Redis client according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a service system testing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an internet service order system architecture in the prior art of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more clear, the following description of the present application will be made in detail and completely with reference to the embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a service system testing method in an embodiment of the present application; the method is executed by a service system server, and comprises the following steps:
step S110, obtaining service data composed of shadow data and production data, where the service data includes a data identifier capable of distinguishing the shadow data from the production data.
The method disclosed in this embodiment can be used for full link pressure measurement of a network-connected service order system, and referring to a schematic structural diagram of a network-connected service order system architecture shown in fig. 5, a service order request is sent from an account mechanism to an account channel of a network connection, and is forwarded to a service order system by the account channel, and after order payment is completed by interaction with an EPCC transaction system (a dedicated system for order processing), the order request is sent to a merchant channel, and is finally sent to a merchant acceptance mechanism. For the networking service order system, a pressure test scheme needs to be designed for testing.
Specifically, request message data (i.e., production data) actually sent from a production environment and shadow data sent by a request message simulation mechanism are obtained or received, the production data and the shadow data are collectively referred to as service data, and the service data includes a data identification field, which can be used to distinguish the production data from the shadow data.
The shadow data can be obtained by marking the service initiating mechanism of the request message simulation mechanism as a testing mechanism (namely, the testing mechanism), and dyeing the request message to be sent into the shadow data. In order to distinguish the shadow data from the production data, a reserved bit in a data identification field (specifically, a transaction serial number) of a request message in the shadow data may be set to 1, the reserved bit may be a first bit or a last bit in the data identification field, or may be a middle bit, and the reserved bit in the data identification field of the production data is set to other numbers, so that the production data and the shadow data can be distinguished by judging the number of the reserved bit of the data identification.
Step S120, generating an execution identifier corresponding to the service data according to the execution thread and the data identifier corresponding to the service data, where the execution identifier can also distinguish the shadow data from the production data.
Before the service data enters each functional component to be processed, a data identifier of the service data can be obtained from the service data by setting a middleware and the like, and then a reserved bit in the data identifier is obtained as an execution identifier; or judging that the service data is shadow data or production data according to the reserved bit, and using the judged result as an execution identifier, for example, the execution identifier may be a judgment result of whether the service data is shadow data, if so, the service data is true, otherwise, the service data is false.
In addition to the above-mentioned execution identifier, data such as issuing organization of the business data may be obtained and saved in this step, where the issuing organization includes a testing organization that generates shadow data, an account organization that generates production data, and the like.
In the step, the execution identifier is obtained from the execution thread before the service data enters each functional component, so that repeated judgment of each service data in each functional component is avoided, occupation and processing time of computing resources is reduced, and the pressure measurement efficiency is improved.
Step S130, according to the execution identifier, executing the execution thread in the functional component with the processing logic corresponding to the execution identifier to test the business system, where the processing logic corresponding to the shadow data is independent of the processing logic corresponding to the production data.
The functional component distinguishes whether each business data is production data or shadow data according to the execution identifier, and then different processing logics are adopted to process the production data and the shadow data, so that not only is the pressure test realized, but also the original logics of the production data are not influenced.
In specific implementation, according to the characteristics of each functional component, means such as copying original code logic to form a plug-in, setting a section to reduce intrusion to the original code or forming an enhanced component on the basis of the original component in an inheritance mode are respectively adopted, the processing logic of shadow data and the original processing logic of production data are divided or independently separated, the shadow data and the production data are respectively processed, and therefore pollution of the shadow data to the production data is reduced.
In short, the service system testing method disclosed in this embodiment can effectively reduce the development difficulty and system modification risk of the voltage measurement component, reduce the possibility of generating a bug, have good versatility, and can implement multiplexing by installing the developed software package in the existing service system.
In one or some embodiments, the step S120 includes: respectively acquiring data identifications from each service data by using a component realized based on a section-oriented programming technology; and generating a corresponding execution identifier according to the acquired data identifier, and storing the generated execution identifier in a context data structure, wherein the context data structure stores the corresponding relation between the thread identifier of the execution thread of the service data and the execution identifier.
An Aspect Oriented Programming (AOP) technique is a technique for implementing unified maintenance of program functions through a pre-compilation mode and a dynamic agent during operation, and AOP is an important content in a spring framework, and parts of business logic can be isolated by using AOP, so that the coupling degree between each part of the business logic is reduced, the reusability of a program is improved, and the development efficiency is improved. The embodiment utilizes the AOP to set the section to acquire the data identification field from the execution thread, thereby reducing the intrusion to the original code.
Specifically, a data identifier is obtained from a tangent plane by using a threaded local tool class, and an execution identifier is generated according to the data identifier and is stored in a context data structure, wherein the context data structure can be named as ShadowContext. When a thread corresponding to business data is executed in each functional component, an execution identifier corresponding to the execution thread can be acquired from the context data structure, so that the obtained business data is information of shadow data or production data.
The embodiment of the application shows a specific implementation manner of identifying and saving the data identifier. Of course, it should be understood that step S120 may also be implemented in other ways, and this is not limited in this embodiment of the application.
In one embodiment, the step 130 includes: acquiring an execution identifier corresponding to the current execution thread from the context data structure according to the thread identifier of the current execution thread; under the condition that the execution identifier indicates that the business data corresponding to the current execution thread is shadow data, executing the current execution thread by using processing logic corresponding to the shadow data in a functional component; and in the case that the execution identifier indicates that the business data corresponding to the current execution thread is production data, executing the current execution thread in the functional component by using the processing logic corresponding to the production data.
In the embodiment, the execution identifier is obtained by using the execution thread in each functional component, the data type is determined according to the execution identifier, and then the shadow data and the production data are isolated according to different processing logics preset in the functional component for the shadow data or the production data.
In one embodiment, the functional component specifically includes an SQL database, in which shadow data tables corresponding to the production data tables are preset, and the step S130 includes:
intercepting a database operation request related to business data; under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, analyzing the table name of the production data table to be operated from the intercepted database operation request; modifying the table name of the production data table in the database operation request into the table name of the corresponding shadow data table to obtain a modified database operation request; and executing the modified database operation request.
Further, the step S130 further includes: and under the condition that the table name of the analyzed production data table to be operated is matched with a preset table name list, the intercepted database operation request is not modified, and the intercepted database operation request is executed.
Isolation of database components is an important aspect of implementing business system testing, and fig. 2 is a flow diagram illustrating implementation of isolation policies in an SQL database. In actual operation, a shadow data table needs to be created in advance for storing shadow data or result data obtained after the shadow data is operated by a database. The table name of the shadow data table may be "test _ production data table name" and the number of shadow data tables is identical to the number of production data tables.
At present, database operation is implemented by using sql (structured query language), and includes accessing data, querying, updating, and managing a relational database system, specifically including operations of adding, deleting, searching, and modifying data.
When the database component carries out data isolation, a database operation request, generally an sql instruction, is intercepted first, and in order to not invade the original code service, all the sql instruction can be intercepted through an Interceptor of Mybatis.
And after the sql instruction is intercepted, acquiring a stored execution identifier from a ShadowContext context data structure, and if the data is judged to be production data according to the execution identifier, continuing the original database operation.
If the processing logic of the execution thread is the processing logic corresponding to the shadow data, analyzing the table name of the sql instruction, judging whether the table name is in a preset table name list, if not, adding a test _ prefix to the table name field of the shadow data to indicate that the data should be stored in the shadow data table corresponding to the table name, and then executing database operation aiming at the shadow data, wherein the database operation can be the same as or different from the database operation of the production data; and if the table name is in the preset table name list, skipping the step of adding the table name prefix, and continuing to execute subsequent original database operation which is the same as the production data, namely executing the operation which is the same as the production data on the shadow data in the preset table name list.
The operation shows that the table name is not added with the prefix in front of the table name identification field of the shadow data in the preset table name list, and the table name is stored in the corresponding shadow data table after the database operation; and performing database operation on the shadow data in the preset list name list, which is the same as the production data, and storing the shadow data in the corresponding production data list.
The table in the list of names of the preset table may be a table for managing configuration classes, or may be a table of other types selected according to the pressure measurement requirement. The design can flexibly process the shadow data according to the pressure measurement requirement, and the real business logic is better simulated.
In this specific implementation, the method further includes the step of configuring the database: the configuration of the shadow data table is increased by using a Database-splitting and table-splitting middleware CDS (completed Database shading), and the configuration of the shadow data table is the same as that of the production table, such as a splitting key and a rule, so that the shadow data operated by the Database is saved in the same way.
The CDS is a product based on client-developed database and table-division middleware, realizes JDBC standard API, supports a plurality of functions of database and table division, read-write separation, data operation and maintenance and the like, provides high-performance, high-concurrency and high-reliability access service for mass data routes, can be accessed by a service system at nearly zero cost, and currently supports three database clusters of MySQL, Oracle and SQL Server.
In an embodiment, the executing the execution thread in the functional component with the processing logic corresponding to the execution identifier according to the execution identifier includes: modifying a key identifier of shadow data in the Redis client under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, and caching the shadow data for preset time according to the modified key identifier; the processing logic corresponding to the shadow data is realized by inheriting a class in the processing logic corresponding to the production data, and the Redis client is an enhanced client comprising the processing logic corresponding to the shadow data and the processing logic corresponding to the production data.
The Redis cache is an open source log-type and Key-Value database which is written by using ANSIC language, supports network, can be based on memory and can also be persistent, and provides API of multiple languages. The embodiment does not change the whole structure of the existing Redis client, only adds the code logic for processing the shadow data in an inheritance way, and obtains the enhanced Redis client.
Fig. 3 shows a specific process for implementing shadow data isolation in a Redis client. Specifically, in this embodiment of the present application, a class inherited from an original component is added to the Redis client, and the distinction between shadow data and production data is implemented in the class. If the original processing logic is still adopted for the production data, if the shadow data is adopted, a prefix "TEST _" is added before the name of a key (key) of the shadow data, the expiration time of the shadow data is set, for example, 5 minutes, and the next functional component is entered or automatically deleted after the expiration time.
The embodiment adds the identification and processing logic of the shadow data on the basis of the original logic, and realizes the isolation processing of the shadow data and the production data according to the difference of key (key) identifications, thereby obtaining an enhanced Redis client.
In an embodiment, the executing the execution thread in the functional component with the processing logic corresponding to the execution identifier includes:
under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, outputting the log of the shadow data to a preset log directory of the shadow data based on a log output component of the shadow data according to a filter return value of the shadow data;
wherein the filter return value of the shadow data is different from the filter return value of the production data; the log catalog of the shadow data is independent from the log catalog of the production data, and the data in the log catalog of the shadow data can be cleaned according to an automatic failure mechanism; and the log output component of the shadow data is obtained by copying the log output component of the production data.
Firstly, presetting a shadow data log output directory as/data/appLogs/shadow/.
Taking a Logback as a log component as an example, the Logback is an open source log component designed by a log4j originator, wherein a Filter component based on the Logback realizes the identification and output of shadow logs and service logs. Specifically, the Filter implemented can be customized as needed for controlling the opender (adapter component) of the log output. For example, when a request message belonging to production data is defined, the applet returns filter reply.
The shadow data and the production data have different processing modes, and if the method return value is DENY, the log object is terminated and cannot be accessed by other filters; if the method return value is ACCEPT, then the log object is immediately processed skipping the remaining filters.
Lodback may contain multiple apppenders responsible for outputting log event deliveries to its target directory. And adding a new shadow apender by cloning the original apender for realizing the output of the shadow log.
According to the two embodiments of the application, shadow data isolation test is respectively realized in the Redis client and the log component, the realization of full link pressure test is perfected, the process of production data is simulated more truly, and the pressure test result is more real and reliable.
In one embodiment, the method further comprises: acquiring a timing task related to the service data; the timed task comprises a shadow task and a production task, wherein the shadow task is obtained by copying the production task, and the usability of the shadow task can be controlled based on a switch;
intercepting a timing task at an execution entrance of the timing task by a component realized based on a section-oriented programming technology, and analyzing task parameters for distinguishing a shadow task and a production task from the intercepted timing task;
and respectively executing each timing task according to the task parameters.
The timing task in this embodiment includes a timing clearing service issued to the online service order system, for example, a batch order is input into the online service order system at a certain time point for clearing processing.
The specific implementation manner of the timing task is as follows: and copying a task in the timing task platform, and adding a new parameter shadow which is Y in the original task parameter for marking the shadow pressure measurement. And then defining a section, intercepting an execution entrance of the timing task, reading a parameter list, judging whether a shadow-Y parameter is included, wherein the parameter is equivalent to a switch for opening the timing task, if the parameter is included in the parameter list, storing the identifier of the batch of data into ShadowContext, and further starting to perform service system test on the batch of data, otherwise, performing no pressure test.
It should be noted that the above embodiment related to step 130 is only an example, and the embodiment of the present application may further include other policies related to isolation of other functional components, and the policies are not limited to the above specific implementation and may also include other specific implementations, which are not specifically limited herein.
In one embodiment, the method further comprises: monitoring the process of the service system test, wherein the monitoring comprises one or more of physical resource monitoring, service monitoring and component monitoring, and acquiring one or more of the following information in the test process: the state of the central processing unit, the state of the memory, the state of the disk, the processing success rate of the service data, the time consumed by interface connection and the time consumed by data operation.
The monitoring of the service system test comprises three aspects of physical resource monitoring, service monitoring and component monitoring. The physical resource monitoring can be a Zabbix monitoring system, the Zabbix is open source monitoring software for a network, an operating system and an application program, aims to monitor and track the states of various network services, servers and other network hardware, and can monitor the running state of physical resources from dimensions such as a Central Processing Unit (CPU), a memory, a disk and the like; the service monitoring can set a pressure measurement monitoring large screen according to the generated shadow log, and pay attention to indexes such as service processing success rate, interface connection time consumption, data operation time consumption and the like; the component monitoring comprises a monitoring system in each functional component.
Fig. 4 shows a service system testing apparatus according to an embodiment of the present application, which is used in a server of a service system, where the apparatus 400 includes:
the obtaining unit 410 is adapted to obtain service data composed of shadow data and production data, where the service data includes a data identifier capable of distinguishing the shadow data from the production data.
The generating unit 420 is adapted to generate an execution identifier corresponding to the service data according to the execution thread and the data identifier corresponding to the service data, where the execution identifier can distinguish the shadow data from the production data.
And the execution unit 430 is adapted to execute the execution thread in the functional component with the processing logic corresponding to the execution identifier according to the execution identifier to test the business system, and the processing logic corresponding to the shadow data is independent of the processing logic corresponding to the production data.
According to the embodiment, through the service system testing device, the development difficulty and the system transformation risk of the low-voltage testing component can be effectively reduced, the vulnerability risk is reduced, the universality is good, and the multiplexing can be realized by installing the developed software package in other service systems.
In one embodiment, the generating unit 420 is adapted to:
respectively acquiring data identifications from each service data by using a component realized based on a section-oriented programming technology; and generating a corresponding execution identifier according to the acquired data identifier, and storing the generated execution identifier in a context data structure, wherein the context data structure stores the corresponding relation between the thread identifier of the execution thread of the service data and the execution identifier.
In one embodiment, the execution unit 430 is adapted to:
acquiring an execution identifier corresponding to the current execution thread from the context data structure according to the thread identifier of the current execution thread; under the condition that the execution identifier indicates that the business data corresponding to the current execution thread is shadow data, executing the current execution thread by using processing logic corresponding to the shadow data in a functional component; and in the case that the execution identifier indicates that the business data corresponding to the current execution thread is production data, executing the current execution thread in the functional component by using the processing logic corresponding to the production data.
In an embodiment, the functional component specifically includes an SQL database, a shadow data table corresponding to each production data table is preset in the SQL database, and the execution unit 430 is adapted to:
intercepting a database operation request related to business data;
under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, analyzing the table name of the production data table to be operated from the intercepted database operation request;
modifying the table name of the production data table in the database operation request into the table name of the corresponding shadow data table to obtain a modified database operation request;
and executing the modified database operation request.
In an embodiment, the functional component specifically includes a Redis client, and the execution unit 430 is adapted to:
modifying a key identifier of shadow data in the Redis client under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, and caching the shadow data for preset time according to the modified key identifier;
the processing logic corresponding to the shadow data is realized by inheriting a class in the processing logic corresponding to the production data, and the Redis client is an enhanced client Redis client which comprises the processing logic corresponding to the shadow data and the processing logic corresponding to the production data.
In one embodiment, the functional component specifically includes a log component, and the execution unit 430 is adapted to:
under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, outputting the log of the shadow data to a preset log directory of the shadow data based on a log output component of the shadow data according to a filter return value of the shadow data;
wherein the filter return value of the shadow data is different from the filter return value of the production data; the log catalog of the shadow data is independent from the log catalog of the production data, and the data in the log catalog of the shadow data can be cleaned according to an automatic failure mechanism; and the log output component of the shadow data is obtained by copying the log output component of the production data.
In one embodiment, the apparatus comprises a timed task unit adapted to:
acquiring a timing task related to the service data; the timed task comprises a shadow task and a production task, wherein the shadow task is obtained by copying the production task, and the usability of the shadow task can be controlled based on a switch;
intercepting a timing task at an execution entrance of the timing task by a component realized based on a section-oriented programming technology, and analyzing task parameters for distinguishing a shadow task and a production task from the intercepted timing task;
and respectively executing each timing task according to the task parameters.
In one embodiment, the apparatus further comprises a monitoring unit adapted to:
monitoring the process of the service system test, wherein the monitoring comprises one or more of physical resource monitoring, service monitoring and component monitoring, and acquiring one or more of the following information in the test process: the state of the central processing unit, the state of the memory, the state of the disk, the processing success rate of the service data, the time consumed by interface connection and the time consumed by data operation.
It should be noted that, for the specific implementation of each apparatus embodiment, reference may be made to the specific implementation of the corresponding method embodiment, which is not described herein again.
To sum up, the service system test scheme disclosed in the embodiment of the present application includes: acquiring service data consisting of shadow data and production data, wherein the service data comprises a data identifier capable of distinguishing the shadow data from the production data; generating an execution identifier corresponding to the service data according to an execution thread and a data identifier corresponding to the service data, wherein the execution identifier can distinguish the shadow data from the production data; and executing the execution thread in the functional component by using the processing logic corresponding to the execution identifier according to the execution identifier so as to test the business system, wherein the processing logic corresponding to the shadow data is independent of the processing logic corresponding to the production data. Compared with the existing service system test solution, the method and the system have the advantages that the service system test function is completed by adopting a plug-in, a tangent plane or an enhanced component and the like on the principle of not invading core service codes, the service codes are effectively decoupled with the function module, a software installation package for service system test is introduced, shadow pressure test can be completed by increasing relevant configuration, the system transformation risk is reduced, the vulnerability risk is reduced, components including Redis, logs and the like in a real-time transaction system can be effectively isolated, the components can be selectively reused in other service systems, and the method and the system have better universality.
Fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Referring to fig. 6, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 6, but that does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the service system testing device on the logic level. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
acquiring service data consisting of shadow data and production data, wherein the service data comprises a data identifier capable of distinguishing the shadow data from the production data.
And generating an execution identifier corresponding to the service data according to the execution thread and the data identifier corresponding to the service data, wherein the execution identifier can distinguish the shadow data from the production data.
And executing the execution thread by using the processing logic corresponding to the execution identifier in the functional component according to the execution identifier, wherein the processing logic corresponding to the shadow data is independent of the processing logic corresponding to the production data.
The service system testing method disclosed in the embodiment of fig. 1 of the present application may be applied to a processor, or may be implemented by the processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The electronic device may further execute the service system testing method in fig. 1, and implement the functions of the service system testing apparatus in the embodiment shown in fig. 1, which are not described herein again in this embodiment of the present application.
An embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores one or more programs, where the one or more software installations include instructions, and when the instructions are executed by an electronic device including a plurality of application programs, the instructions can cause the electronic device to perform the method performed by the service system testing apparatus in the embodiment shown in fig. 1, and are specifically configured to perform:
acquiring service data consisting of shadow data and production data, wherein the service data comprises a data identifier capable of distinguishing the shadow data from the production data;
generating an execution identifier corresponding to the service data according to an execution thread and a data identifier corresponding to the service data, wherein the execution identifier can distinguish the shadow data from the production data;
and executing the execution thread by using the processing logic corresponding to the execution identifier in the functional component according to the execution identifier, wherein the processing logic corresponding to the shadow data is independent of the processing logic corresponding to the production data.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks. In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (12)

1. A service system testing method performed by a service system server, wherein the method comprises:
acquiring service data consisting of shadow data and production data, wherein the service data comprises a data identifier capable of distinguishing the shadow data from the production data;
generating an execution identifier corresponding to the service data according to an execution thread and a data identifier corresponding to the service data, wherein the execution identifier can distinguish the shadow data from the production data;
and executing the execution thread in the functional component by using the processing logic corresponding to the execution identifier according to the execution identifier so as to test the business system, wherein the processing logic corresponding to the shadow data is independent of the processing logic corresponding to the production data.
2. The method of claim 1, wherein the generating, according to the execution thread and the data identifier corresponding to the service data, the execution identifier corresponding to the execution thread comprises:
respectively acquiring data identifications from each service data by using a component realized based on a section-oriented programming technology;
and generating a corresponding execution identifier according to the acquired data identifier, and storing the generated execution identifier in a context data structure, wherein the context data structure stores the corresponding relation between the thread identifier of the execution thread of the service data and the execution identifier.
3. The method of claim 2, wherein executing the thread of execution in the functional component with the processing logic corresponding to the execution identifier according to the execution identifier comprises:
acquiring an execution identifier corresponding to the current execution thread from the context data structure according to the thread identifier of the current execution thread;
under the condition that the execution identifier indicates that the business data corresponding to the current execution thread is shadow data, executing the current execution thread by using processing logic corresponding to the shadow data in a functional component;
and in the case that the execution identifier indicates that the business data corresponding to the current execution thread is production data, executing the current execution thread in the functional component by using the processing logic corresponding to the production data.
4. The method of claim 1, wherein the functional component specifically includes an SQL database, a shadow data table corresponding to each production data table is preset in the SQL database, and executing the execution thread in the functional component with the processing logic corresponding to the execution identifier according to the execution identifier includes:
intercepting a database operation request related to business data;
under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, analyzing the table name of the production data table to be operated from the intercepted database operation request;
modifying the table name of the production data table in the database operation request into the table name of the corresponding shadow data table to obtain a modified database operation request;
and executing the modified database operation request.
5. The method of claim 4, wherein executing the thread of execution in the functional component with the processing logic corresponding to the execution identifier further comprises:
and under the condition that the table name of the production data table is matched with a preset table name list, the intercepted database operation request is not modified, and the intercepted database operation request is executed.
6. The method according to claim 1, wherein the functional component specifically includes a Redis client, and the executing the execution thread in the functional component with the processing logic corresponding to the execution identifier according to the execution identifier includes:
modifying a key identifier of shadow data in the Redis client under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, and caching the shadow data for preset time according to the modified key identifier;
the processing logic corresponding to the shadow data is realized by inheriting a class in the processing logic corresponding to the production data, and the Redis client is an enhanced client comprising the processing logic corresponding to the shadow data and the processing logic corresponding to the production data.
7. The method of claim 1, wherein the functional component specifically includes a log component, and executing the execution thread in the functional component with the processing logic corresponding to the execution identifier according to the execution identifier includes:
under the condition that the processing logic of the execution thread is the processing logic corresponding to the shadow data, outputting the log of the shadow data to a preset log directory of the shadow data based on a log output component of the shadow data according to a filter return value of the shadow data;
wherein the filter return value of the shadow data is different from the filter return value of the production data; the log catalog of the shadow data is independent from the log catalog of the production data, and the data in the log catalog of the shadow data can be cleaned according to an automatic failure mechanism; and the log output component of the shadow data is obtained by copying the log output component of the production data.
8. The method of claim 1, wherein the method further comprises:
acquiring a timing task related to the service data; the timed task comprises a shadow task and a production task, wherein the shadow task is obtained by copying the production task, and the usability of the shadow task can be controlled based on a switch;
intercepting a timing task at an execution entrance of the timing task by a component realized based on a section-oriented programming technology, and analyzing task parameters for distinguishing a shadow task and a production task from the intercepted timing task;
and executing each timing task according to the task parameters.
9. The method of any one of claims 1-8, wherein the method further comprises:
monitoring the process of the service system test, wherein the monitoring comprises one or more of physical resource monitoring, service monitoring and component monitoring, and acquiring one or more of the following information in the test process: the state of the central processing unit, the state of the memory, the state of the disk, the processing success rate of the service data, the time consumed by interface connection and the time consumed by data operation.
10. A business system testing device is applied to a business system server, wherein the device comprises:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is suitable for acquiring service data consisting of shadow data and production data, and the service data comprises a data identifier capable of distinguishing the shadow data from the production data;
the generating unit is suitable for generating an execution identifier corresponding to the business data according to an execution thread and a data identifier corresponding to the business data, and the execution identifier can distinguish the shadow data from the production data;
and the execution unit is suitable for executing the execution thread in the functional component by using the processing logic corresponding to the execution identifier according to the execution identifier so as to test the business system, and the processing logic corresponding to the shadow data is independent of the processing logic corresponding to the production data.
11. An electronic device, comprising:
a processor; and
a memory arranged to store computer executable instructions which, when executed, cause the processor to perform the method of any of claims 1 to 9.
12. A computer readable storage medium storing one or more programs which, when executed by an electronic device comprising a plurality of application programs, cause the electronic device to perform the method of any of claims 1-9.
CN202010812151.2A 2020-08-13 2020-08-13 Business system testing method and device, electronic equipment and readable storage medium Pending CN114143236A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010812151.2A CN114143236A (en) 2020-08-13 2020-08-13 Business system testing method and device, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010812151.2A CN114143236A (en) 2020-08-13 2020-08-13 Business system testing method and device, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN114143236A true CN114143236A (en) 2022-03-04

Family

ID=80437984

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010812151.2A Pending CN114143236A (en) 2020-08-13 2020-08-13 Business system testing method and device, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114143236A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115225666A (en) * 2022-07-07 2022-10-21 支付宝(杭州)信息技术有限公司 Production drilling method, device and system, emergency rule platform and injection platform

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150302040A1 (en) * 2014-04-18 2015-10-22 International Business Machines Corporation Enabling testing of production systems without affecting customer data sets system and method
CN108090784A (en) * 2017-11-28 2018-05-29 口碑(上海)信息技术有限公司 Marketing activity emulation verification method and device
CN108933713A (en) * 2018-07-20 2018-12-04 阿里巴巴集团控股有限公司 The method, apparatus and service server of sandbox debugging are realized based on shadow link
CN109871320A (en) * 2019-01-21 2019-06-11 上海德启信息科技有限公司 A kind of data processing method, device, application server and storage medium
CN110750584A (en) * 2019-09-18 2020-02-04 苏宁云计算有限公司 Data management method and system
US20200145284A1 (en) * 2018-11-01 2020-05-07 Hewlett Packard Enterprise Development Lp Validating Network Configuration Using Shadow Databases
CN111478828A (en) * 2020-06-24 2020-07-31 支付宝(杭州)信息技术有限公司 Pressure testing method, device and system for block chain network

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150302040A1 (en) * 2014-04-18 2015-10-22 International Business Machines Corporation Enabling testing of production systems without affecting customer data sets system and method
CN108090784A (en) * 2017-11-28 2018-05-29 口碑(上海)信息技术有限公司 Marketing activity emulation verification method and device
CN108933713A (en) * 2018-07-20 2018-12-04 阿里巴巴集团控股有限公司 The method, apparatus and service server of sandbox debugging are realized based on shadow link
US20200145284A1 (en) * 2018-11-01 2020-05-07 Hewlett Packard Enterprise Development Lp Validating Network Configuration Using Shadow Databases
CN109871320A (en) * 2019-01-21 2019-06-11 上海德启信息科技有限公司 A kind of data processing method, device, application server and storage medium
CN110750584A (en) * 2019-09-18 2020-02-04 苏宁云计算有限公司 Data management method and system
CN111478828A (en) * 2020-06-24 2020-07-31 支付宝(杭州)信息技术有限公司 Pressure testing method, device and system for block chain network

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115225666A (en) * 2022-07-07 2022-10-21 支付宝(杭州)信息技术有限公司 Production drilling method, device and system, emergency rule platform and injection platform

Similar Documents

Publication Publication Date Title
CN109032825B (en) Fault injection method, device and equipment
CN111124906A (en) Tracking method, compiling method and device based on dynamic embedded points and electronic equipment
CN110209700B (en) Data stream association method and device, electronic equipment and storage medium
CN110515795B (en) Big data component monitoring method and device and electronic equipment
CN114091099A (en) Authority hierarchical control method, equipment and storage medium for business system
CN112131573A (en) Method and device for detecting security vulnerability and storage medium
CN110941632A (en) Database auditing method, device and equipment
CN114143236A (en) Business system testing method and device, electronic equipment and readable storage medium
CN113553214A (en) Idempotent checking method and device
CN110647463B (en) Method and device for restoring test breakpoint and electronic equipment
CN114691473A (en) Test method, test device and electronic equipment
CN111435327B (en) Log record processing method, device and system
CN115086047B (en) Interface authentication method and device, electronic equipment and storage medium
CN115454851A (en) Interface regression testing method and device, storage medium and electronic device
CN113626870A (en) Access control method, device, electronic equipment and storage medium
CN109840213B (en) Test data creating method, device, terminal and storage medium for GUI test
CN114138839A (en) Test account number implementation method based on database routing
CN113672660A (en) Data query method, device and equipment
CN113553250A (en) Code testing method and device
CN115203063B (en) Playback method and system of production flow re-running risk program based on real-time recording
CN111459819A (en) Software testing method and device, electronic equipment and computer readable medium
CN112579559A (en) Key value pair management verification method, device, equipment and storage medium
CN112860538A (en) Method and device for performing interface regression test based on online log
CN110688144B (en) Method and device for optimizing service interface configuration and electronic equipment
CN117312355A (en) Data access method, heterogeneous data source access engine, 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