CN112052152A - Simulation test method and device - Google Patents

Simulation test method and device Download PDF

Info

Publication number
CN112052152A
CN112052152A CN201910491441.9A CN201910491441A CN112052152A CN 112052152 A CN112052152 A CN 112052152A CN 201910491441 A CN201910491441 A CN 201910491441A CN 112052152 A CN112052152 A CN 112052152A
Authority
CN
China
Prior art keywords
component
cluster
rule
test
test data
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
CN201910491441.9A
Other languages
Chinese (zh)
Inventor
韩铭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201910491441.9A priority Critical patent/CN112052152A/en
Publication of CN112052152A publication Critical patent/CN112052152A/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/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/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a device for simulation test, and relates to the technical field of computers. One embodiment of the method comprises: acquiring a component identifier and an identifier of a cluster to which the component belongs according to a calling request of the component; acquiring a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the identifier of the cluster; and returning the simulation test data according to the test data rule of the component and the test trigger rule of the cluster. The method and the device can realize simulation test on the on-line cluster, control the influence of simulation test data on the on-line cluster flow, improve the controllability of the simulation test process of the component, enable the simulation test process of the component to be completely dynamic and personalized, and support dynamic simulation test of the component in a whole scene.

Description

Simulation test method and device
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for simulation test.
Background
After the development of the service system function is completed, the service system and the components included therein need to be tested in order to verify the correctness, integrity, safety, etc. of the function. Most of the existing testing methods are static mock (simulation) tests, and the implementation flow is shown in fig. 1.
Fig. 1 is a schematic flow chart of a conventional static component mock test implementation. When a service system receives a component calling request, inquiring component configuration information to judge whether a component exists and acquire component information, then judging whether a request parameter contains a mock request identifier, if not, normally calling the component and returning a result, otherwise, judging whether the component supports mock; if not, the component is normally called and a result is returned, otherwise, whether the component information contains pre-configured mock data is judged; if not, the component is normally called to return the result, otherwise, the mock data is returned as the component calling result.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the component mock trigger rule is single, whether the request mock identifier is in fixed configuration of an entrance or not cannot be triggered dynamically aiming at different requests (such as a certain user or a certain entrance and the like); whether the components support mock to be fixedly configured or not cannot be set for the service cluster, for example, the function online verification is mostly carried out on the gray level cluster; the component mock data is fixed, and multi-person or multi-scene verification cannot be supported simultaneously.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for simulation testing, which can implement simulation testing on an online cluster, control the influence of simulation test data on the flow of the online cluster, improve the controllability of a component simulation testing process, make the component simulation testing process completely dynamic and personalized, and support full-scene component dynamic simulation testing.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided a method of simulation testing.
A method of simulating a test, comprising: acquiring a component identifier and an identifier of a cluster to which the component belongs according to a calling request of the component; acquiring a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the cluster identifier; and returning simulation test data according to the test data rule of the component and the test trigger rule of the cluster.
Optionally, the obtaining the test data rule of the component and the test trigger rule of the cluster according to the component identifier and the cluster identifier includes: acquiring a test data rule of the component positioned in the cluster according to the component identifier and the cluster identifier; and if the test data rule of the component is obtained, obtaining the test trigger rule of the cluster according to the identification of the cluster, otherwise, normally calling the component.
Optionally, returning simulation test data according to the test data rule of the component and the test trigger rule of the cluster includes: sequentially acquiring each test trigger rule of the cluster, and judging whether the calling request meets any test trigger rule; if any test trigger rule is met, generating simulation test data according to the test data rule of the component and returning, otherwise, normally calling the component and returning a calling result.
Optionally, the test trigger rules of the cluster are not less than one, and each test trigger rule has a different priority.
Optionally, the test data rules of the components and the test trigger rules of the clusters support comparison operations and/or regular matching.
Optionally, the test data rules of the components are configured as a tree structure.
According to another aspect of the embodiments of the present invention, there is provided an apparatus for simulating a test.
An apparatus for simulating a test, comprising: the identification acquisition module is used for acquiring the identification of the component and the identification of the cluster to which the component belongs according to the calling request of the component; the rule obtaining module is used for obtaining a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the cluster identifier; and the data return module is used for returning simulation test data according to the test data rule of the component and the test trigger rule of the cluster.
Optionally, the rule obtaining module is further configured to: acquiring a test data rule of the component positioned in the cluster according to the component identifier and the cluster identifier; and if the test data rule of the component is obtained, obtaining the test trigger rule of the cluster according to the identification of the cluster, otherwise, normally calling the component.
Optionally, the data return module is further configured to: sequentially acquiring each test trigger rule of the cluster, and judging whether the calling request meets any test trigger rule; if any test trigger rule is met, generating simulation test data according to the test data rule of the component and returning, otherwise, normally calling the component and returning a calling result.
Optionally, the test trigger rules of the cluster are not less than one, and each test trigger rule has a different priority.
Optionally, the test data rules of the components and the test trigger rules of the clusters support comparison operations and/or regular matching.
Optionally, the test data rules of the components are configured as a tree structure.
According to yet another aspect of an embodiment of the present invention, there is provided an electronic device for simulation testing.
An electronic device for simulation testing, comprising: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the simulation test method provided by the embodiment of the invention.
According to yet another aspect of embodiments of the present invention, a computer-readable medium is provided.
A computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of simulation testing provided by embodiments of the present invention.
One embodiment of the above invention has the following advantages or benefits: acquiring a component identifier and an identifier of a cluster to which the component belongs according to a calling request of the component; then, acquiring a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the identifier of the cluster; the simulation test data are returned according to the test data rule of the component and the test trigger rule of the cluster, the static simulation test process of the component is dynamic, the dynamic simulation test of the on-line cluster can be realized by configuring the simulation test of the component according to the cluster, the cluster which is subjected to the dynamic simulation test each time is set according to the requirement, and the influence of the simulation test data on the flow of the on-line cluster is controlled; by configuring the test trigger rule of the cluster, the trigger scene of the test is refined, the simulation test process of the component is further controlled in a specified request, and the controllability of the simulation test process of the component is improved; by configuring the test data rule of the component, the same component in the same cluster provides different component simulation test data in different scenes, so that the simulation test process of the component is completely dynamic and personalized, and the dynamic simulation test of the component in a full scene is supported.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic flow chart of a conventional static component mock test implementation;
FIG. 2 is a block diagram of a component mock testing system according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the main steps of a method of simulation testing according to an embodiment of the present invention;
FIG. 4 is a schematic flow diagram of a component simulation test according to an embodiment of the present invention;
FIG. 5 is a diagram of a component test data rule tree structure according to one embodiment of the present invention;
FIG. 6 is a schematic diagram of the main blocks of an apparatus for simulation testing according to an embodiment of the present invention;
FIG. 7 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing a terminal device or a server according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
When a certain service scene is online, a tester needs to verify functional correctness in an online environment, but for some service scenes which are complex in function and contain a large number of service components, the existing static mock testing method is often difficult to construct real result data for each component required by the scene. For example, for a business type chat robot commonly used in the e-commerce field, when a user consults the current status of an order, it may be necessary for the user to provide an order list component for the user to select an order to consult; after the user selects an order, the user is also required to provide an order status component to determine the current status of the order; if the order is currently in the delivery state, it is also required to provide an order logistics information component to show the current location information of the order to the user, and so on. For the service scene, when the service scene is tested, a test account number is required to be used for ordering, the test order is required to enter real production, one time is long, the second time influences on-line real data, and the third time cannot be constructed if other instantaneous states are required to be judged. This can make test acceptance of a business product exceptionally difficult.
In order to solve the problems in the prior art, the invention provides a method and a device for simulation test, aiming at increasing the mock test configuration of components according to clusters and controlling the flow influence of mock data on clusters on line by calling a mock service for independent splitting of a component market; adding dynamic configuration of a component mock trigger rule, dynamically analyzing a trigger rule parameter value in a request protocol, carrying out dynamic mock rule triggering according to parameters such as specified conditions or percentages and the like, and further finely controlling the influence of mock data on the non-mock test flow of a specified cluster; meanwhile, a component mock rule is set according to the multi-user multi-scene verification requirements, different component mock results are configured according to different conditions, and different mock data are dynamically generated for each scene or each tester. In the description of the embodiment of the present invention, the mock test refers to an analog test.
Fig. 2 is a schematic diagram of a component mock test system architecture according to an embodiment of the present invention. As shown in fig. 2, the component mock test system according to the embodiment of the present invention mainly includes a component caller, a component market, a component mock platform, a database, and so on. The most important of the components are a component market and a component mock platform. The component market is mainly used for inquiring the mock trigger rule and the mock test data of the component according to the cluster, executing the mock trigger rule and returning the mock data when a certain mock trigger rule is met; and the component mock platform is responsible for the configuration of the cluster mock triggering rule and the component mock data rule, and provides a cluster mock triggering rule data query interface and a component mock data rule execution generation mock data interface.
Fig. 3 is a schematic diagram of main steps of a method for simulation test according to an embodiment of the present invention. As shown in fig. 3, the simulation testing method of the embodiment of the present invention mainly includes the following steps S301 to S303.
Step S301: acquiring a component identifier and an identifier of a cluster to which the component belongs according to a calling request of the component;
step S302: acquiring a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the identifier of the cluster;
step S303: and returning the simulation test data according to the test data rule of the component and the test trigger rule of the cluster.
When a calling request of the component is received, the component information and the cluster information to which the component information belongs can be acquired, so that the dynamic simulation test of the on-line cluster can be realized by configuring the simulation test of the component according to the cluster, the cluster which is subjected to the dynamic simulation test every time is set according to the requirement, and the influence of simulation test data on the flow of the on-line cluster is controlled.
After the component identification and the cluster identification are obtained, the test data rule of the component and the test trigger rule of the cluster can be obtained, whether the simulation test is needed or not is judged according to the test trigger rule of the cluster, and the return result of the simulation test is determined according to the test data rule of the component.
According to an embodiment of the present invention, in step S302, when obtaining the test data rule of the component and the test trigger rule of the cluster according to the component identifier and the identifier of the cluster, specifically, the test data rule of the component and the test trigger rule of the cluster may be: firstly, acquiring a test data rule of a component positioned in a cluster according to a component identifier and a cluster identifier; and then, if the test data rule of the component is obtained, obtaining the test trigger rule of the cluster according to the identification of the cluster, and otherwise, calling the component normally.
When determining whether the simulation test is needed or not and determining the return result of the simulation test according to the rule, the test trigger rule of the cluster may be obtained first and then the test data rule of the component may be obtained, the test data rule of the component may be obtained first and then the test trigger rule of the cluster may be obtained, and the two rules may be obtained simultaneously.
According to an embodiment of the present invention, when the rule is determined, it may be determined whether the component has already been configured with the test data rule, and if so, it is further determined whether the cluster has already been configured with the test trigger rule; otherwise, if the test trigger rule is not configured, it is not necessary to judge whether the cluster is configured with the test trigger rule, because even if the cluster is configured with the test trigger rule, if the component is not configured with the test data rule, the simulation test data of the component still cannot be returned, and the component still needs to be normally called and a calling result is returned. Therefore, the embodiment of the invention can simplify the judging and searching processes of the system, save system resources and improve the efficiency of the simulation test by acquiring the test data rule of the component and then acquiring the test trigger rule of the cluster.
According to another embodiment of the present invention, the step S103, when executed, may include:
sequentially acquiring each test trigger rule of the cluster, and judging whether the calling request meets any test trigger rule;
if any test trigger rule is met, generating simulation test data according to the test data rule of the component and returning, otherwise, normally calling the component and returning a calling result.
When the test trigger rule configuration of the cluster is carried out, at least one test trigger rule can be set according to needs, and different priorities are set for each test trigger rule. Moreover, the format of the test trigger rule is also more flexible, and is not limited to the mock identifier included in the call request parameter in the prior art, and the test trigger rule may also be set according to the field value of any field in the call request, for example: and performing matching or comparison operation according to the field value of a certain field in the trigger request, or setting a certain simulation test proportion according to the field value code of a certain field in the trigger request, and the like. The control right of whether the simulation test needs to be performed can be handed over to the server side by configuring the test trigger rule, and a refined control strategy is provided, for example, a backup cluster can be configured to perform a mock test, or the mock test can be performed only at the request of a certain user. A plurality of rules can be configured, matching is carried out according to priority, and if any rule is matched, the component mock test is considered to be required. It should be noted that each request corresponds to a trigger decision for testing the trigger rule.
According to one embodiment of the invention, the test trigger rules of a cluster and their execution logic are, for example, as follows:
1) analyzing the field value from the calling request according to the percentage value field in the configured test triggering rule, performing hash code (Hash code) processing on the field value, then taking the remainder of the field value from 100, judging whether the percentage configuration is lower than the percentage configuration in the test triggering rule, if the percentage configuration is lower than the percentage configuration, indicating that the percentage is not up to the ratio, and executing the next rule;
2) otherwise, if the percentage configuration is higher than the percentage configuration, judging whether specified condition configuration exists, if so, judging whether the user identification is equal to a certain value. If the specified condition configuration does not exist, the triggering percentage is met, the testing triggering rule is met, and the next step of the simulation test is judged to be triggered;
3) if the specified condition configuration exists, the field value of the configuration field is dynamically analyzed, and the field value is judged to be equal to the configured field value or in the configured field value set. If the condition is not equal to or not indicated in the set, or else, the condition is indicated to be matched, and the next step judgment of the simulation test is triggered if the test triggering rule is satisfied;
4) and judging whether the specified condition matching result needs to be negated, if not, indicating that the condition mismatching does not meet the test triggering rule, otherwise, meeting the test triggering rule. If negation is required, the condition mismatch indicates that the test trigger rule is satisfied, otherwise, the test trigger rule is not satisfied.
FIG. 4 is a flow diagram of a component simulation test according to an embodiment of the present invention. As shown in fig. 4, when a component calling request is received, a component is started to be called, and first, a component identifier and a cluster identifier to which the component belongs are obtained. Then, judging whether the component of the cluster is configured with a component test data rule or not, if not, calling the component normally, otherwise, judging whether the cluster is configured with a cluster test trigger rule or not; if not, the component is normally called, otherwise, all the test trigger rules are traversed, and whether the component calling request meets any test trigger rule is judged; if not, the component is normally called, otherwise, the simulation test data of the component is obtained according to the component test data rule. And finally, returning the calling result of the component and ending the component calling.
According to yet another embodiment of the invention, the test data rules of the components are configured as a tree structure. Configuring test data rules through a tree structure may simplify configuration and may make rule configuration more hierarchical and organized.
FIG. 5 is a diagram of a component test data rule tree structure, according to one embodiment of the present invention. As shown in FIG. 5, which shows a tree of test data rules configured for YY components of the XX cluster, either rules or component results may be added in stages from the uppermost root node, according to the priority order of the test data rules. And when the rule tree is executed, executing the rule tree downwards in sequence according to the priority order of the rule until a matched component result is found and returned. For example, in fig. 5, if rule 1 is satisfied, then further rule 1.1 is executed; if the rule 1.1 is met, the execution is not continued, and the result of the 1.1 component is returned; otherwise, rule 1.2 is executed, and if rule 1.2 is satisfied, the 1.2 component result is returned and execution is not continued. If rule 1 is not satisfied, then rule 2 is executed … … until a component result node is found for return, and if all rules have been executed and no component result is found, then a null is returned.
According to the technical scheme of the embodiment of the invention, the execution of the rule (including the test data rule of the component and the test trigger rule of the cluster) supports comparison operation and/or regular matching, wherein the comparison operation refers to judging whether the rule is satisfied or not by configuring that a certain field value in the trigger request is greater than, equal to, less than or contains a certain fixed configuration (for example, the value of a user name field in the trigger request is equal to 'Mingming'); regular matching refers to determining whether a rule is satisfied by matching a certain field value in a configuration invocation request with a certain fixed regular expression. Here, field value acquisition in the protocol also supports dynamic parsing (supporting xxx.
The "xxx.xxx.xxx configuration" is a visual representation of a certain field of the composite data. The calling request of the component is composite data, and the field configuration is represented by using a general JSON (JavaScript Object Notation) data string (the content of a { } package expresses a JSON string which is composed of a plurality of key-value key value pairs, and the value can also be a JSON string). For example, the following JSON string named message:
Figure BDA0002087169510000101
in the above example, the correspondence of the fields and the field values includes: message.id 123, message.body.type text, message.body.chatinfo.userpin, finger. If the user knows a certain hierarchical relationship of the fields, flexible configuration can be performed as required. The method is the most intuitive and concise method in field value expression and is easy to understand and configure.
FIG. 6 is a schematic diagram of the main blocks of a device for simulation testing according to an embodiment of the present invention. As shown in fig. 6, the apparatus 600 for simulation test according to the embodiment of the present invention mainly includes an identifier obtaining module 601, a rule obtaining module 602, and a data returning module 603.
An identifier obtaining module 601, configured to obtain, according to a call request of a component, a component identifier and an identifier of a cluster to which the component belongs;
a rule obtaining module 602, configured to obtain, according to the component identifier and the cluster identifier, a test data rule of the component and a test trigger rule of the cluster;
and a data returning module 603, configured to return simulation test data according to the test data rule of the component and the test trigger rule of the cluster.
According to an embodiment of the present invention, the rule obtaining module 602 may further be configured to:
acquiring a test data rule of the component positioned in the cluster according to the component identifier and the cluster identifier;
and if the test data rule of the component is obtained, obtaining the test trigger rule of the cluster according to the identification of the cluster, otherwise, normally calling the component.
According to another embodiment of the present invention, the data returning module 603 may further be configured to:
sequentially acquiring each test trigger rule of the cluster, and judging whether the calling request meets any test trigger rule;
if any test trigger rule is met, generating simulation test data according to the test data rule of the component and returning, otherwise, normally calling the component and returning a calling result.
According to yet another embodiment of the invention, there is not less than one test trigger rule of the cluster, and each test trigger rule has a different priority. Thus, when judging whether any test trigger rule is satisfied, the judgment can be sequentially executed according to the set priority, and the judgment can be realized according to the importance degree of the test trigger rule.
According to an embodiment of the invention, the test data rules of the components and the test trigger rules of the clusters support comparison operations and/or regular matching.
According to one embodiment of the invention, the test data rules of a component are configured as a tree structure. Configuring test data rules through a tree structure may simplify configuration and may make rule configuration more hierarchical and organized.
According to the technical scheme of the embodiment of the invention, the identification of the component and the identification of the cluster to which the component belongs are obtained according to the calling request of the component; then, acquiring a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the identifier of the cluster; the simulation test data are returned according to the test data rule of the component and the test trigger rule of the cluster, the static simulation test process of the component is dynamic, the dynamic simulation test of the on-line cluster can be realized by configuring the simulation test of the component according to the cluster, the cluster which is subjected to the dynamic simulation test each time is set according to the requirement, and the influence of the simulation test data on the flow of the on-line cluster is controlled; by configuring the test trigger rule of the cluster, the trigger scene of the test is refined, the simulation test process of the component is further controlled in a specified request, and the controllability of the simulation test process of the component is improved; by configuring the test data rule of the component, the same component in the same cluster provides different component simulation test data in different scenes, so that the simulation test process of the component is completely dynamic and personalized, and the dynamic simulation test of the component in a full scene is supported.
Fig. 7 illustrates an exemplary system architecture 700 to which the method of simulation testing or the apparatus of simulation testing of embodiments of the present invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. The terminal devices 701, 702, 703 may have installed thereon various communication client applications, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only).
The terminal devices 701, 702, 703 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 705 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 701, 702, 703. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for simulating a test provided by the embodiment of the present invention is generally executed by the server 705, and accordingly, the apparatus for simulating a test is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use with a terminal device or server implementing an embodiment of the present invention. The terminal device or the server shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present invention may be implemented by software, or may be implemented by hardware. The described units or modules may also be provided in a processor, and may be described as: a processor includes an identity acquisition module, a rule acquisition module, and a data return module. The names of these units or modules do not in some cases form a limitation to the units or modules themselves, and for example, the identifier obtaining module may also be described as a "module for obtaining the identifier of the component and the identifier of the cluster to which the component belongs according to the call request of the component".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: acquiring a component identifier and an identifier of a cluster to which the component belongs according to a calling request of the component; acquiring a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the cluster identifier; and returning simulation test data according to the test data rule of the component and the test trigger rule of the cluster.
According to the technical scheme of the embodiment of the invention, the identification of the component and the identification of the cluster to which the component belongs are obtained according to the calling request of the component; then, acquiring a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the identifier of the cluster; the simulation test data are returned according to the test data rule of the component and the test trigger rule of the cluster, the static simulation test process of the component is dynamic, the dynamic simulation test of the on-line cluster can be realized by configuring the simulation test of the component according to the cluster, the cluster which is subjected to the dynamic simulation test each time is set according to the requirement, and the influence of the simulation test data on the flow of the on-line cluster is controlled; by configuring the test trigger rule of the cluster, the trigger scene of the test is refined, the simulation test process of the component is further controlled in a specified request, and the controllability of the simulation test process of the component is improved; by configuring the test data rule of the component, the same component in the same cluster provides different component simulation test data in different scenes, so that the simulation test process of the component is completely dynamic and personalized, and the dynamic simulation test of the component in a full scene is supported.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A method of simulating a test, comprising:
acquiring a component identifier and an identifier of a cluster to which the component belongs according to a calling request of the component;
acquiring a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the cluster identifier;
and returning simulation test data according to the test data rule of the component and the test trigger rule of the cluster.
2. The method of claim 1, wherein obtaining the test data rule of the component and the test trigger rule of the cluster according to the component identifier and the cluster identifier comprises:
acquiring a test data rule of the component positioned in the cluster according to the component identifier and the cluster identifier;
and if the test data rule of the component is obtained, obtaining the test trigger rule of the cluster according to the identification of the cluster, otherwise, normally calling the component.
3. The method of claim 1 or 2, wherein returning simulated test data according to the test data rules for the component and the test trigger rules for the cluster comprises:
sequentially acquiring each test trigger rule of the cluster, and judging whether the calling request meets any test trigger rule;
if any test trigger rule is met, generating simulation test data according to the test data rule of the component and returning, otherwise, normally calling the component and returning a calling result.
4. The method of claim 1, wherein there is not less than one test trigger rule for the cluster, and wherein each test trigger rule has a different priority.
5. The method of claim 1, wherein the test data rules of the component and the test trigger rules of the cluster support comparison operations and/or canonical matching.
6. The method of claim 1, wherein the test data rules for the components are configured as a tree structure.
7. An apparatus for simulating a test, comprising:
the identification acquisition module is used for acquiring the identification of the component and the identification of the cluster to which the component belongs according to the calling request of the component;
the rule obtaining module is used for obtaining a test data rule of the component and a test trigger rule of the cluster according to the component identifier and the cluster identifier;
and the data return module is used for returning simulation test data according to the test data rule of the component and the test trigger rule of the cluster.
8. The apparatus of claim 7, wherein the rule acquisition module is further configured to:
acquiring a test data rule of the component positioned in the cluster according to the component identifier and the cluster identifier;
and if the test data rule of the component is obtained, obtaining the test trigger rule of the cluster according to the identification of the cluster, otherwise, normally calling the component.
9. An electronic device for simulation testing, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
10. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN201910491441.9A 2019-06-06 2019-06-06 Simulation test method and device Pending CN112052152A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910491441.9A CN112052152A (en) 2019-06-06 2019-06-06 Simulation test method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910491441.9A CN112052152A (en) 2019-06-06 2019-06-06 Simulation test method and device

Publications (1)

Publication Number Publication Date
CN112052152A true CN112052152A (en) 2020-12-08

Family

ID=73609228

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910491441.9A Pending CN112052152A (en) 2019-06-06 2019-06-06 Simulation test method and device

Country Status (1)

Country Link
CN (1) CN112052152A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113177000A (en) * 2021-05-21 2021-07-27 拉扎斯网络科技(上海)有限公司 Order scheduling system testing method and device, storage medium and computer equipment
CN113806214A (en) * 2021-02-10 2021-12-17 京东科技控股股份有限公司 Application program testing method and device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806214A (en) * 2021-02-10 2021-12-17 京东科技控股股份有限公司 Application program testing method and device, computer equipment and storage medium
CN113177000A (en) * 2021-05-21 2021-07-27 拉扎斯网络科技(上海)有限公司 Order scheduling system testing method and device, storage medium and computer equipment

Similar Documents

Publication Publication Date Title
WO2021023149A1 (en) Method and apparatus for dynamically returning message
CN109901987B (en) Method and device for generating test data
CN109873863B (en) Asynchronous calling method and device of service
CN112052152A (en) Simulation test method and device
CN114389969A (en) Client test method and device, electronic equipment and storage medium
CN108959294B (en) Method and device for accessing search engine
CN110851343A (en) Test method and device based on decision tree
CN110109912A (en) A kind of identifier generation method and device
CN111382953A (en) Dynamic process generation method and device
CN113691403B (en) Topology node configuration method, related device and computer program product
CN113590447B (en) Buried point processing method and device
CN111026629A (en) Method and device for automatically generating test script
CN113282489B (en) Interface testing method and device
CN113726885A (en) Method and device for adjusting flow quota
CN111131354B (en) Method and apparatus for generating information
CN113448652A (en) Request processing method and device
CN113760487A (en) Service processing method and device
CN113779018A (en) Data processing method and device
CN112131095A (en) Pressure testing method and device
CN112527802B (en) Soft link method and device based on key value database
CN110084710A (en) Determine the method and device of message subject
CN113535167A (en) Method, device, electronic equipment and computer readable medium for processing list page
CN117149633A (en) Script processing method, script processing device, electronic equipment and storage medium
CN114840372A (en) Interface testing method and device, electronic equipment and computer readable storage medium
CN113297087A (en) Test method and device

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