Automatic test method, device and equipment for communication system, storage medium and product
By creating test cases and extending the test engine, the problem of insufficient automation test efficiency and coverage of communication systems is solved, efficient and accurate automated testing is achieved, reducing the difficulty of writing automated test cases, and enhancing the flexibility and maintainability of testing sex.
Patent Information
- Application Number
- CN202411285839.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-09-13
AI Technical Summary
The prior art cannot quickly and accurately automate the communication system, especially in the case of high demand testing, and traditional manual testing methods are insufficient in efficiency and coverage.
By creating test cases, analyzing the communication protocol type of the communication system under test, expanding the test engine to implement automated testing, using the service layer and control layer to build test interfaces and process control, eliminating the dependence of professional programming skills.
It realizes efficient and accurate automated testing under high demand testing, lowers the technical threshold for writing automated test cases, and enhances the flexibility, maintainability, adaptability and long-term maintenance of testing.
Smart Images

Figure CN119299334A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication testing technology, and in particular to a communication system automated testing method, device, equipment, storage medium and product. Background Art
[0002] In the current software development environment, the use of a front-end and back-end separation architecture has become the norm, and the back-end mainly interacts with data through real-time communication protocols such as RESTful API or Websocket. With the popularity of agile development and DevOps, the speed of project iteration has accelerated, and the demand for testing has increased accordingly. In the case of high-demand testing, traditional manual testing methods can no longer meet the needs in terms of efficiency and coverage. Therefore, the industry is in urgent need of a method that can quickly and accurately automate the testing of communication systems. Summary of the invention
[0003] The main purpose of the present application is to provide a communication system automated testing method, device, equipment, storage medium and product, aiming to solve the technical problem that the prior art cannot quickly and accurately perform automated testing on the communication system.
[0004] To achieve the above object, the present application provides a communication system automated testing method, the method comprising the following steps:
[0005] Creating a test case according to a real-time communication scenario in which the communication system under test is located, wherein the test case includes configuration data in a predefined format;
[0006] Parsing the test case by a first test engine to obtain a communication protocol type corresponding to the communication system under test;
[0007] Expanding the first test engine based on the communication protocol type to obtain a second test engine, and performing automated testing on the communication system under test through the second test engine;
[0008] The first test engine is constructed based on a service layer and a control layer, wherein the service layer is used to define a service abstract interface for automated testing, and the control layer is used to define a process control for automated testing.
[0009] In one embodiment, the step of creating a test case according to the real-time communication scenario in which the communication system under test is located includes:
[0010] Determine a test data template corresponding to the communication system under test during the test according to the real-time communication scenario in which the communication system under test is located;
[0011] The test data template is sent to the tester, and the tester is guided to obtain the test case after filling the configuration data in a predefined format in the test data template, where the predefined format is a JSON format, and the configuration data includes test context information, test data, and expected result configuration.
[0012] In one embodiment, the step of obtaining the second test engine by expanding the first test engine based on the communication protocol type includes:
[0013] Determine a preset decorator according to the communication protocol type, and generate a communicator subclass corresponding to the communication protocol type from a communicator factory;
[0014] Expanding the first test engine based on the preset decorator and the communicator subclass to obtain a second test engine;
[0015] The preset decorator is used to add custom logic before and after the process of performing automated testing on the communication system under test, and the communicator subclass is used to update the communication protocol of the first test engine.
[0016] In one embodiment, the step of performing automated testing on the communication system under test by the second test engine includes:
[0017] Establishing a communication connection with the communication system under test, and generating test preparation data through a preset decorator in the second test engine;
[0018] The test preparation data is converted into a test request through the communicator subclass in the second test engine, and an automated test is performed on the communication system under test based on the test request.
[0019] In one embodiment, the step of converting the test preparation data into a test request through the communicator subclass in the second test engine, and performing automated testing on the communication system under test based on the test request includes:
[0020] converting the test preparation data into a test request through a communicator subclass in the second test engine, and sending the test request to the communication system under test;
[0021] Receiving first response data returned by the communication system under test based on the test request, and performing data processing on the first response data through the preset decorator to obtain second response data;
[0022] An automated test result of the communication system under test is determined according to the second response data.
[0023] In one embodiment, the communication system automated testing method further includes:
[0024] Generate a custom function according to the test content of the communication system under test, wherein the custom function is used to randomly generate test data matching the test content;
[0025] When the communication system under test is subjected to an automated test, the user-defined function is called by the second test engine to generate random test data, and the random test data is replaced into the test data template in the test case.
[0026] In addition, to achieve the above-mentioned purpose, the present application also proposes a communication system automated testing device, the communication system automated testing device comprising:
[0027] A test case creation module, used to create a test case according to the real-time communication scenario of the communication system under test, wherein the test case includes configuration data in a predefined format;
[0028] A use case analysis module, used to analyze the test case through a first test engine to obtain a communication protocol type corresponding to the communication system under test;
[0029] A system testing module, configured to expand the first testing engine based on the communication protocol type to obtain a second testing engine, and to perform automated testing on the communication system under test through the second testing engine;
[0030] The first test engine is constructed based on a service layer and a control layer, wherein the service layer is used to define a service abstract interface for automated testing, and the control layer is used to define a process control for automated testing.
[0031] In addition, to achieve the above-mentioned purpose, the present application also proposes a communication system automation testing device, which includes: a memory, a processor, and a communication system automation testing program stored in the memory and executable on the processor, and the communication system automation testing program is configured to implement the steps of the communication system automation testing method described above.
[0032] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a communication system automation testing program is stored on the storage medium. When the communication system automation testing program is executed by the processor, the steps of the communication system automation testing method described above are implemented.
[0033] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer program product, which includes a communication system automated testing program, and when the communication system automated testing program is executed by a processor, the steps of the communication system automated testing method described above are implemented.
[0034] The present application creates a test case according to the real-time communication scenario of the communication system under test, and the test case contains configuration data in a predefined format; the test case is parsed by a first test engine to obtain the communication protocol type corresponding to the communication system under test; the first test engine is expanded based on the communication protocol type to obtain a second test engine, and the communication system under test is automatically tested by the second test engine; wherein the first test engine is constructed based on a service layer and a control layer, the service layer is used to define the service abstract interface of the automated test, and the control layer is used to define the process control of the automated test. Compared with the traditional manual testing method, the above method of the present application expands the first test engine according to the communication protocol type corresponding to the communication system under test to obtain the second test engine, and then performs automated testing on the communication system under test based on the second test engine, thereby eliminating the dependence of the manual testing process on professional programming skills, and thus even in the face of high-demand testing of the communication system, automated testing can be performed efficiently and accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A schematic diagram of the structure of a communication system automated testing device for a hardware operating environment involved in an embodiment of the present application;
[0036] Figure 2 This is a flow chart of the first embodiment of the communication system automated testing method of the present application;
[0037] Figure 3 This is a flow chart of the second embodiment of the communication system automated testing method of the present application;
[0038] Figure 4 This is a flow chart of the third embodiment of the communication system automated testing method of the present application;
[0039] Figure 5 This is a structural block diagram of the first embodiment of the communication system automatic testing device of the present application.
[0040] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0041] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0042] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of the communication system automated testing equipment in the hardware operating environment involved in the embodiment of the present application.
[0043] like Figure 1 As shown, the communication system automated test equipment may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0044] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the communication system automatic test equipment, and may include more or less components than those shown in the figure, or combine certain components, or arrange the components differently.
[0045] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a communication system automatic test program.
[0046] exist Figure 1 In the communication system automation test equipment shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the communication system automation test equipment of the present application can be set in the communication system automation test equipment, and the communication system automation test equipment calls the communication system automation test program stored in the memory 1005 through the processor 1001, and executes the communication system automation test method provided in the embodiment of the present application.
[0047] The present application provides a communication system automated testing method, referring to Figure 2 , Figure 2This is a flow chart of the first embodiment of the communication system automated testing method of the present application.
[0048] In this embodiment, the communication system automated testing method comprises the following steps:
[0049] Step S10: creating a test case according to the real-time communication scenario of the communication system under test, wherein the test case includes configuration data in a predefined format.
[0050] It should be noted that the execution subject of the method of this embodiment can be a terminal device with communication testing, data processing and program running functions, such as a smart phone, a computer, etc., or an electronic device with the same or similar functions, such as the above-mentioned communication system automated testing equipment. The following takes the communication system automated testing equipment (hereinafter referred to as the testing equipment) as an example to illustrate this embodiment and the following embodiments.
[0051] It is understandable that the above-mentioned communication system under test can be a system that transmits information using electrical signals (or optical signals). It can convert information into electromagnetic waves or other forms of signals for transmission, allowing users to communicate and exchange in the form of voice, images, data, etc. in different locations.
[0052] It should be understood that the above-mentioned test case refers to a set of test inputs, execution conditions and expected results designed for a specific purpose.
[0053] In the specific implementation, a test case can be created according to the real-time communication scenario (such as API call), and basic information can be filled in according to the predefined format, including conf_data, test_data, expect_data, and before_op_data and after_op_data can be configured if necessary. These data follow the standardized model of this embodiment and match the framework structure of base_controller and base_service to ensure correct parsing and execution. For test engineers without programming experience, this step only requires understanding the test case, clarifying the environment configuration, test objectives, test data and expected values required for the test, and filling in each field according to the format defined by the template.
[0054] Step S20: parsing the test case through the first test engine to obtain the communication protocol type corresponding to the communication system under test.
[0055] It should be noted that the first test engine is constructed based on a service layer and a control layer, the service layer is used to define the service abstract interface of the automated test, and the control layer is used to define the process control of the automated test.
[0056] It should be understood that the base_controller in the above-mentioned control layer (i.e., controller layer) as a parent class defines the skeleton methods of prepare_data, do_operation, and compare_results, while the specific implementation is completed by the subclass. This pattern ensures the neatness and scalability of the code. In addition, execute_test_case is the general entry point for test case execution. The above-mentioned service layer (i.e., service layer) serves as an auxiliary to the control layer and provides low-level functions such as data processing and communication interface calls. The base_service in the service layer abstracts a series of service methods, and subclasses can inherit and implement the service logic of specific scenarios to maintain the flexibility of the framework. In particular, the contents in base_controller and base_service cannot be changed, and any subclass must inherit and implement the logic of its specific scenario.
[0057] In a specific implementation, the above-mentioned steps of parsing the test case through the first test engine to obtain the communication protocol type corresponding to the communication system under test can be implemented based on the following steps. The first step is to use regular expressions to extract key information from the test case (for example, to find communication commands, data formats, specific fields, status codes, etc.). The second step is to identify protocol features related to the communication protocol from the key information through natural language processing. The third step is to establish a feature library of known communication protocols, including common protocol types (such as HTTP, FTP, MQTT, CoAP, WebSocket, etc.) and their keywords, commonly used formats and behaviors. The fourth step is to compare the protocol features corresponding to the above test cases with the constructed protocol feature library, and determine the communication protocol type based on the comparison results.
[0058] Step S30: Expanding the first test engine based on the communication protocol type to obtain a second test engine, and performing automated testing on the communication system under test through the second test engine.
[0059] It should be understood that since the first test engine contains a flexible and extensible interface, after confirming the communication protocol type of the communication system under test, the first test engine can be expanded according to the communication protocol type to obtain the second test engine, thereby realizing the pricing or customization of new functions without destroying the existing framework in the first test engine, thereby enhancing the adaptability and long-term maintainability of the test system.
[0060] In the specific implementation, the process of automated testing of the communication system under test can be abstracted into a three-step model of "preparing data-operating the object under test-comparing results", and implemented through a layered design (such as controller, service layer and communicator factory), which solves the problems of complex operation and poor scalability of traditional testing methods and improves the readability of the code and testing efficiency.
[0061] This embodiment creates a test case according to the real-time communication scenario of the communication system under test, and the test case contains configuration data in a predefined format; the test case is parsed by a first test engine to obtain the communication protocol type corresponding to the communication system under test; the first test engine is expanded based on the communication protocol type to obtain a second test engine, and the communication system under test is automatically tested by the second test engine; wherein the first test engine is constructed based on a service layer and a control layer, the service layer is used to define the service abstract interface of the automated test, and the control layer is used to define the process control of the automated test. Compared with the traditional manual testing method, since the above method of this embodiment expands the first test engine according to the communication protocol type corresponding to the communication system under test to obtain the second test engine, and then performs automated testing on the communication system under test based on the second test engine, the dependence of the manual testing process on professional programming skills is eliminated, and even in the case of high-demand testing of the communication system, automated testing can be performed efficiently and accurately.
[0062] refer to Figure 3 , Figure 3 This is a flow chart of the second embodiment of the communication system automated testing method of the present application.
[0063] In a feasible implementation manner, the step S10 may include:
[0064] Step S101: determining a test data template corresponding to the communication system under test according to the real-time communication scenario in which the communication system under test is located.
[0065] Step S102: Send the test data template to the tester, and guide the tester to obtain a test case after filling in the configuration data in a predefined format in the test data template, where the predefined format is JSON format, and the configuration data includes test context information, test data, and expected result configuration.
[0066] It should be noted that the above JSON (JavaScript Object Notation) format is a lightweight data exchange format, which can include one or more of numbers, strings, Boolean values, arrays, objects, and null, and this embodiment does not limit this. Data appears in the form of "name / value" pairs in JSON, with the name written in front (in double quotes) and the value pair written behind, separated by a colon. In JSON, multiple "name / value" pairs are separated by commas.
[0067] It is understandable that the above-mentioned test context information (i.e., conf_data) can include test scenarios, target environments, and related configuration parameters, ensuring the reusability and configurability of the case; the above-mentioned test data (i.e., test_data) can be used to reference predefined data templates and specify the fields and their values that need to be replaced. This design allows dynamic generation of test data to adapt to changes in various interface parameters; the above-mentioned expected result configuration (i.e., expect_data) can be used to set expected values such as API responses and database query results, and supports multiple data storage types, including relational databases, ElasticSearch, Redis, etc., which simplifies the setting of result verification.
[0068] In the specific implementation, the design steps of the above test cases not only lower the technical threshold for writing automated test cases, allowing junior testers to quickly adapt, but also achieve decoupling from specific business logic through interface interaction with the service layer, enhancing the flexibility and maintainability of the cases. In addition, all test cases, configurations, and execution data are stored in a database with a standard structure, which is convenient for integration with the team's continuous integration tools and other test management platforms, improving the standardization and efficiency of the test process.
[0069] In a feasible implementation manner, the communication system automated testing method may further include:
[0070] Step S40: Generate a custom function according to the test content of the communication system under test, wherein the custom function is used to randomly generate test data matching the test content.
[0071] Step S50: when performing automated testing on the communication system under test, the user-defined function is called by the second test engine to generate random test data, and the random test data is replaced into the test data template in the test case.
[0072] In a specific implementation, reflection technology can be used to enable the second test engine to call a custom function to generate random test data. For example, assuming that the custom function is the function "generate_random_card_number" for generating random credit card numbers, when executing the test, the second test engine will automatically call this function, generate data and replace it in the test data template to ensure that the data complies with business rules. After the operation is completed, the system will compare the expected results in the database and check the "T_WLT_TRAN_CMB" table field after the "RL_WLT_NRT" interface is updated. In addition, this configuration also supports calling the interface configured in "T_RL_WLT_NRT" to complete data preparation before calling the object under test.
[0073] This embodiment determines the test data template corresponding to the tested communication system during the test according to the real-time communication scenario in which the tested communication system is located; sends the test data template to the tester, and guides the tester to fill in the configuration data in a predefined format in the test data template to obtain a test case, wherein the predefined format is JSON format, and the configuration data includes test context information, test data, and expected result configuration; generates a custom function according to the test content of the tested communication system, and the custom function is used to randomly generate test data matching the test content; when the tested communication system is subjected to automated testing, the custom function is called by the second test engine to generate random test data, and the random test data is replaced into the test data template in the test case. Compared with the traditional manual testing method, the above method of this embodiment guides the tester to fill in the configuration data in a predefined format in the test data template to obtain the test case, which reduces the technical threshold for writing automated test cases, so that junior testers can also adapt quickly, and through the interface interaction with the service layer, it realizes decoupling from the specific business logic, and enhances the flexibility and maintainability of the case.
[0074] refer to Figure 4 , Figure 4 This is a flow chart of the third embodiment of the communication system automated testing method of the present application.
[0075] In a feasible implementation manner, the step S30 may include:
[0076] Step S301: determining a preset decorator according to the communication protocol type, and generating a communicator subclass corresponding to the communication protocol type from a communicator factory.
[0077] It should be noted that the preset decorator is used to add custom logic before and after the process of performing automated testing on the communication system under test, and the communicator subclass is used to update the communication protocol of the first test engine.
[0078] Step S302: Expand the first test engine based on the preset decorator and the communicator subclass to obtain a second test engine.
[0079] It should be understood that, in order to adapt to various real-time communication protocols, this embodiment adopts the factory pattern and creates a communicator factory. The factory is responsible for dynamically generating corresponding communicator subclasses according to the protocol type in the test case. In this way, when adding or updating a communication protocol, there is no need to modify the existing core code, only to create a new communicator subclass, thereby ensuring the modularity and scalability of the code. The structure of the communicator class, in which the abstract base class defines a common interface, and the specific protocol implementation (such as HTTP, Websocket, etc.) is a subclass that covers these interfaces and implements support for different protocols. This design allows testers to only specify the protocol type when configuring test cases, without having to worry about the underlying implementation, and maintains the unity and compatibility of the configuration data. Through the communicator factory, this embodiment provides a better solution, so that real-time communication protocols can be easily added or updated without destroying the existing test case configuration format, thereby enhancing the adaptability and flexibility of the test engine.
[0080] In the specific implementation, in order to cope with complex and customized test requirements, this embodiment introduces the decorator pattern to generate the above-mentioned preset decorator. The decorator is used to extend the do_operation and compare_results methods of the service layer, allowing testers to add custom logic before and after the test execution, such as data preprocessing or post-processing. The before_op_data and after_op_data fields in the test case configuration are used to specify the parameters of the decorator, making the configuration of customized operations simple and intuitive.
[0081] Step S303: establishing a communication connection with the communication system under test, and generating test preparation data through a preset decorator in the second test engine.
[0082] It should be noted that the above test preparation data not only covers the test case input data in the traditional sense, but also includes the complete test context environment, such as system configuration, dependent service status, preprocessing operations, etc. This comprehensive data model ensures the integrity of the test and avoids test errors caused by environmental factors. Compared with the traditional method that only focuses on the data sent to the system under test, the "test preparation data" of this embodiment pays more attention to the simulation of the test scenario, making the test closer to the actual operating environment and improving the accuracy and reliability of the test.
[0083] Step S304: converting the test preparation data into a test request through the communicator subclass in the second test engine, and performing an automated test on the communication system under test based on the test request.
[0084] It should be understood that before sending the above test request, the second test engine can perform preprocessing operations based on the configuration application predefined or customized decorators to complete data preparation and pre-operation. After sending the above test request, the base_controller in the second test engine calls the do_operation method of the base_service, and the specific service subclass implements real-time communication with the system under test, including building requests, sending requests, and receiving responses.
[0085] In a feasible implementation manner, the step S304 may include:
[0086] Step S3041: converting the test preparation data into a test request through the communicator subclass in the second test engine, and sending the test request to the communication system under test.
[0087] Step S3042: receiving first response data returned by the communication system under test based on the test request, and performing data processing on the first response data through the preset decorator to obtain second response data.
[0088] Step S3043: Determine the automated test result of the communication system under test according to the second response data.
[0089] In a specific implementation, a comparison logic may be defined, and based on the comparison logic, the difference between the second response data and the expected result may be compared to determine the automated test result of the communication system under test, including but not limited to the response message, database status, etc., to ensure the accuracy of the test. Exemplarily, a custom comparison function in the reflection call configuration may be used to compare the response data with the expected result to ensure that the test goal is achieved. After completing the automated test of the communication system under test, a detailed test report may be generated, including information such as the test status, execution time, and difference analysis.
[0090] This embodiment determines a preset decorator according to the communication protocol type, and generates a communicator subclass corresponding to the communication protocol type from the communicator factory; expands the first test engine based on the preset decorator and the communicator subclass to obtain a second test engine; wherein the preset decorator is used to add custom logic before and after the process of automated testing of the communication system under test, and the communicator subclass is used to update the communication protocol of the first test engine; establishes a communication connection with the communication system under test, and generates test preparation data through the preset decorator in the second test engine; converts the test preparation data into a test request through the communicator subclass in the second test engine, and sends the test request to the communication system under test; receives first response data returned by the communication system under test based on the test request, and processes the first response data through the preset decorator to obtain second response data; determines the automated test result of the communication system under test according to the second response data. Compared with traditional testing methods, the above method in this embodiment adopts the factory mode to realize dynamic support of communication protocols, and realizes customization of test logic through decorators and reflection technology. This non-intrusive design allows new functions or customized operations to be easily added without destroying the existing framework, thereby enhancing the adaptability and long-term maintainability of the system, thereby improving the accuracy and reliability of the test.
[0091] In addition, an embodiment of the present application further proposes a storage medium, on which a communication system automated testing program is stored. When the communication system automated testing program is executed by a processor, the steps of the communication system automated testing method described above are implemented.
[0092] Reference Figure 5 , Figure 5 This is a structural block diagram of the first embodiment of the communication system automatic testing device of the present application.
[0093] like Figure 5 As shown, the communication system automated testing device proposed in the embodiment of the present application includes:
[0094] A test case creation module 501 is used to create a test case according to a real-time communication scenario in which the communication system under test is located, wherein the test case includes configuration data in a predefined format;
[0095] A use case analysis module 502, configured to analyze the test case through a first test engine to obtain a communication protocol type corresponding to the communication system under test;
[0096] A system testing module 503, configured to expand the first testing engine based on the communication protocol type to obtain a second testing engine, and perform automated testing on the communication system under test through the second testing engine;
[0097] The first test engine is constructed based on a service layer and a control layer, wherein the service layer is used to define a service abstract interface for automated testing, and the control layer is used to define a process control for automated testing.
[0098] This embodiment creates a test case according to the real-time communication scenario of the communication system under test, and the test case contains configuration data in a predefined format; the test case is parsed by a first test engine to obtain the communication protocol type corresponding to the communication system under test; the first test engine is expanded based on the communication protocol type to obtain a second test engine, and the communication system under test is automatically tested by the second test engine; wherein the first test engine is constructed based on a service layer and a control layer, the service layer is used to define the service abstract interface of the automated test, and the control layer is used to define the process control of the automated test. Compared with the traditional manual testing method, since the above method of this embodiment expands the first test engine according to the communication protocol type corresponding to the communication system under test to obtain the second test engine, and then performs automated testing on the communication system under test based on the second test engine, the dependence of the manual testing process on professional programming skills is eliminated, and even in the case of high-demand testing of the communication system, automated testing can be performed efficiently and accurately.
[0099] Based on the first embodiment of the automatic testing device for a communication system of the present application, a second embodiment of the automatic testing device for a communication system of the present application is proposed.
[0100] In this embodiment, the use case creation module 501 is also used to determine the test data template corresponding to the communication system under test during the test according to the real-time communication scenario in which the communication system under test is located; send the test data template to the tester, and guide the tester to obtain the test case after filling in the configuration data in a predefined format in the test data template, wherein the predefined format is JSON format, and the configuration data includes test context information, test data, and expected result configuration.
[0101] Furthermore, the system testing module 503 is also used to determine a preset decorator according to the communication protocol type, and generate a communicator subclass corresponding to the communication protocol type from the communicator factory; based on the preset decorator and the communicator subclass, the first test engine is expanded to obtain a second test engine; wherein the preset decorator is used to add custom logic before and after the process of automated testing of the communication system under test, and the communicator subclass is used to update the communication protocol of the first test engine.
[0102] Furthermore, the system testing module 503 is also used to establish a communication connection with the communication system under test, and generate test preparation data through a preset decorator in the second test engine; convert the test preparation data into a test request through the communicator subclass in the second test engine, and perform automated testing on the communication system under test based on the test request.
[0103] Furthermore, the system testing module 503 is also used to convert the test preparation data into a test request through the communicator subclass in the second test engine, and send the test request to the communication system under test; receive first response data returned by the communication system under test based on the test request, and perform data processing on the first response data through the preset decorator to obtain second response data; and determine the automated test result of the communication system under test based on the second response data.
[0104] Furthermore, the system testing module 503 is also used to generate a custom function based on the test content of the communication system under test, and the custom function is used to randomly generate test data matching the test content; when the communication system under test is subjected to automated testing, the custom function is called by the second test engine to generate random test data, and the random test data is replaced into the test data template in the test case.
[0105] Other embodiments or specific implementations of the communication system automatic testing device of the present application can refer to the above-mentioned method embodiments and will not be described in detail here.
[0106] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.
[0107] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0108] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0109] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A communication system automated testing method, characterized in that: The method comprises the following steps: Creating a test case according to a real-time communication scenario in which the communication system under test is located, wherein the test case includes configuration data in a predefined format; Parsing the test case by a first test engine to obtain a communication protocol type corresponding to the communication system under test; Expanding the first test engine based on the communication protocol type to obtain a second test engine, and performing automated testing on the communication system under test through the second test engine; The first test engine is constructed based on a service layer and a control layer, wherein the service layer is used to define a service abstract interface for automated testing, and the control layer is used to define a process control for automated testing.
2. The communication system automated testing method according to claim 1, characterized in that: The step of creating a test case according to the real-time communication scenario of the communication system under test includes: Determine a test data template corresponding to the communication system under test during the test according to the real-time communication scenario in which the communication system under test is located; The test data template is sent to the tester, and the tester is guided to obtain the test case after filling the configuration data in a predefined format in the test data template, where the predefined format is a JSON format, and the configuration data includes test context information, test data, and expected result configuration.
3. The communication system automated testing method according to claim 1, characterized in that: The step of expanding the first test engine based on the communication protocol type to obtain the second test engine includes: Determine a preset decorator according to the communication protocol type, and generate a communicator subclass corresponding to the communication protocol type from a communicator factory; Expanding the first test engine based on the preset decorator and the communicator subclass to obtain a second test engine; The preset decorator is used to add custom logic before and after the process of performing automated testing on the communication system under test, and the communicator subclass is used to update the communication protocol of the first test engine.
4. The communication system automated testing method according to claim 1, characterized in that: The step of performing automated testing on the communication system under test by the second test engine comprises: Establishing a communication connection with the communication system under test, and generating test preparation data through a preset decorator in the second test engine; The test preparation data is converted into a test request through the communicator subclass in the second test engine, and an automated test is performed on the communication system under test based on the test request.
5. The communication system automated testing method according to claim 4, characterized in that: The step of converting the test preparation data into a test request through the communicator subclass in the second test engine, and performing automated testing on the communication system under test based on the test request, comprises: converting the test preparation data into a test request through a communicator subclass in the second test engine, and sending the test request to the communication system under test; Receiving first response data returned by the communication system under test based on the test request, and performing data processing on the first response data through the preset decorator to obtain second response data; An automated test result of the communication system under test is determined according to the second response data.
6. The communication system automated testing method according to claim 1, characterized in that: The method further comprises: Generate a custom function according to the test content of the communication system under test, wherein the custom function is used to randomly generate test data matching the test content; When the communication system under test is subjected to an automated test, the user-defined function is called by the second test engine to generate random test data, and the random test data is replaced into the test data template in the test case.
7. A communication system automated testing device, characterized in that: The communication system automated testing device comprises: A test case creation module, used to create a test case according to the real-time communication scenario of the communication system under test, wherein the test case includes configuration data in a predefined format; A use case analysis module, used to analyze the test case through a first test engine to obtain a communication protocol type corresponding to the communication system under test; A system testing module, configured to expand the first testing engine based on the communication protocol type to obtain a second testing engine, and to perform automated testing on the communication system under test through the second testing engine; The first test engine is constructed based on a service layer and a control layer, wherein the service layer is used to define a service abstract interface for automated testing, and the control layer is used to define a process control for automated testing.
8. A communication system automated testing device, characterized in that: The device comprises: a memory, a processor, and a communication system automated testing program stored in the memory and executable on the processor, wherein the communication system automated testing program is configured to implement the steps of the communication system automated testing method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a communication system automated testing program is stored on the storage medium. When the communication system automated testing program is executed by a processor, the steps of the communication system automated testing method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a communication system automated testing program, and when the communication system automated testing program is executed by a processor, the steps of the communication system automated testing method according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Testing method and system based on message
CN102694701A
Interface automatic test method, device and equipment and computer readable storage medium
CN111737140A
Automatic test method and device, medium, electronic equipment and system
CN112685319A
System testing method and component, storage medium and computer equipment
CN118132418A
General middleware adaptor and method thereof
KR1020130077737A