CN118227466A - Automatic testing system and method for end-to-end service - Google Patents

Automatic testing system and method for end-to-end service Download PDF

Info

Publication number
CN118227466A
CN118227466A CN202410194092.5A CN202410194092A CN118227466A CN 118227466 A CN118227466 A CN 118227466A CN 202410194092 A CN202410194092 A CN 202410194092A CN 118227466 A CN118227466 A CN 118227466A
Authority
CN
China
Prior art keywords
service
message
test
module
sends
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
CN202410194092.5A
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.)
Shenzhen Hexun Huagu Information Technology Co ltd
Original Assignee
Shenzhen Hexun Huagu 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 Shenzhen Hexun Huagu Information Technology Co ltd filed Critical Shenzhen Hexun Huagu Information Technology Co ltd
Priority to CN202410194092.5A priority Critical patent/CN118227466A/en
Publication of CN118227466A publication Critical patent/CN118227466A/en
Pending legal-status Critical Current

Links

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/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

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

Abstract

The invention relates to the technical field of automatic testing, and discloses an automatic testing system and method for end-to-end service. The automated test system comprises: the service test module is used for executing an automation use case of the end-to-end service based on a data driving mode, and calling a message pushing interface of the inlet end to send a message in the execution process of the automation use case; the first service module is used for receiving an interaction instruction of the service test module in the execution process of the automatic use case, and simulating interaction between the terminal SDK and the first outlet end according to the interaction instruction; simulating the received message and storing the message in Redis; the second service module is used for simulating the received message and storing the message into the Redis; the service test module is also used for checking the message and the message life cycle stored in the Redis and generating an automatic test report. According to the invention, the test code quantity is reduced, the implementation complexity of automatic test is reduced, and the overall test efficiency is further improved in a data driving mode.

Description

Automatic testing system and method for end-to-end service
Technical Field
The invention relates to the technical field of automatic testing, in particular to an automatic testing system and method for end-to-end service.
Background
Automated testing generally refers to the automation of software testing, a process that converts human-driven testing behavior into machine execution. Typically, after the test cases are designed and passed through the review, the test is performed step by the tester according to the procedure described in the test cases, resulting in a comparison of the actual results with the expected results. In the process, in order to save manpower, time or hardware resources and improve the test efficiency, the concept of automatic test is introduced.
In the existing end-to-end automated regression testing, research and development enterprises must pay more effort and cost to ensure product quality and provide reliable products to users. The testers spend a great deal of time for deploying the test environment, including deploying the required operating system, configuring the target test software and the third party software, writing complex automated test cases and the like, and further greatly improving the complexity of implementing the automated test project codes. While some existing testing techniques have automated one or more of these tasks, the automated tasks are isolated from each other and decoupled from each other. The tester must wait for the completion of the preceding task before preparing and executing the subsequent task. In this mode of operation, a significant amount of time is wasted by the tester waiting for each task engagement stage, thereby reducing the efficiency of testing the entire project end-to-end service project.
Disclosure of Invention
The invention mainly aims to solve the technical problems of high complexity and low testing efficiency of the existing end-to-end service automatic testing codes.
The first aspect of the present invention provides an automated testing system for an end-to-end service, the end-to-end service including an ingress port for message pushing and a plurality of egress ports, the egress ports including a first egress port and a second egress port, the first egress port corresponding to a first message pushing channel and the second egress port corresponding to a second message pushing channel, the automated testing system comprising:
the service test module is used for executing an automation use case of the end-to-end service based on a data driving mode, calling a message pushing interface of the inlet end in the execution process of the automation use case, and sending a message through the first message pushing channel or the second message pushing channel;
The first service module is used for receiving an interaction instruction of the service test module in the execution process of the automatic use case, and simulating interaction between the terminal SDK and the first outlet end according to the interaction instruction; simulating to receive the message of the first message pushing channel and storing the received message into Redis;
the second service module is used for simulating and receiving the information of the second information push channel and storing all the received information into Redis;
The service test module is further configured to verify the message and the message life cycle of the first message push channel or the second message push channel stored in the Redis, and generate a corresponding automation test report after all the automation use cases are executed.
Optionally, in a first implementation manner of the first aspect of the present invention, the service testing module is specifically configured to:
Running an entry program of an end-to-end service project, and starting an execution program of an end-to-end service automation test through the entry program;
Searching an automation case template under a corresponding directory of the end-to-end service item through the execution program, reading all test data from a csv file under a specified directory, and parameterizing and transmitting the test data to the automation case template;
and running the automatic use case template through the execution program and circularly executing all test data to execute different steps according to the test data and make corresponding operation responses, wherein the operation responses are used for simulating interaction between a terminal SDK and the first outlet end and calling a message pushing interface of the inlet end to send messages so as to realize various test scenes of message pushing.
Optionally, in a second implementation manner of the first aspect of the present invention, the test scenario includes a first test scenario, a second test scenario, and a third test scenario;
The implementation process of the first test scene comprises the following steps: the service test module establishes socket communication with the first outlet end and sends a registration command to the first outlet end to obtain a first user number; the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on the first user number and sends a logic command to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the first user number is successfully logged in so as to keep the first user number in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to the first user number through the first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the second test scene comprises the following steps: the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on a second user number and sends a logic command to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the second user number is successfully logged in so as to enable the second user number to be kept in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to the second user number through the first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the third test scene comprises the following steps: the service test module sends a logout instruction to the first service module, and after receiving the logout instruction, the first service module establishes short connection with the first outlet end and sends logout a command to the first outlet end based on a third user number so as to enable the third user number to be in an offline state; the service test module calls a message pushing interface of the inlet end and sends a message to the third user number through the first message pushing channel; the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on the third user number and sends a logic command to the first outlet end after the long connection is established; and the first service module sends a heartbeat command to the first outlet end at intervals of set time after the third user number is successfully logged in so as to keep the third user number in an online state until all the automatic use cases are executed.
Optionally, in a third implementation manner of the first aspect of the present invention, the service testing module is further configured to:
And running the first service module and the second service module on a test server, and configuring port parameters of an automation case of the end-to-end service, wherein the port parameters comprise an IP port of a Redis and an IP port of the first service module.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the end-to-end service further includes: a distributing end for message pushing;
The distribution terminal is used for determining a pushing strategy of the message to be sent according to the type of the message to be sent when receiving the message sent by the message pushing interface of the inlet terminal, wherein the pushing strategy comprises the step of sending the message through the first message pushing channel or the step of sending the message through the second message pushing channel.
A second aspect of the present invention provides an automated testing method for an end-to-end service, applied to the automated testing system for an end-to-end service described in any one of the foregoing, where the end-to-end service includes an ingress port for message pushing and a plurality of egress ports, the egress ports include a first egress port and a second egress port, the first egress port corresponds to a first message pushing channel, and the second egress port corresponds to a second message pushing channel, and the automated testing method includes:
The service test module executes an automation use case of the end-to-end service based on a data driving mode, and calls a message pushing interface of the inlet end in the execution process of the automation use case, and sends a message through the first message pushing channel or the second message pushing channel;
The method comprises the steps that a first service module receives an interaction instruction of a service test module in the execution process of an automatic use case, and a simulation terminal SDK interacts with a first outlet end according to the interaction instruction;
when a message exists in the first message pushing channel, a first service module simulates and receives the message of the first message pushing channel and stores all the received messages into a Redis;
When the message exists in the second message pushing channel, the second service module simulates and receives the message of the second message pushing channel and stores the received message into Redis;
the service test module checks the message and the message life cycle of the first message pushing channel or the second message pushing channel stored in the Redis, and generates a corresponding automatic test report after all the automatic use cases are executed.
Optionally, in a first implementation manner of the second aspect of the present invention, the automated testing method further includes:
In the execution process of the automation use case, the service test module runs an entry program of an end-to-end service project and starts an execution program of the end-to-end service automation test through the entry program;
Searching an automation case template under a corresponding directory of the end-to-end service item through the execution program, reading all test data from a csv file under a specified directory, and parameterizing and transmitting the test data to the automation case template;
and running the automatic use case template through the execution program and circularly executing all test data to execute different steps according to the test data and make corresponding operation responses, wherein the operation responses are used for simulating interaction between a terminal SDK and the first outlet end and calling a message pushing interface of the inlet end to send messages so as to realize various test scenes of message pushing.
Optionally, in a second implementation manner of the second aspect of the present invention, the test scenario includes a first test scenario, a second test scenario, and a third test scenario;
The implementation process of the first test scene comprises the following steps: the service test module establishes socket communication with the first outlet end and sends a registration command to the first outlet end to obtain a first user number; the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on the first user number and sends a logic command to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the first user number is successfully logged in so as to keep the first user number in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to the first user number through the first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the second test scene comprises the following steps: the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on a second user number and sends a logic command to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the second user number is successfully logged in so as to enable the second user number to be kept in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to the second user number through the first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the third test scene comprises the following steps: the service test module sends a logout instruction to the first service module, and after receiving the logout instruction, the first service module establishes short connection with the first outlet end and sends logout a command to the first outlet end based on a third user number so as to enable the third user number to be in an offline state; the service test module calls a message pushing interface of the inlet end and sends a message to the third user number through the first message pushing channel; the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on the third user number and sends a logic command to the first outlet end after the long connection is established; and the first service module sends a heartbeat command to the first outlet end at intervals of set time after the third user number is successfully logged in so as to keep the third user number in an online state until all the automatic use cases are executed.
Optionally, in a third implementation manner of the second aspect of the present invention, the automated testing method further includes:
Before executing the automation use case of the end-to-end service, the service test module runs the first service module and the second service module on a test server, and configures port parameters of the automation use case of the end-to-end service, wherein the port parameters comprise an IP port of Redis and an IP port of the first service module.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the end-to-end service further includes: the automatic test method further comprises the following steps of:
When receiving the message sent by the message pushing interface of the inlet end, the distribution end determines a pushing strategy of the message to be sent according to the type of the message to be sent, wherein the pushing strategy comprises the step of sending the message through the first message pushing channel or the step of sending the message through the second message pushing channel.
In the technical scheme provided by the invention, the end-to-end service comprises an inlet end for message pushing and a plurality of outlet ends, wherein the outlet ends comprise a first outlet end and a second outlet end, the first outlet end corresponds to a first message pushing channel, and the second outlet end corresponds to a second message pushing channel. The service test module executes the automatic use cases of the end-to-end service based on the data driving mode, reduces the actual writing time of the use cases, reduces the test code amount, and further reduces the implementation complexity of the automatic test of the end-to-end service project. In the execution process of the automatic use case, the first service module receives an interaction instruction of the service test module, and according to the interaction instruction, the simulation terminal SDK interacts with the first outlet end, so that various test scenes can be simulated, and the test efficiency is improved. In addition, the first service module and the second service module simulate and receive the message and store the received message into the Redis, so that the service test module can verify the message and the message life cycle of the first message pushing channel or the second message pushing channel stored in the Redis, and generate a corresponding automatic test report after all the automatic use cases are executed. The automatic test system not only comprises execution of the test case, but also comprises verification of the test result and output of the test report, so that the overall test efficiency is improved.
Drawings
FIG. 1 is a schematic diagram of an embodiment of an end-to-end service according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an embodiment of an end-to-end service automation test system according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an embodiment of an end-to-end service automation test method according to the present invention.
Detailed Description
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, fig. 1 is a schematic diagram of an end-to-end service according to an embodiment of the invention.
The end-to-end test is a software test method that verifies the entire software and its integration with external interfaces from beginning to end. The purpose of end-to-end testing is to test the overall software for dependencies, data integrity, and communication with other systems, interfaces, databases, etc., to simulate a complete production scenario. The object of the end-to-end test is the end-to-end service of the present embodiment.
In this embodiment, the end-to-end service is preferably a message push background service corresponding to the system to be tested, where the message push background service is used to implement a message push service between different terminals. For example, terminal a invokes an end-to-end service to send a message to terminal B, which may also invoke an end-to-end service to send a message to terminal a.
In this embodiment, the end-to-end service includes one ingress port 10 for message pushing and a plurality of egress ports, where the egress ports include a first egress port 201 and a second egress port 202, the first egress port 201 corresponds to a first message pushing channel, and the second egress port 202 corresponds to a second message pushing channel. The message types pushed by different message pushing channels are different. An end-to-end message pushing service is realized through one inlet end and a plurality of outlet ends of message pushing. It should be noted that, the number of the outlets in this embodiment may be 2 or greater than 2, so that the messages to be pushed may be classified more finely.
In an embodiment, the end-to-end service further comprises: a distributing end 203 for message pushing;
The distributing terminal 203 is configured to determine, when receiving a message sent by the message pushing interface of the ingress terminal, a pushing policy of the message to be sent according to a type of the message to be sent, where the pushing policy includes sending the message through a first message pushing channel or sending the message through a second message pushing channel.
For example, the message sent by the first message pushing channel corresponding to the first outlet 201 includes: notification messages, custom messages, in-application messages, etc., and messages sent through the second message push channel corresponding to the second egress port 202 include: notification message, custom message. After receiving the message sent by the ingress port 10, the distribution port 203 determines a pushing policy of the message to be sent, and according to the pushing policy, a pushing channel of the message may be determined. For example, the push policy determination is made based on fields in the message.
The invention is mainly used for realizing the automatic test of the end-to-end service, which is used for sending the message from the inlet end, and then checking the message sent after the conversion of the receiving outlet end, thereby verifying whether the processing of the whole message flow accords with the expectations. For example, a notification message is sent to a certain terminal by calling a message push interface of the ingress port 10, and the designated push policy is that the message goes through the first message push channel, and at this time, the SDK (Software Development Kit ) of the analog terminal is required to receive the message sent by the first egress port 201 to check the correctness of the egress message and whether the message life cycle in the complete torsion process (such as ingress port 10- > distribution port 203, distribution port 203- > first egress port 201) of each module of the end-to-end service of the message is correct. For example, a notification message is sent to a terminal by calling a message pushing interface of the ingress port 10, and the designated pushing policy is that the message goes through the second message pushing channel, and at this time, a simulation message pushing service is required to receive the message sent by the second egress port 202 to check the correctness of the egress message and whether the message life cycle of the message in each module twisting process (such as ingress port 10- > distribution port 203 and distribution port 203- > second egress port 202) of the end-to-end service is correct.
Referring to fig. 2, fig. 2 is an embodiment of an automated testing system for end-to-end services according to an embodiment of the present invention. For automatic testing of peer-to-peer services, an automatic testing system is introduced in this embodiment, and the system specifically includes:
The service test module 301 is configured to execute an automation use case of an end-to-end service based on a data driving manner, and call a message pushing interface of an inlet end in an execution process of the automation use case, and send a message through a first message pushing channel or a second message pushing channel;
In this embodiment, the service test module 301 executes an automation case of an end-to-end service based on a data driving method. The data-driven test method is a test method based on test data. The core idea is to represent different test scenarios by designing a reasonable set of test data so as to comprehensively and effectively test various functions and performances of tested software. The core idea is to separate the test data and the test logic, and execute the same test case by different test data, thereby achieving the purposes of expanding the test coverage, improving the test efficiency and reducing the test cost, and improving the maintainability and the expandability of the test. The test data is stored in an external file or database, and the test script performs the test by reading the data, so that a tester can modify the test data at any time as required without modifying the test script. Meanwhile, the tester can cover more test scenes by adding or modifying test data, so that the coverage rate of the test is improved.
In this embodiment, the service test module 301 is preferably implemented by using pytest framework, and is responsible for the execution and data verification of the automation use case of the end-to-end service in the automation test system. Wherein, the directory hierarchy of the end-to-end service item includes: case directory (store test data and automation case templates), conf directory (environment related configuration such as appkey, user number uid, message push interface address, clickhouse address, redis address, etc.), lib directory (store function methods such as message push, data check, register, log in, log out, read csv file and parameterize data, etc.), report directory (store test report), run_interface. Py directory (entry of program for executing pytest. Main execution program and generating test report). clickhouse is a columnar database management system for online analysis, and Redis is a key-value storage system.
In an embodiment, before starting the test, the service test module 301 is further configured to: the first service module and the second service module are run on the test server, and port parameters of the automation use case of the end-to-end service are configured, where the port parameters include an IP port of the Redis and an IP port of the first service module 302 (for performing socket communication).
In one embodiment, the service test module 301 is specifically configured to:
(1) Running a portal program (run_interface. Py) of the end-to-end service item, and starting an execution program (pytest. Main) of the end-to-end service automation test through the portal program;
(2) By executing the program, searching an automation case template under the corresponding directory of the end-to-end service item, reading all test data from the csv file under the specified directory, and parameterizing and transmitting the test data to the automation case template;
in this embodiment, in order to reduce the complexity of the automation project implementation, the code amount is reduced by data driving by templating the automation case steps and extracting the test data and the expected result from the file in csv format (command-SEPARATED VALUES, character separation value). An automation case is a series of steps that are performed in a particular order to verify the correctness of the software, which automatically performs a series of test tasks and generates reports using the automation test scripts and test cases.
(3) And running an automatic use case template and circularly executing all test data by executing a program so as to execute different steps according to the test data and make corresponding operation responses, wherein the operation responses are used for simulating interaction between the terminal SDK and the first outlet end and calling a message pushing interface of the inlet end to send messages so as to realize various test scenes of message pushing.
In this embodiment, the service test module first runs run_interface.py of the end-to-end service item, after the program to be executed runs, finds out all test cases at the beginning of test_in the case directory, and executes the test cases, because the test cases all adopt parameterization setting, the execution program obtains test data sets in csv files in all specified directories through calling GETCSVDATA methods and uses the test data sets as assignment of parameters in parameterization (i.e., test data), the assigned automation cases can circularly execute all test data, and meanwhile, the templatized test cases can make different operation responses according to different test data, such as registration, login, logout, message sending and the like, and finally, test result data is checked again. The embodiment realizes different service checks according to different data transmission values, and the service checks are put into codes so as to facilitate subsequent management.
The first service module 302 is configured to receive an interaction instruction of the service test module during an execution process of the automation use case, and simulate interaction between the terminal SDK and the first outlet according to the interaction instruction; simulating to receive the message of the first message pushing channel and storing the received message into Redis;
In this embodiment, in order to simulate testing scenarios such as online and offline of a user and realize receiving a message of a first message pushing channel for testing, a first service module 302 is introduced to realize receiving various commands sent by an automation use case and sending a registration sending command to an end-to-end service (message pushing background service) to realize online and offline operations of a user number uid, and receive a message of the first message pushing channel sent by a first outlet end 201 in the message pushing background service, store the message into a dis, and when the automation use case needs to check the message sent by the first message pushing channel, acquire a corresponding message from the dis for checking.
In this embodiment, the first service module 302 is preferably implemented by python, and is responsible for simulating interaction between the terminal SDK and the first outlet 201 to implement online and offline scenarios of the user, and receiving and storing the message sent by the first message push channel in the Redis.
A second service module 303, configured to simulate receiving a message of the second message push channel and store all received messages in the Redis;
In this embodiment, the second service module 303 is preferably implemented by using a python flash framework, and is responsible for simulating a message sent by the second egress port 202 through the second message push channel in the receiving end-to-end service and storing the received message in the Redis.
In order to check the accuracy of the data of the message sent by the second message pushing channel, the second service module 303 is introduced to receive the message sent by the second message pushing channel and store the message in the dis, and when the automation use case needs to check the message, the data is acquired from the dis to check.
The service test module 301 is further configured to verify a message and a message life cycle of the first message push channel or the second message push channel stored in the Redis, and generate a corresponding automated test report after all the automated use cases are executed.
In this embodiment, after all test data are executed by the automation use case, it is required to check whether the life cycle of the received messages passing through the first message pushing channel and the second message pushing channel of the end-to-end service is consistent with that of the expected message, and a corresponding automation test report is generated after all the execution of the automation use case is completed, so that the analysis by the testers is facilitated.
In one embodiment, the testing scenario of the end-to-end service includes:
(1) First test scene (register before login and re-message)
The implementation process of the first test scene comprises the following steps:
1.1, a service testing module establishes socket communication with a first outlet end, and sends a registration command to the first outlet end to obtain a first user number;
1.2, the service test module sends a login instruction to the first service module, after the first service module receives the login instruction, long connection is established with the first outlet end based on the first user number, and a logic command is sent to the first outlet end after the long connection is established;
1.3, the second service module sends a heartbeat command to the first outlet end at intervals of set time after the first user number is successfully logged in so as to keep the first user number in an online state;
1.4, the service test module calls a message pushing interface of the inlet end, and sends a message to a first user number through a first message pushing channel;
1.5, the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout a command to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
(2) Second test scenario (direct login post-message)
The implementation process of the second test scene comprises the following steps:
2.1, the service test module sends a login instruction to the first service module, after the first service module receives the login instruction, long connection is established with the first outlet end based on the second user number, and a logic command is sent to the first outlet end after the long connection is established;
2.2, the second service module sends a heartbeat command to the first outlet end at intervals of set time after the second user number is successfully logged in so as to keep the second user number in an online state;
2.3, the service test module calls a message pushing interface of the inlet end, and sends a message to the second user number through the first message pushing channel;
2.4, the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
(3) Third test scene (login after logout)
The implementation process of the third test scene comprises the following steps:
3.1, the service test module sends a logout instruction to the first service module, after the first service module receives the logout instruction, short connection is established with the first outlet end, and a logout command is sent to the first outlet end based on the third user number so that the third user number is in an offline state;
3.2, the service test module calls a message pushing interface of the inlet end, and sends a message to a third user number through a first message pushing channel;
3.3, the service testing module sends a login instruction to the first service module, after the first service module receives the login instruction, long connection is established with the first outlet end based on the third user number, and a logic command is sent to the first outlet end after the long connection is established;
And 3.4, after the third user number is successfully logged in, the first service module sends a heartbeat command to the first outlet end at intervals of set time intervals so as to keep the third user number in an online state until the automatic use case is completely executed.
In this embodiment, all test scenarios of the end-to-end service implement automation use cases of the end-to-end service by using a templatization and data driving manner, so as to reduce complexity of an automation code. The end-to-end service comprises an inlet end for pushing the message and a plurality of outlet ends, wherein the outlet ends comprise a first outlet end and a second outlet end, the first outlet end corresponds to a first message pushing channel, the second outlet end corresponds to a second message pushing channel, and in order to realize the automatic test of the end-to-end service, the automatic test system of the embodiment introduces a service test module, a first service module and a second service module. The service test module executes the automatic use cases of the end-to-end service based on the data driving mode, reduces the actual writing time of the use cases, reduces the test code amount, and further reduces the implementation complexity of the automatic test of the end-to-end service project. In the execution process of the automatic use case, the first service module receives an interaction instruction of the service test module, and according to the interaction instruction, the simulation terminal SDK interacts with the first outlet end, so that various test scenes can be simulated, and the test efficiency is improved. In addition, the first service module and the second service module simulate and receive the message and store the received message into the Redis, so that the service test module can verify the message and the message life cycle of the first message pushing channel or the second message pushing channel stored in the Redis, and generate a corresponding automatic test report after all the automatic use cases are executed. The automatic test system of the embodiment not only comprises execution of the test case, but also comprises verification of the test result and output of the test report, thereby improving the overall test efficiency.
Referring to fig. 3, fig. 3 is an embodiment of an automated testing method for end-to-end services according to an embodiment of the present invention. The automatic testing method for the end-to-end service of the embodiment is applied to the automatic testing system for the end-to-end service of any one of the embodiments.
In this embodiment, the method for automatically testing the end-to-end service includes:
S10, the service test module executes an automation use case of end-to-end service based on a data driving mode, and calls a message pushing interface of an inlet end in the execution process of the automation use case, and sends a message through a first message pushing channel or a second message pushing channel;
S20, the first service module receives an interaction instruction of the service test module in the execution process of the automatic use case, and simulates interaction between the terminal SDK and the first outlet end according to the interaction instruction;
S30, when a message exists in the first message pushing channel, the first service module simulates and receives the message of the first message pushing channel and stores all the received messages into the Redis; when the message exists in the second message pushing channel, the second service module simulates and receives the message of the second message pushing channel and stores the received message into Redis;
S40, the service test module checks the message and the message life cycle of the first message pushing channel or the second message pushing channel stored in the Redis, and generates a corresponding automatic test report after all the automatic use cases are executed.
In an alternative embodiment, the method for automatically testing an end-to-end service further comprises:
in the execution process of the automatic use case, the service test module runs an entry program of an end-to-end service item and starts an execution program of the end-to-end service automatic test through the entry program;
By executing the program, searching an automation case template under the corresponding directory of the end-to-end service item, reading all test data from the csv file under the specified directory, and parameterizing and transmitting the test data to the automation case template;
And running an automatic use case template and circularly executing all test data by executing a program so as to execute different steps according to the test data and make corresponding operation responses, wherein the operation responses are used for simulating interaction between the terminal SDK and the first outlet end and calling a message pushing interface of the inlet end to send messages so as to realize various test scenes of message pushing.
In an alternative embodiment, the test scenarios include a first test scenario, a second test scenario, and a third test scenario;
The implementation process of the first test scene comprises the following steps: the service test module establishes socket communication with the first outlet end and sends a registration command to the first outlet end to obtain a first user number; the service test module sends a login instruction to the first service module, and after the first service module receives the login instruction, a long connection is established with the first outlet end based on the first user number, and a logic command is sent to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the first user number is successfully logged in so as to keep the first user number in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to a first user number through a first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the second test scene comprises the following steps: the service test module sends a login instruction to the first service module, and after the first service module receives the login instruction, a long connection is established with the first outlet end based on the second user number, and a logic command is sent to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the second user number is successfully logged in so as to keep the second user number in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to the second user number through the first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the second test scene comprises the following steps: the service test module sends a logout instruction to the first service module, and after the first service module receives the logout instruction, short connection is established with the first outlet end, and a logout command is sent to the first outlet end based on the third user number so that the third user number is in an offline state; the service test module calls a message pushing interface of the inlet end and sends a message to a third user number through a first message pushing channel; the service test module sends a login instruction to the first service module, and after the first service module receives the login instruction, a long connection is established with the first outlet end based on a third user number, and a logic command is sent to the first outlet end after the long connection is established; and after the third user number is successfully logged in, the first service module sends a heartbeat command to the first outlet end at intervals of set time so as to keep the third user number in an online state until the automatic use case is completely executed.
In an alternative embodiment, the method for automatically testing an end-to-end service further comprises:
Before executing the automation use case of the end-to-end service, the service test module runs the first service module and the second service module on the test server, configures port parameters of the automation use case of the end-to-end service, and the port parameters comprise an IP port of Redis and an IP port of the first service module.
In an alternative embodiment, the end-to-end service further comprises: the automatic testing method for the distributed end and the end-to-end service of the message push further comprises the following steps:
When receiving a message sent by a message pushing interface of an inlet end, a distribution end determines a pushing strategy of the message to be sent according to the type of the message to be sent, wherein the pushing strategy comprises the step of sending the message through a first message pushing channel or sending the message through a second message pushing channel.
In this embodiment, after an execution program is started through a pytest.main command, the program finds a test case template at the beginning of test_first, then obtains data in all csv files through a GETCSVDATA method and parameterizes and transmits the data to the test case template, and then the test case template executes different test scenes according to steps in test data, such as registering before logging in, directly logging out, and then logging out, and the like, and simultaneously invokes a message push interface to send a message, and finally checks whether the life cycle of a received push channel message and a message is consistent with that of an expected message through reading a message stored in a Redis, and regenerates a test report after all the execution of the use cases is completed.
In the embodiment, the code quantity is reduced by templating the test case, and a large number of codes do not need to be rewritten in the subsequent new case. In addition, the embodiment reduces the actual writing time of the test cases in a data driving mode, reduces the debugging complexity, realizes different service checks according to different data transmission values, places the service checks in codes, and facilitates subsequent management.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (10)

1. An automated testing system for an end-to-end service, the end-to-end service comprising an ingress port for message pushing and a plurality of egress ports, the egress ports comprising a first egress port and a second egress port, the first egress port corresponding to a first message pushing channel and the second egress port corresponding to a second message pushing channel, the automated testing system comprising:
the service test module is used for executing an automation use case of the end-to-end service based on a data driving mode, calling a message pushing interface of the inlet end in the execution process of the automation use case, and sending a message through the first message pushing channel or the second message pushing channel;
The first service module is used for receiving an interaction instruction of the service test module in the execution process of the automatic use case, and simulating interaction between the terminal SDK and the first outlet end according to the interaction instruction; simulating to receive the message of the first message pushing channel and storing the received message into Redis;
the second service module is used for simulating and receiving the information of the second information push channel and storing all the received information into Redis;
The service test module is further configured to verify the message and the message life cycle of the first message push channel or the second message push channel stored in the Redis, and generate a corresponding automation test report after all the automation use cases are executed.
2. The automated testing system of end-to-end service of claim 1, wherein the service testing module is specifically configured to:
Running an entry program of an end-to-end service project, and starting an execution program of an end-to-end service automation test through the entry program;
Searching an automation case template under a corresponding directory of the end-to-end service item through the execution program, reading all test data from a csv file under a specified directory, and parameterizing and transmitting the test data to the automation case template;
and running the automatic use case template through the execution program and circularly executing all test data to execute different steps according to the test data and make corresponding operation responses, wherein the operation responses are used for simulating interaction between a terminal SDK and the first outlet end and calling a message pushing interface of the inlet end to send messages so as to realize various test scenes of message pushing.
3. The automated end-to-end service testing system of claim 2, wherein the test scenarios comprise a first test scenario, a second test scenario, and a third test scenario;
The implementation process of the first test scene comprises the following steps: the service test module establishes socket communication with the first outlet end and sends a registration command to the first outlet end to obtain a first user number; the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on the first user number and sends a logic command to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the first user number is successfully logged in so as to keep the first user number in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to the first user number through the first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the second test scene comprises the following steps: the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on a second user number and sends a logic command to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the second user number is successfully logged in so as to enable the second user number to be kept in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to the second user number through the first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the third test scene comprises the following steps: the service test module sends a logout instruction to the first service module, and after receiving the logout instruction, the first service module establishes short connection with the first outlet end and sends logout a command to the first outlet end based on a third user number so as to enable the third user number to be in an offline state; the service test module calls a message pushing interface of the inlet end and sends a message to the third user number through the first message pushing channel; the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on the third user number and sends a logic command to the first outlet end after the long connection is established; and the first service module sends a heartbeat command to the first outlet end at intervals of set time after the third user number is successfully logged in so as to keep the third user number in an online state until all the automatic use cases are executed.
4. The automated end-to-end service testing system of claim 1, wherein the service testing module is further configured to:
And running the first service module and the second service module on a test server, and configuring port parameters of an automation case of the end-to-end service, wherein the port parameters comprise an IP port of a Redis and an IP port of the first service module.
5. The automated testing system of an end-to-end service of claim 1, wherein the end-to-end service further comprises: a distributing end for message pushing;
The distribution terminal is used for determining a pushing strategy of the message to be sent according to the type of the message to be sent when receiving the message sent by the message pushing interface of the inlet terminal, wherein the pushing strategy comprises the step of sending the message through the first message pushing channel or the step of sending the message through the second message pushing channel.
6. An automated testing method for an end-to-end service, applied to the automated testing system for an end-to-end service of any one of claims 1-5, the end-to-end service comprising an ingress end for message pushing and a plurality of egress ends, the egress ends comprising a first egress end and a second egress end, the first egress end corresponding to a first message pushing channel and the second egress end corresponding to a second message pushing channel, the automated testing method comprising:
The service test module executes an automation use case of the end-to-end service based on a data driving mode, and calls a message pushing interface of the inlet end in the execution process of the automation use case, and sends a message through the first message pushing channel or the second message pushing channel;
The method comprises the steps that a first service module receives an interaction instruction of a service test module in the execution process of an automatic use case, and a simulation terminal SDK interacts with a first outlet end according to the interaction instruction;
when a message exists in the first message pushing channel, a first service module simulates and receives the message of the first message pushing channel and stores all the received messages into a Redis;
When the message exists in the second message pushing channel, the second service module simulates and receives the message of the second message pushing channel and stores the received message into Redis;
the service test module checks the message and the message life cycle of the first message pushing channel or the second message pushing channel stored in the Redis, and generates a corresponding automatic test report after all the automatic use cases are executed.
7. The automated testing method of end-to-end service of claim 6, further comprising:
In the execution process of the automation use case, the service test module runs an entry program of an end-to-end service project and starts an execution program of the end-to-end service automation test through the entry program;
Searching an automation case template under a corresponding directory of the end-to-end service item through the execution program, reading all test data from a csv file under a specified directory, and parameterizing and transmitting the test data to the automation case template;
and running the automatic use case template through the execution program and circularly executing all test data to execute different steps according to the test data and make corresponding operation responses, wherein the operation responses are used for simulating interaction between a terminal SDK and the first outlet end and calling a message pushing interface of the inlet end to send messages so as to realize various test scenes of message pushing.
8. The automated end-to-end service testing method of claim 7, wherein the test scenarios comprise a first test scenario, a second test scenario, and a third test scenario;
The implementation process of the first test scene comprises the following steps: the service test module establishes socket communication with the first outlet end and sends a registration command to the first outlet end to obtain a first user number; the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on the first user number and sends a logic command to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the first user number is successfully logged in so as to keep the first user number in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to the first user number through the first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the second test scene comprises the following steps: the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on a second user number and sends a logic command to the first outlet end after the long connection is established; the second service module sends a heartbeat command to the first outlet end at intervals of set time after the second user number is successfully logged in so as to enable the second user number to be kept in an online state; the service test module calls a message pushing interface of the inlet end and sends a message to the second user number through the first message pushing channel; the service test module sends a logout instruction to the first service module after the automatic use case is completely executed, and the first service module sends logout commands to the first outlet end and breaks long connection with the first outlet end after receiving the logout instruction;
The implementation process of the third test scene comprises the following steps: the service test module sends a logout instruction to the first service module, and after receiving the logout instruction, the first service module establishes short connection with the first outlet end and sends logout a command to the first outlet end based on a third user number so as to enable the third user number to be in an offline state; the service test module calls a message pushing interface of the inlet end and sends a message to the third user number through the first message pushing channel; the service test module sends a login instruction to the first service module, and after receiving the login instruction, the first service module establishes long connection with the first outlet end based on the third user number and sends a logic command to the first outlet end after the long connection is established; and the first service module sends a heartbeat command to the first outlet end at intervals of set time after the third user number is successfully logged in so as to keep the third user number in an online state until all the automatic use cases are executed.
9. The automated testing method of end-to-end service of claim 6, further comprising:
Before executing the automation use case of the end-to-end service, the service test module runs the first service module and the second service module on a test server, and configures port parameters of the automation use case of the end-to-end service, wherein the port parameters comprise an IP port of Redis and an IP port of the first service module.
10. The automated testing method of an end-to-end service of claim 6, wherein the end-to-end service further comprises: the automatic test method further comprises the following steps of:
When receiving the message sent by the message pushing interface of the inlet end, the distribution end determines a pushing strategy of the message to be sent according to the type of the message to be sent, wherein the pushing strategy comprises the step of sending the message through the first message pushing channel or the step of sending the message through the second message pushing channel.
CN202410194092.5A 2024-02-21 2024-02-21 Automatic testing system and method for end-to-end service Pending CN118227466A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410194092.5A CN118227466A (en) 2024-02-21 2024-02-21 Automatic testing system and method for end-to-end service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410194092.5A CN118227466A (en) 2024-02-21 2024-02-21 Automatic testing system and method for end-to-end service

Publications (1)

Publication Number Publication Date
CN118227466A true CN118227466A (en) 2024-06-21

Family

ID=91504848

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410194092.5A Pending CN118227466A (en) 2024-02-21 2024-02-21 Automatic testing system and method for end-to-end service

Country Status (1)

Country Link
CN (1) CN118227466A (en)

Similar Documents

Publication Publication Date Title
US11281570B2 (en) Software testing method, system, apparatus, device medium, and computer program product
CN111159049B (en) Automatic interface testing method and system
CN106095677B (en) The RESTful Webservice automatic interface testing methods realized based on Robot Framework
US8924933B2 (en) Method and system for automated testing of computer applications
US20040153837A1 (en) Automated testing
CN111124919A (en) User interface testing method, device, equipment and storage medium
CN112241360A (en) Test case generation method, device, equipment and storage medium
CN112631919B (en) Contrast test method, device, computer equipment and storage medium
CN110990289B (en) Method and device for automatically submitting bug, electronic equipment and storage medium
CN111459809A (en) Software testing method based on rapid demand version iteration
CN115914055A (en) Distributed network testing method, device, medium and equipment
US20050203717A1 (en) Automated testing system, method and program product using testing map
CN113434405A (en) Method and device for determining test file, storage medium and electronic device
CN117376225A (en) Communication test method and electronic equipment
CN117493188A (en) Interface testing method and device, electronic equipment and storage medium
CN111930625A (en) Log obtaining method, device and system based on cloud service platform
CN116431522A (en) Automatic test method and system for low-code object storage gateway
CN111444109A (en) Mobile terminal UI automatic testing method and system
CN118227466A (en) Automatic testing system and method for end-to-end service
CN115934559A (en) Testing method of intelligent form testing system
CN115685781A (en) Online simulation test method and device
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium
CN111813665A (en) Big data platform interface data testing method and system based on python
CN111444108A (en) Behavior audit automatic testing method based on S7 industrial protocol
CN113806222B (en) Interface test script generation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication