Test method and device, electronic device, and computer readable medium
By running the test program on the test platform, obtaining target result messages from the preset result library, the problem of missing network element device messages and security risks in telecommunications services is solved, and the simulation test of network element device business process is realized , reduces the cost of laboratory environment construction and ensures the safety and integrity of testing.
Patent Information
- Application Number
- CN202210953213.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-09
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-08-09
AI Technical Summary
During the development of telecommunications services and IT systems, the lack of messages returned by network element devices will affect the development progress and product quality, and there may be security risks when performing business logic or instruction verification directly on network element devices, and multiple types of Network element equipment requires high costs.
Provide a test method and device, by receiving test instructions, running the test program to obtain target result messages from the preset result database, and generate test results based on the target result messages and the specified result messages to realize network element equipment service Simulation and testing of the process reduces the cost of laboratory environment construction and ensures safety.
The network element equipment business process is tested, which reduces the cost of laboratory environment construction, ensures the safety and integrity of the test, and avoids the impact on existing network element equipment.
Smart Images

Figure CN115269429B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a testing method and device, an electronic device, and a computer-readable medium. Background Art
[0002] In the process of developing telecommunication services and related IT systems, interactions between different systems are involved. Lack of messages returned by network element devices may affect the overall development progress and product quality of such systems. Therefore, it is necessary to test the process of network element devices executing services and the results of returned messages.
[0003] In the related technologies, it is usually necessary to build a large number of network element devices of various types in the laboratory to achieve the construction of network element devices, which requires high costs. The behavior of directly verifying business logic or instructions on the network element devices may affect the services already executed on the network element devices, which may pose security risks. Summary of the invention
[0004] To solve the above technical problems, the embodiments of the present application provide a testing method and device, an electronic device, and a computer-readable medium.
[0005] According to one aspect of an embodiment of the present application, a testing method is provided, the method comprising: receiving a test instruction; wherein the test instruction is used to instruct the return of a specified result message; running a test program to obtain a target result message from a plurality of result messages contained in a preset result message library through the test program, and return the target result message; obtaining the target result message returned by the test program; and generating a test result based on the target result message and the specified result message.
[0006] In one embodiment of the present application, the test instruction includes business parameters associated with executing the business and network element device parameters for executing the business according to the business parameters; the running of the test program to obtain the target result message from multiple result messages contained in a preset result message library through the test program includes: running the test program to determine, through the test program, from multiple result messages contained in a preset result message library, candidate result messages that match the network element device parameters, and determining, from the candidate result messages, the target result message that matches the business parameters.
[0007] In one embodiment of the present application, the candidate result messages include result messages of successful business execution, result messages of failed business execution, and result messages of business errors; determining the target result message that matches the business parameters from the candidate result messages includes: performing parameter verification on the business parameters to obtain parameter verification results; and determining, based on the parameter verification results, the target result message that matches the business parameters from the result messages of successful business execution, the result messages of failed business execution, and the result messages of business errors.
[0008] In one embodiment of the present application, the target result message that matches the business parameters is determined from the result message of successful business execution, the result message of failed business execution, and the result message of business error according to the parameter verification result, including: if the parameter verification result indicates that the parameter verification is successful, status information is obtained from the business parameters, and according to the status information, a target result message that matches the status information is determined from the result message of successful business execution and the result message of failed business execution; if the parameter verification result indicates that the parameter verification is failed, error information is obtained from the business parameters, and the error information and the result message of the business error are integrated and processed to obtain a target result message that matches the error information.
[0009] In one embodiment of the present application, the test result is generated according to the target result message and the specified result message, including: if the target result message matches the specified result message, a test result is generated to characterize a successful test; if the target result message does not match the specified result message, a test result is generated to characterize a failed test.
[0010] In one embodiment of the present application, before receiving the test instruction, the method also includes: obtaining historical result data generated by the network element device executing the service; wherein the historical result data includes result messages of successful service execution, result messages of failed service execution, and result messages of service errors; and obtaining network element device parameters of the network element device, and business parameters associated with the network element device executing the service; and storing the network element device parameters, the business parameters, and the historical result data in association with each other in the preset result message library.
[0011] In one embodiment of the present application, before receiving the test instruction, the method also includes: receiving a writing instruction for the test program, and generating the test program according to the writing instruction; deploying the test program in a terminal device to run the test program in the terminal device to obtain a target result message returned by the test program.
[0012] According to one aspect of an embodiment of the present application, a testing device is provided, comprising: a receiving module configured to receive a test instruction; wherein the test instruction is used to instruct the return of a specified result message; an running module configured to run a test program to obtain a target result message from a plurality of result messages contained in a preset result message library through the test program, and return the target result message; an acquiring module configured to acquire the target result message returned by the test program; and a generating module configured to generate a test result based on the target result message and the specified result message.
[0013] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the electronic device implements the test method as described above.
[0014] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the testing method as described above.
[0015] In the technical solution provided in the embodiment of the present application, by receiving a test instruction, a matching specified result message can be obtained from the test instruction, and a test program is run after receiving the test instruction, and a target result message is obtained from a plurality of result messages contained in a preset result message library through the test program, and a test result is generated according to the target result message and the specified result message. On the one hand, the test method of the embodiment of the present application can simulate the return result of the network element device in the core network for the service output during the verification process of the network element device instruction, thereby realizing the test of the service process of the network element device, and obtaining a target result message with the same format as the return message when the network element device actually executes the service. On the other hand, the testing method of the embodiment of the present application directly runs the test program on the test platform, and then determines the target result message from the preset result message library and generates the test result. It only needs to construct the preset result message library and simulate the operating environment of the network element device on the test platform to complete the test. There is no need to build a large number of various types of network element devices in the laboratory, which can effectively reduce the testing cost of the related technology that requires the deployment of the laboratory environment. It can also directly simulate the output results of the network element device executing the business through the test program, decouple the simulation process from the actual network element device, and maintain the integrity of the business logic verification process while having the characteristics of simple operation and high security.
[0016] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0018] Figure 1 is a schematic diagram of a network architecture of a test system shown in an exemplary embodiment of the present application;
[0019] Figure 2 is a flow chart of a testing method shown in an exemplary embodiment of the present application;
[0020] Figure 3 yes Figure 2 A flowchart of step S220 in the illustrated embodiment in an exemplary embodiment;
[0021] Figure 4 yes Figure 3 A flowchart of step S320 in the illustrated embodiment in an exemplary embodiment;
[0022] Figure 5 is a flow chart of a testing method shown in another exemplary embodiment of the present application;
[0023] Figure 6 is a flow chart of a testing method shown in another exemplary embodiment of the present application;
[0024] Figure 7 is a block diagram of a testing device shown in an exemplary embodiment of the present application;
[0025] Figure 8 It is a schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application. DETAILED DESCRIPTION
[0026] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0027] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0028] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0029] The term "multiple" as used in this application refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0030] The solution provided in the embodiment of the present application relates to communication technology, specifically to simulation test technology in 5G communication technology. It is understandable that with the development of communication services, there are interactive processes between different systems. In the interactive process between various systems, if the message returned by the network element device is missing, it may affect the overall research and development progress and product quality of the system. Therefore, in the development process of the relevant IT system, it is necessary to test the design of the business process of the network element device, the design of the instruction, the instruction execution process and the business logic, so as to discover the defects in the execution of instructions in the relevant IT system through the test results.
[0031] In a production environment, if the execution process of business logic and instructions is tested directly on the network element device, it may affect the existing configuration on the network element device, and even affect the business currently being executed on the network element device, affecting the user experience; in addition, the behavior of directly verifying business logic or instructions on the network element device requires additional manpower to monitor the network element device, and it is costly to build a large number of network element devices of various types in the laboratory.
[0032] Therefore, in order to avoid or reduce the impact that may be caused by testing directly on the network element device, the embodiment of the present application proposes a test system, see Figure 1 , Figure 1 is a schematic diagram of a test system framework shown in an exemplary embodiment of the present application, such as Figure 1 As shown, the test system at least includes a terminal device 101 and a test platform 102. Figure 1 It can be seen that the test platform 102 has a logic calculation function, wherein:
[0033] The test platform 102 receives a test instruction, wherein the test instruction is used to instruct to return a specified result message;
[0034] Running the test program to obtain a target result message from a plurality of result messages contained in a preset result message library through the test program, and return the target result message;
[0035] Get the target result message returned by the test program;
[0036] Generate test results based on the target result message and the specified result message.
[0037] It should be noted that the test instruction in the embodiment of the present application may be sent by the terminal device 101 to the test platform 102. After the test platform 102 receives the test instruction from the terminal device 101, it runs the test program to start the test process.
[0038] It should be noted that after the network element device executes the business instruction, it will return a result message corresponding to the business instruction; the test platform 102 of the embodiment of the present application receives a test instruction, and the test instruction instructs the test platform to run the test program and then return a specified result message. The test platform runs the test program according to the test instruction to simulate the process of the network element device executing the business instruction and obtaining the result data. The test platform runs the test program according to the test instruction, and obtains the target result message from the multiple result messages contained in the preset result message library through the test program, and compares the target result message with the specified result message to obtain the test result, which helps to determine whether there are logical errors in the execution process of the network element device executing the business instruction.
[0039] The network element device in the embodiment of the present application can be a 4G (fourth generation mobile communication technology) core network element device, or it can be a 5G (fifth generation mobile communication technology) core network element device.
[0040] Among them, the 4G core network element equipment may include one or more of the following: Mobility Management Entity (MME), Service Gateway (SGW), PDN Gateway (PGW), Policy and Charging Rules Function (PCRF), Home Subscriber Server (HSS), Evolved Node B (eNB). PDN (Public Data Network) is a public data network, a communication network that provides data communication services to the public.
[0041] Among them, the 5G core network network element equipment includes one or more of the following: network storage function NRF (NF Repository Function), user plane function UPF (User Plane Function), wireless access network RAN (Radio Access Network), network open function NEF, policy control function PCF (Policy Control Function), unified data management UDM (Unified Data Manager), access and mobility management function AMF (Access and Mobility Management Function), session management function SMF (Session Management Function).
[0042] Based on the above-mentioned test system, the embodiments of the present application propose a test method and a test method and device, an electronic device, and a computer-readable medium, which will be described in detail below.
[0043] See also Figure 2 , Figure 2 is a flow chart of a test method shown in an exemplary embodiment of the present application. The method can be applied to include Figure 1 The implementation environment of the test system shown in FIG. 1 is executed by the test platform 102 in the test system. It should be understood that the method can also be applied to other exemplary implementation environments and specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.
[0044] In an exemplary embodiment, the testing method includes at least steps S210 to S240, which are described in detail as follows:
[0045] Step S210, receiving a test instruction; wherein the test instruction is used to instruct to return a specified result message.
[0046] The test instructions in the embodiments of the present application may be sent by the terminal device to the test platform, so that after the test platform receives the test instructions from the terminal device, it runs the test program to start the test process.
[0047] It should be noted that the test instructions in the embodiments of the present application include service parameters associated with the execution of the service and network element device parameters for executing the service according to the service parameters. The test instructions can be used to test whether there are logical problems in the process of the network element device executing the service, and can also be used to test whether the result data returned by the network element device after completing the execution of the service is correct. The content of the test instruction can be designed according to the actual situation, and the embodiments of the present application are not limited to this.
[0048] Step S220 , running the test program to obtain a target result message from a plurality of result messages contained in a preset result message library through the test program, and return the target result message.
[0049] The test program in the embodiment of the present application can be a test program pre-designed according to the execution process of the network element device executing the service, which can be used to test the logical accuracy and data correctness of the network element device executing the service. The test program may include an execution program for the network element device to execute the service. When running the test program, it is equivalent to running the execution program for the network element device to execute the service completely. During the running process, the target result message is obtained from the multiple result messages contained in the preset result message library. That is, after the test program is executed, the target result message is obtained, and the obtained target result message is compared with the specified result message to obtain the test result.
[0050] It should be noted that, in an embodiment of the present application, the process of running the test program in step S220 to obtain the target result message from multiple result messages contained in a preset result message library through the test program may also include the following process: running the test program to determine, through the test program, candidate result messages that match the network element device parameters from multiple result messages contained in the preset result message library, and determining the target result message that matches the service parameters from the candidate result messages.
[0051] The preset result message library in the embodiment of the present application stores result messages generated by multiple network element devices executing services. The result messages in the preset result message library may include network element device parameters, service parameters related to the execution of services, status parameters related to the execution of services, etc. as query basis.
[0052] Exemplarily, the preset result message library in the embodiment of the present application stores various result data that may appear when the network element device executes the service. For example, the various result data that may appear when a network element device executes the service include result messages of successful service execution, messages of failed service execution, and result messages of service errors. The stored data in the preset result message library is obtained based on a large amount of historical result data generated by each network element device executing the service.
[0053] Exemplarily, the storage content of the result message of a network element device executing a service in the preset result message library can refer to the following Table 1:
[0054]
[0055] Table 1
[0056] Exemplarily, the storage format of the result message of a network element device executing a service in the preset result message library can be as follows: <Network element device parameter 1: service 1 parameter, success-result message of successful execution of service 1, fail-result message of failed execution of service 1; service 2 parameter, success-result message of successful execution of service 2, fail-result message of failed execution of service 2; result message of parameter error>.
[0057] It should be noted that in the embodiment of the present application, the process of determining a candidate result message that matches the network element device parameters from multiple result messages contained in a preset result message library through a test program may include the following process: based on the network element device parameters carried in the test instruction, determining the result message corresponding to the network element device parameters from the preset result message library as a candidate result message.
[0058] The candidate result messages in the embodiment of the present application include result messages of successful service execution, result messages of failed service execution, and result messages of service errors.
[0059] For example, if the result messages stored in the preset result message library include result message data generated by the first network element device A and the second network element device B executing services, including: <first network element device parameter A: service 1 parameter, success-result message of successful execution of service 1 by the first network element device, fail-result message of failed execution of service 1 by the first network element device; service 2 parameter, success-result message of successful execution of service 2 by the first network element device, fail-result message of failed execution of service 2 by the first network element device; result message X1 with incorrect parameters>, and <second network element device parameter B: service 1 parameter, success-result message of successful execution of service 1 by the second network element device, fail-result message of failed execution of service 1 by the second network element device; service 2 parameter, success-result message of successful execution of service 2 by the second network element device, fail-result message of failed execution of service 2 by the second network element device; result message X2 with incorrect parameters>. If the network element device parameter in the test instruction is A, then according to the network element device parameter A carried in the test instruction, the result message corresponding to the network element device parameter A is determined from the preset result message library, including "success-result message of successful execution of service 1 by the first network element device", "fail-result message of failed execution of service 1 by the first network element device", "success-result message of successful execution of service 2 by the first network element device", "fail-result message of failed execution of service 2 by the first network element device", and "parameter error result message X1". The result message corresponding to the network element device parameter A determined from the preset result message library is used as a candidate result message, that is, the candidate result message includes "success-result message of successful execution of service 1 by the first network element device", "status parameter fail-result message of failed execution of service 1 by the first network element device", "success-result message of successful execution of service 2 by the first network element device", "fail-result message of failed execution of service 2 by the first network element device", and "parameter error result message X1".
[0060] In one embodiment of the present application, Figure 3 As shown, the process of determining the target result message matching the service parameters from the candidate result messages may include steps S310 to S320, which are described in detail as follows:
[0061] Step S310, performing parameter verification on the service parameters to obtain parameter verification results.
[0062] The service parameters in the embodiments of the present application are identifiers for distinguishing service types. The same network element device can perform multiple services. Therefore, differentiating different services by service parameters helps to better store the result data of the network element device performing different services in the preset result message library. In addition, when querying the data in the preset result message library, the service parameters can also be used as a retrieval factor to help quickly query the data.
[0063] In an exemplary embodiment, the process of performing parameter verification on the business parameters and obtaining the parameter verification results may also include the following process: comparing the business parameters with the pre-stored business parameters in the preset result message library; if the business parameters are the same as the pre-stored business parameters in the preset result message library, the parameter verification result is that the parameter verification is successful; if the pre-stored business parameters that are the same as the business parameters are not found in the preset result message library, the parameter verification result is that the parameter verification is unsuccessful.
[0064] Step S320, according to the parameter verification result, determine the target result message that matches the business parameters from the result message of successful business execution, the result message of failed business execution, and the result message of business error.
[0065] In one embodiment of the present application, Figure 3 As shown, the process of determining the target result message matching the business parameters from the result message of successful business execution, the result message of failed business execution, and the result message of business error in step S320 according to the parameter verification result may include steps S410 to S420, which are described in detail as follows:
[0066] Step S410, if the parameter verification result indicates that the parameter verification is successful, then obtain the status information from the service parameters, and determine the target result message that matches the status information from the result message of successful service execution and the result message of failed service execution according to the status information.
[0067] It should be noted that the status information in the embodiment of the present application refers to the result status of the network element device executing the service. For example, the status information can indicate the status of successful service execution or the status of failed service execution.
[0068] In an exemplary embodiment, the status information in the service parameter includes a first status parameter indicating successful execution of the service instruction and a second status parameter indicating failed execution of the service instruction; the process of determining a target result message matching the status information from a result message indicating successful execution of the service instruction and a result message indicating failed execution of the service instruction according to the status information in step S410 may include the following process, which is described in detail as follows:
[0069] If the state parameter in the state information is the first state parameter indicating successful execution of the service instruction, a result message indicating successful execution of the service is determined from the candidate messages as the target result message;
[0070] If the state parameter in the state information is the second state parameter indicating that the service instruction execution fails, a result message of service execution failure is determined from the candidate messages as the target result message.
[0071] Exemplarily, the state parameter in the state information may include a first state parameter "success" indicating successful execution of the service and a second state parameter "fail" indicating failed execution of the service. If the state parameter in the state information is "success", a result message indicating successful execution of the service is determined from the candidate messages as the target result message; if the state parameter in the state information is "fail", a result message indicating failed execution of the service is determined from the candidate messages as the target result message.
[0072] For example, the candidate result messages obtained based on the above embodiment include "success-result message of successful execution of service 1 by the first network element device", "fail-result message of failed execution of service 1 by the first network element device", "success-result message of successful execution of service 2 by the first network element device", "fail-result message of failed execution of service 2 by the first network element device", and "result message X1 with parameter error". If the service parameter in the test instruction is service 1, the result message related to service 2 is not considered, and only the result message related to service 1 needs to be taken as a candidate, that is, the target result message is determined from "success-result message of successful execution of service 1 by the first network element device", "fail-result message of failed execution of service 1 by the first network element device" and "result message X1 with parameter error". If the parameter verification result is that the parameter verification is successful, the status information is obtained from the service parameters. If the status parameter in the status information is success, it can be determined that the target result message matching the status information is "success-the result message of the first network element device for successful execution of service 1", and if the status parameter in the status information is fail, it can be determined that the target result message matching the status information is "fail-the result message of the first network element device for failed execution of service 2". If the service parameter in the test instruction is service 1, and the parameter verification result is that the parameter verification fails, it can be determined that the target result message is "parameter error result message X1".
[0073] Step S420: If the parameter verification result indicates that the parameter verification has failed, error information is obtained from the service parameters, and the error information and the result message of the service error are integrated and processed to obtain a target result message that matches the error information.
[0074] It should be noted that the error information in the embodiment of the present application refers to the parameter information that causes the failure of the service parameter verification. The error information can be the network element device parameter that causes the failure of the service parameter verification, or it can be the service parameter that causes the failure of the service parameter verification.
[0075] It should be noted that when the network element device receives the service instruction, it will obtain the network element device parameters in the service instruction, and determine the communication protocol adapted by the network element device according to the network element device parameters. If the communication protocol in the test instruction is inconsistent with the communication protocol of the network element device, it will fail during parameter verification. At this time, the error information obtained from the service parameters is the network element device parameters. The process of integrating the error information and the result message of the service error in step S420 to obtain the target result message matching the error information includes: replacing the error information in the result message of the service error with the network element device parameters.
[0076] For example, if the test instruction pre-tests the business execution process of network element device C, and it is known that the communication protocol adapted by network element device C is the ssh protocol, if the relevant parameters carried in the test instruction represent that the communication protocol is not the communication protocol adapted to network element device C, then the parameter verification result represents that the parameter verification has failed. At this time, the error information obtained from the business parameters is the network element device parameters of network element device C, and the error information and the result message of the business error are integrated and processed to obtain the target result message that matches the error information.
[0077] Step S230, obtaining the target result message returned by the test program.
[0078] It should be noted that the target result message in the embodiment of the present application is obtained after the test program is completed, and is used to represent the message returned by the network element device when executing the service instruction.
[0079] Step S240, generating a test result according to the target result message and the specified result message.
[0080] The designated result message in the embodiment of the present application is determined based on the historical result data of the network element device executing the service instruction, and can be carried in the test instruction to indicate the return of the designated result message. The designated result message can also be obtained by manual input, or can also be obtained from a database that pre-stores the mapping relationship between the test instruction and the designated result message. The specific information can be determined according to the actual scenario, and the implementation method of the present application is not limited to this.
[0081] In one embodiment of the present application, the process of generating the test result according to the target result message and the specified result message in step S240 may include the following process, which is described in detail as follows:
[0082] If the target result message matches the specified result message, a test result is generated to indicate that the test is successful;
[0083] If the target result message does not match the specified result message, a test result indicating a test failure is generated.
[0084] As can be seen from the above, the embodiment of the present application can obtain the matching specified result message from the test instruction, and run the test program after receiving the test instruction, obtain the target result message from the multiple result messages contained in the preset result message library through the test program, and generate the test result according to the target result message and the specified result message. In the service execution and instruction verification process of the network element device, the embodiment of the present application can obtain the target result message from the preset result message library through the test program to simulate the return results of various types of network element devices, thereby realizing the test of the service instruction process of the network element device, and obtaining the target result message with the same format as the return message when the network element device actually executes the service. The test method in the embodiment of the present application directly runs the test program on the test platform, and then determines the target result message from the preset result message library and generates the test result. It only needs to construct the preset result message library and simulate the operating environment of the network element device on the test platform to complete the test. There is no need to build a variety of types and a large number of network element devices in the laboratory, which can effectively reduce the test cost of the laboratory environment required to be deployed in the relevant technology. The embodiment of the present application directly simulates the output results of the network element device executing the business through the test program, which can not only realize the simulation of the output of the network element device, but also decouple the simulation process from the actual network element device, thereby maintaining the integrity of the business logic verification process and having the characteristics of simple operation and high security.
[0085] See also Figure 5 , Figure 5 is a flow chart of a test method shown in another exemplary embodiment of the present application. The method can be applied to a test system including Figure 1 The implementation environment of the test system shown in FIG. 1 is executed by the test platform 102 in the test system. It should be understood that the method can also be applied to other exemplary implementation environments and specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.
[0086] In an exemplary embodiment, the testing method includes at least steps S510 to S530, which are described in detail as follows:
[0087] Step S510, obtaining historical result data generated by the network element device executing the service; wherein the historical result data includes result messages of successful service execution, result messages of failed service execution, and result messages of service errors.
[0088] Step S520: acquiring network element device parameters of the network element device and service parameters associated with the service executed by the network element device.
[0089] Step S530: associate and store network element equipment parameters, service parameters, and historical result data in a preset result message library.
[0090] It should be noted that the service parameters, the result messages of successful service execution and the result messages of failed service execution contained in the historical result data are arranged in a preset order to obtain a result message sequence generated by the network element device executing the service corresponding to the service parameters.
[0091] Arrange the result message sequence generated by the network element device executing the service corresponding to each service parameter and the result message when the service error occurs in a preset order to generate a result message sequence corresponding to the network element device;
[0092] The result message sequence corresponding to the network element device is associated and stored in the simulation message database.
[0093] From the above, it can be seen that building a preset result message library through the historical result data generated by the network element device executing the service can ensure the accuracy of the target result message obtained from the preset result message library through the test program, thereby improving the accuracy of the test of the network element device.
[0094] See also Figure 6 , Figure 6 is a flow chart of a test method shown in another exemplary embodiment of the present application. The method can be applied to a test system including Figure 1 The implementation environment of the test system shown in FIG. 1 is executed by the test platform 102 in the test system. It should be understood that the method can also be applied to other exemplary implementation environments and specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.
[0095] The embodiment of the present application is based on the above embodiment. Before receiving the test instruction, the method may further include steps S610 to S620, which are described in detail as follows:
[0096] Step S610, receiving a writing instruction for a test program, and generating a test program according to the writing instruction.
[0097] The writing instructions in the embodiment of the present application may be manually input, and the writing instructions may include information such as the test object, specified result message, test service, etc., and a test program may be generated based on the information contained in the writing instructions.
[0098] The test program in the embodiment of the present application may include the execution process of the network element device executing the service, which can be used to test the logical accuracy and data correctness of the network element device executing the service.
[0099] Step S620, deploying the test program in the terminal device to run the test program in the terminal device to obtain the target result message returned by the test program.
[0100] It should be noted that in the embodiment of the present application, the execution order of the step of receiving the test instruction in step S610 and the step of running the test program in step S620 can also be adjusted, that is, the test platform can run the test program to start the test process after receiving the test instruction; or the test program can receive the test instruction after the test program is running, and this is not limited in the embodiment of the present application.
[0101] As can be seen from the above, the technical solution of the embodiment of the present application generates a test program after receiving the writing instruction of the test program, and different test programs can be generated for the test objects of different network element devices, which greatly improves the test efficiency of different network element devices. In addition, by writing test programs to simulate the output results of the network element devices executing the business, there is no need to build a variety of types and a large number of network element devices in the laboratory, which can effectively reduce the testing cost. In addition, the test platform in the embodiment of the present application can set different writing instructions for different network element devices, so as to generate different test programs. Through a test interface of the test platform, it is possible to implement the testing of multiple network element devices and simulate the output of multiple types of network element devices, which greatly improves the utilization efficiency of the test platform.
[0102] Figure 7 is a block diagram of a test device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The implementation environment shown in the figure is specifically configured in the test platform 102. The device can also be applied to other exemplary implementation environments and specifically configured in other devices. This embodiment does not limit the implementation environment to which the device is applied.
[0103] like Figure 7 As shown, the exemplary test device includes:
[0104] The receiving module 710 is configured to receive a test instruction; wherein the test instruction is used to instruct to return a specified result message.
[0105] The running module 720 is configured to run the test program to obtain a target result message from a plurality of result messages contained in a preset result message library through the test program, and return the target result message.
[0106] The acquisition module 730 is configured to acquire the target result message returned by the test program.
[0107] The generating module 740 is configured to generate a test result according to the target result message and the specified result message.
[0108] In another exemplary embodiment, the operation module 720 includes:
[0109] The running submodule is configured to run a test program to determine, through the test program, a candidate result message that matches the network element device parameters from a plurality of result messages contained in a preset result message library, and to determine, from the candidate result messages, a target result message that matches the service parameters; the test instructions include service parameters associated with executing the service and network element device parameters for executing the service according to the service parameters.
[0110] In another exemplary embodiment, the operation submodule includes:
[0111] The parameter verification unit is configured to perform parameter verification on the business parameters to obtain parameter verification results.
[0112] The target result message determination unit is configured to determine the target result message that matches the business parameters from the result message of successful business execution, the result message of failed business execution, and the result message of business error according to the parameter verification result; the candidate result message includes the result message of successful business execution, the result message of failed business execution, and the result message of business error.
[0113] In another exemplary embodiment, the target result message determining unit includes:
[0114] The first target result message determination subunit is configured to obtain status information from the service parameters if the parameter verification result indicates that the parameter verification is successful, and determine a target result message matching the status information from the result message of successful service execution and the result message of failed service execution according to the status information;
[0115] The second target result message determination subunit is configured to obtain error information from the business parameters if the parameter verification result indicates that the parameter verification has failed, and integrate the error information and the result message of the business error to obtain a target result message that matches the error information.
[0116] In another exemplary embodiment, the generating module 740 includes:
[0117] The first generating submodule is configured to generate a test result for indicating a successful test if the target result message matches the specified result message.
[0118] The second generating submodule is configured to generate a test result for indicating a test failure if the target result message does not match the specified result message.
[0119] In another exemplary embodiment, the testing device may further include:
[0120] A historical result data acquisition module, configured to acquire historical result data generated by the network element device executing the service; wherein the historical result data includes result messages of successful service execution, result messages of failed service execution, and result messages of service errors; and
[0121] A parameter acquisition module, configured to acquire network element device parameters of the network element device and service parameters associated with the network element device executing a service;
[0122] The storage module is configured to associate and store network element equipment parameters, service parameters, and historical result data in a preset result message library.
[0123] In another exemplary embodiment, the testing device may further include:
[0124] A test program generation module, configured to receive a writing instruction for a test program and generate a test program according to the writing instruction;
[0125] The test program deployment module is configured to deploy the test program in the terminal device to run the test program in the terminal device and obtain the target result message returned by the test program.
[0126] It should be noted that the test device provided in the above embodiment and the test method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, and will not be repeated here. In practical applications, the test device provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.
[0127] An embodiment of the present application also provides an electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the electronic device implements the test methods provided in the above-mentioned embodiments.
[0128] Figure 8 The structure diagram of the computer system suitable for implementing the electronic device of the embodiment of the present application is shown. It should be noted that: Figure 8 The computer system 800 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0129] like Figure 8As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 802 or the program loaded from the storage part 808 to the random access memory (RAM) 803, such as executing the method described in the above embodiment. In the RAM 803, various programs and data required for system operation are also stored. The CPU 801, ROM 802 and RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0130] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read therefrom is installed into the storage section 808 as needed.
[0131] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 809, and / or installed from a removable medium 811. When the computer program is executed by a central processing unit (CPU) 801, various functions defined in the system of the present application are executed.
[0132] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0133] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0134] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0135] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the test method as described above is implemented. The computer-readable storage medium can be included in the electronic device described in the above embodiment, or it can exist independently without being assembled into the electronic device.
[0136] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A testing method, characterized in that: include: Receive a test instruction; wherein the test instruction includes a service parameter associated with the execution service and a network element device parameter for executing the service according to the service parameter; the service parameter is an identifier for distinguishing the type of service, and the test instruction is used to instruct to return a specified result message; Running a test program to determine, through the test program, a candidate result message that matches the network element device parameters from a plurality of result messages contained in a preset result message library; the candidate result message includes a result message of successful service execution, a result message of failed service execution, and a result message of service error; Performing parameter verification on the service parameters to obtain parameter verification results; According to the parameter verification result, a target result message matching the service parameters is determined from the result message of successful service execution, the result message of failed service execution, and the result message of service error, and the target result message is returned; Obtain the target result message returned by the test program; Generate a test result according to the target result message and the specified result message.
2. The method according to claim 1, characterized in that The step of determining, according to the parameter verification result, a target result message matching the service parameters from the result message of successful service execution, the result message of failed service execution, and the result message of service error, comprises: If the parameter verification result indicates that the parameter verification is successful, then obtaining status information from the service parameters, and determining a target result message that matches the status information from the result message of successful service execution and the result message of failed service execution according to the status information; If the parameter verification result indicates that the parameter verification has failed, error information is obtained from the business parameters, and the error information and the result message of the business error are integrated and processed to obtain a target result message that matches the error information.
3. The method according to claim 1, characterized in that: The generating a test result according to the target result message and the specified result message includes: If the target result message matches the specified result message, a test result is generated to indicate that the test is successful; If the target result message does not match the specified result message, a test result indicating a test failure is generated.
4. The method according to any one of claims 1 to 3, characterized in that Before receiving the test instruction, the method further includes: Acquire historical result data generated by the network element device executing the service; wherein the historical result data includes result messages of successful service execution, result messages of failed service execution, and result messages of service errors; and Acquire network element device parameters of the network element device and service parameters associated with the network element device executing the service; The network element equipment parameters, the service parameters, and the historical result data are associated and stored in the preset result message library.
5. The method according to any one of claims 1 to 3, characterized in that Before receiving the test instruction, the method further includes: receiving a writing instruction for the test program, and generating the test program according to the writing instruction; The test program is deployed in a terminal device to run the test program in the terminal device to obtain a target result message returned by the test program.
6. A testing device, characterized in that: include: A receiving module configured to receive a test instruction; wherein the test instruction includes a service parameter associated with the execution service and a network element device parameter for executing the service according to the service parameter; the service parameter is an identifier for distinguishing the type of service, and the test instruction is used to instruct to return a specified result message; An operation submodule is configured to run a test program to determine, through the test program, a candidate result message that matches the network element device parameter from a plurality of result messages contained in a preset result message library; the candidate result message includes a result message of successful service execution, a result message of failed service execution, and a result message of a service error; A parameter verification unit, configured to perform parameter verification on the service parameters to obtain a parameter verification result; A target result message determination unit is configured to determine a target result message matching the service parameters from the result message of successful service execution, the result message of failed service execution, and the result message of service error according to the parameter verification result, and return the target result message; An acquisition module, configured to acquire a target result message returned by the test program; A generation module is configured to generate a test result according to the target result message and the specified result message.
7. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the electronic device to implement the testing method as described in any one of claims 1 to 5.
8. A computer-readable medium, characterized in that Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the testing method according to any one of claims 1 to 5.
