A test processing method, apparatus, electronic device, and storage medium

By setting up a standard parsing library for the testing environment, parsing and generating data packets, and defining communication operation interfaces, the problems of repetitive writing of test cases and protocol inconsistency in different environments are solved, and test case reuse and consistency are achieved.

CN121681394BActive Publication Date: 2026-04-21AVIC (CHENGDU) UAS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
AVIC (CHENGDU) UAS CO LTD
Filing Date
2026-02-09
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In software testing, hardware-in-the-loop (HIL) testing, and multi-platform simulation verification, test cases need to be written separately for different operating environments, resulting in high costs of repetitive writing and maintenance, inconsistencies due to differences in protocol implementation, and poor scalability.

Method used

A test processing method is provided, which sets up a standard parsing library for the target test environment, parses test case files and protocol files, generates and verifies data packets, defines communication operation interfaces, and enables the reuse of test cases in different environments.

Benefits of technology

This enables the reuse of test cases in different testing environments, ensuring consistency in protocol and execution results, reducing adaptation work, and lowering the cost of repetitive writing and maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121681394B_ABST
    Figure CN121681394B_ABST
Patent Text Reader

Abstract

This invention provides a test processing method, apparatus, electronic device, and storage medium, relating to the field of software and hardware testing. It provides a standard parsing library specifically for parsing test cases and encapsulating and verifying data packets in environmental testing software within a target testing environment. The standard parsing library takes as input dedicated test case files and protocol files. The test case file contains operation instructions and the names and field values ​​of the data packets involved, clearly defining the operations to be performed and the data packets involved. The protocol file contains the data packet structure attributes corresponding to the data packet names, clearly defining the data packet encapsulation and verification methods. Furthermore, the standard parsing library can define communication operation interfaces corresponding to the operation instructions, and the environmental testing software can implement these communication operation interfaces. Thus, test case parsing and data packet encapsulation and verification can be implemented by the standard parsing library based on dedicated test case files and protocol files, enabling the reuse of test cases in different environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software and hardware testing, and in particular to a testing processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] In software testing, hardware-in-the-loop (HIL) testing, and multi-platform simulation verification, test cases often need to be written separately for different runtime environments. This leads to the need to repeatedly write or extensively modify test cases for the same functionality in different environments, resulting in high costs for rewriting and maintenance. Furthermore, the different methods of parsing and encapsulating data protocols in different testing environments can cause data inconsistencies. Finally, adding a new environment requires extensive adaptation work to existing test cases, resulting in poor scalability.

[0003] Therefore, how to reuse the same set of test cases in different environments while ensuring consistency of protocol and execution results is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0004] The purpose of this invention is to provide a test processing method, apparatus, electronic device, and storage medium that can reuse the same set of test cases in different environments while ensuring protocol consistency and execution effect consistency.

[0005] To solve the above-mentioned technical problems, the present invention provides a testing and processing method, comprising:

[0006] Set up a standard parsing library for the environmental testing software in the target test environment;

[0007] The test case file and protocol file are obtained, and the test case file and protocol file are parsed using the standard parsing library to determine the operation instructions in the test case file, the name and field values ​​of the data packets corresponding to the operation instructions, the data packet structure attributes corresponding to the names in the protocol file, and the communication operation interface corresponding to the operation instructions; wherein, the communication operation interface is defined by the standard parsing library and implemented by the environment testing software;

[0008] The standard parsing library is used to generate a data packet based on the field values ​​and the data packet structure attributes, and the communication operation interface is called to send the data packet to the test object in the target test environment. Alternatively, the standard parsing library is used to call the communication operation interface to receive the data packet sent by the test object, and the data packet is verified based on the field values ​​and the data packet structure attributes.

[0009] Optionally, the communication operation interface includes at least a data sending interface and a data receiving interface;

[0010] The process of generating a data packet using the standard parsing library based on the field values ​​and the data packet structure attributes, and sending the data packet to the test object in the target test environment by calling the communication operation interface, or receiving the data packet sent by the test object by calling the communication operation interface using the standard parsing library, and verifying the data packet based on the field values ​​and the data packet structure attributes, includes:

[0011] When the communication operation interface is the data sending interface, the standard parsing library is used to generate a first data packet based on the field values ​​and the data packet structure attributes, and the data sending interface is called to send the first data packet to the test object;

[0012] When the communication operation interface is the data receiving interface, the standard parsing library is used to call the data receiving interface to receive the second data packet sent by the test object, and the second data packet is verified according to the field values ​​and the data packet structure attributes.

[0013] Optionally, the communication operation interface may further include a custom interface;

[0014] The method further includes:

[0015] When the communication operation interface is the custom interface, the standard parsing library is used to call the custom interface to perform custom operations on the test object.

[0016] Optionally, the environmental testing software utilizes the hardware communication interface or software communication interface of the target testing environment to implement the data sending interface and the data receiving interface.

[0017] Optionally, the test case file and protocol file are parsed using the standard parsing library, including:

[0018] The standard parsing library is used to parse each script statement in the test case file, and the operation instructions, the name of the data packet corresponding to the operation instructions, and the field values ​​are extracted sequentially from each script statement.

[0019] Optionally, the data packet structure attributes include the data packet structure, field types, field value ranges, and data packet encoding rules;

[0020] The step of generating a data packet based on the field values ​​and the data packet structure attributes includes:

[0021] Data packets are generated based on the data packet structure, the field types, the field values, and the field value ranges, and the data packets are encoded according to the data packet encoding rules.

[0022] Serialize the encoded data packet into a binary data stream;

[0023] The step of validating the data packet based on the field values ​​and the data packet structure attributes includes:

[0024] Deserializing a binary data stream yields data packets;

[0025] The data packet is decoded according to the data packet encoding rules, and the fields to be verified in the data packet are verified according to the data packet structure, the field type, the field value, and the field value range.

[0026] Optionally, it also includes:

[0027] If it is determined that the protocol file does not contain the data packet structure attribute corresponding to the name, an error message is output.

[0028] The present invention also provides a test processing apparatus, comprising:

[0029] The configuration module is used to set the standard parsing library for the environmental testing software in the target test environment;

[0030] A unified parsing module is used to obtain test case files and protocol files, parse the test case files and protocol files using the standard parsing library, determine the operation instructions in the test case files, the names and field values ​​of the data packets corresponding to the operation instructions, the data packet structure attributes corresponding to the names in the protocol files, and determine the communication operation interface corresponding to the operation instructions; wherein, the communication operation interface is defined by the standard parsing library and implemented by the environment testing software;

[0031] The testing module is used to generate data packets based on the field values ​​and data packet structure attributes using the standard parsing library, and to send the data packets to the test object in the target test environment by calling the communication operation interface, or to receive data packets sent by the test object by calling the communication operation interface using the standard parsing library, and to verify the data packets based on the field values ​​and data packet structure attributes.

[0032] The present invention also provides an electronic device, comprising:

[0033] Memory, used to store computer programs;

[0034] A processor for implementing the test processing method described above when executing the computer program.

[0035] The present invention also provides a storage medium storing computer-executable instructions, which, when loaded and executed by a processor, implement the test processing method described above.

[0036] This invention provides a test processing method, comprising: setting a standard parsing library for environment testing software in a target test environment; obtaining test case files and protocol files; parsing the test case files and protocol files using the standard parsing library to determine the operation instructions in the test case files, the name and field values ​​of the data packets corresponding to the operation instructions, the data packet structure attributes corresponding to the names in the protocol files, and determining the communication operation interface corresponding to the operation instructions; wherein, the communication operation interface is defined by the standard parsing library and implemented by the environment testing software; generating data packets using the standard parsing library according to the field values ​​and the data packet structure attributes, and calling the communication operation interface to send the data packets to the test object in the target test environment, or calling the communication operation interface using the standard parsing library to receive data packets sent by the test object, and verifying the data packets according to the field values ​​and the data packet structure attributes.

[0037] The beneficial effects of this invention are as follows: This invention can set up a standard parsing library for environmental testing software in the target testing environment, specifically for the parsing of test cases and the encapsulation and verification of data packets. The input to the standard parsing library includes test case files and protocol files. The test case files contain operation instructions and the names and field values ​​of the data packets corresponding to the operation instructions, used to clarify the operations to be performed in the test and the data packets involved in the operations. The protocol files contain data packet structure attributes corresponding to the data packet names, used to clarify the encapsulation and verification methods of the data packets. Furthermore, the standard parsing library can define the communication operation interface corresponding to the operation instructions, and the environmental testing software can implement this communication operation interface. Thus, during the testing process, test cases and protocol files can be obtained, and the standard parsing library can be used to parse the test cases and protocol files to obtain the operation instructions in the test cases, the names and field values ​​of the data packets corresponding to the operation instructions, and the data packet structure attributes corresponding to the names in the protocol files, and to determine the communication operation interface corresponding to the operation instructions. Subsequently, a standard parsing library can be used to generate data packets based on field values ​​and data packet structure attributes. The communication operation interface can then be invoked to send the data packets to the test object in the target test environment. Alternatively, the standard parsing library can be used to receive data packets sent by the test object via the communication operation interface, and the data packets can be verified based on field values ​​and data packet structure attributes. In this way, the present invention can use a unified standard parsing library to implement test case parsing and data packet encapsulation and verification. The test case files and protocol files accompanying the standard parsing library can be used to clearly define the test operation logic and data packet encapsulation and verification methods. Different test environments only require different implementations of the communication operation interface, enabling the reuse of test cases in different test environments while ensuring protocol consistency and consistent execution results.

[0038] The present invention also provides a test processing device, an electronic device, and a storage medium, which have the above-mentioned beneficial effects. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0040] Figure 1 A flowchart of a test processing method provided in an embodiment of the present invention;

[0041] Figure 2 A schematic diagram of the test processing system provided in an embodiment of the present invention;

[0042] Figure 3A flowchart of a cross-environment test case reuse process provided in an embodiment of the present invention;

[0043] Figure 4 A schematic diagram of another test processing flow provided in an embodiment of the present invention;

[0044] Figure 5 This is a structural block diagram of a test processing device provided in an embodiment of the present invention;

[0045] Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0047] In software testing, hardware-in-the-loop (HIL) testing, and multi-platform simulation verification, test cases often need to be written separately for different operating environments. For example, in fields such as drones, automotive electronics, aerospace, and chip verification, test cases for the same function may need to be executed in model-in-the-loop (MIL), software-in-the-loop (SIL), hardware-in-the-loop (HIL), and real hardware environments. In related technologies, test cases are highly tied to the operating environment; protocol definitions, data generation methods, and data transmission interfaces are all environment-dependent, leading to the following problems:

[0048] 1. High cost of repeatedly writing test cases and maintenance: Test cases with the same function need to be repeatedly written or modified in different environments.

[0049] 2. Differences in protocol implementation lead to inconsistencies: Different environments use different methods to parse and encapsulate protocols, which may result in data inconsistencies.

[0050] 3. Poor scalability: When adding a new environment, a lot of adaptation work is required for existing use cases.

[0051] In view of this, to address the technical problem of how to reuse the same set of test cases in different environments while ensuring protocol consistency and execution effect consistency, this invention provides a test processing method that uses a unified standard parsing library to parse test cases and encapsulate and verify data packets, thereby enabling the reuse of test cases in different test environments while ensuring protocol consistency and execution effect consistency.

[0052] For easier understanding, please refer to Figure 1 , Figure 1 A flowchart of a test processing method provided in an embodiment of the present invention, the method may include:

[0053] S101. Set up a standard parsing library for the environmental testing software in the target testing environment.

[0054] In this embodiment, the environment testing software is software deployed in the target testing environment to test software, hardware, and other test objects; the standard parsing library is a dynamic library specifically used for parsing test cases, generating and verifying data packets. In this embodiment, to avoid writing different test cases for environment testing software in different testing environments, a standard parsing library can be set up for the environment testing software, decoupling and separating the functions of test case parsing, data packet generation, and verification from the environment testing software, thereby achieving test case reuse based on the standard parsing library. In this embodiment, the standard parsing library can be written as a cross-platform dynamic library using C++, making it suitable for multiple operating systems and thus facilitating deployment in various testing environments.

[0055] S102. Obtain the test case file and protocol file, and use the standard parsing library to parse the test case file and protocol file to determine the operation instructions in the test case file, the name and field values ​​of the data packets corresponding to the operation instructions, the data packet structure attributes corresponding to the names in the protocol file, and determine the communication operation interface corresponding to the operation instructions; wherein, the communication operation interface is defined by the standard parsing library and implemented by the environment testing software.

[0056] In this embodiment, the standard parsing library has two supporting files: test case files and protocol files.

[0057] Test case files contain test cases written using a unified test script syntax. Each script statement in the file can consist of an operation instruction and data packet information. The operation instruction indicates the communication operation to be performed, such as a data sending operation, a data receiving operation, or other custom operations. The data packet information contains the name and field values ​​of the data packets, indicating the data packets involved in the aforementioned communication operation. Because test case files are parsed independently by a standard parsing library, they do not depend on the specific environment's sending interface or underlying implementation. The following is a specific form of a test case file:

[0058] SendMessage PackageA

[0059] {

[0060] VariableA = 1;

[0061] VariableB=2;

[0062] }

[0063] CheckMessage PackageB

[0064] {

[0065] VariableC=1;

[0066] VariableD=2;

[0067] }

[0068] In this code, SendMessage and CheckMessage are operation instructions. SendMessage is the data sending instruction, corresponding to the data sending operation, and CheckMessage is the data verification instruction, corresponding to the data receiving operation. PackageA{VariableA=1; VariableB=2;} represents the data packet information, where PackageA is the data packet name, and VariableA=1 and VariableB=2 are the values ​​of the VariableA and VariableB fields, respectively. PackageB follows the same logic. It's important to note that the test case file only needs to specify the required communication operation type and data packet information; it does not need to provide the operation logic. Therefore, it does not depend on the specific environment's sending interface or underlying implementation.

[0069] The protocol file uses a unified protocol XML (Extensible Markup Language) format to describe the packet structure attributes of each data packet, standardizing test input and output and clarifying the data interaction protocol during the test process. These packet structure attributes may include: packet structure, field types, field value ranges, and packet encoding rules. The following is a specific form of the protocol file:

[0070] <package name="”PackageA”">

[0071] <field name="”VariableA” / ">

[0072] <field name="”VariableB” / ">

[0073] < / field> < / field> < / package>

[0074] <package name="”PackageB”">

[0075] <field name="”VariableC” / ">

[0076] <field name="”VariableD” / ">

[0077] < / field> < / field> < / package>

[0078] in, <package>This field is used to define a data packet. <field>The fields are used to define the internal structure attributes of the data packet. It's important to note that the data packets declared in the test case file must have a corresponding definition in the protocol file for proper packet encapsulation or parsing.

[0079] Furthermore, in addition to the aforementioned supporting documents, the standard parsing library can also define communication operation interfaces corresponding to the operation instructions, which can then be implemented by the environmental testing software. In other words, the standard parsing library does not need to concern itself with the underlying implementation of data communication; the environmental testing software can implement the underlying communication logic itself based on the communication operation interfaces provided by the standard parsing library. Consequently, the standard parsing library only needs to call the communication operation interfaces implemented by the environmental testing software. Simply put, for environmental testing software in different testing environments, it only needs to adapt the underlying communication logic to different testing environments, without needing to worry about the adaptation of test cases in different testing environments. This effectively reduces adaptation work and allows the reuse of the same test case in different testing environments.

[0080] Specifically, during the testing process, this embodiment can load test case files and protocol files, and use a standard parsing library to parse the test case files and protocol files. This determines the operation instructions in the test case files, the names and field values ​​of the data packets corresponding to the operation instructions, and the data packet structure attributes corresponding to the names in the protocol files, and also determines the communication operation interface corresponding to the operation instructions. Specifically, for multiple script statements in the test case files, the standard parsing library can sequentially extract the operation instructions, the names and field values ​​of the data packets corresponding to the operation instructions from each script statement, and execute each script statement sequentially.

[0081] Based on this, parsing test case files and protocol files using standard parsing libraries can include:

[0082] Step 11: Use the standard parsing library to parse each script statement in the test case file, and extract the operation instructions, the name of the data packet corresponding to the operation instructions, and the field values ​​in each script statement in sequence.

[0083] Additionally, if it is determined that the data packets used in the test case file are not defined in the protocol file, an error message can be output to prompt the tester to add the definition to the protocol file.

[0084] Based on this, the method may also include:

[0085] Step 21: If it is determined that the protocol file does not contain the data packet structure attribute corresponding to the name, then output an error message.

[0086] S103. Use the standard parsing library to generate data packets based on field values ​​and data packet structure attributes, and call the communication operation interface to send the data packets to the test object in the target test environment, or use the standard parsing library to call the communication operation interface to receive data packets sent by the test object, and verify the data packets based on field values ​​and data packet structure attributes.

[0087] In this embodiment, after parsing the test case file and protocol file, the system can choose to assemble and send data packets or receive and parse / verify data packets according to the operation instructions in the test case file. Specifically, to achieve data transmission and reception, the aforementioned communication operation interface includes at least a data sending interface and a data receiving interface. In one implementation, a data packet is generated using a standard parsing library based on field values ​​and data packet structure attributes, and the communication operation interface is called to send the data packet to the test object in the target test environment; or the standard parsing library is used to call the communication operation interface to receive data packets sent by the test object, and the data packet is verified based on field values ​​and data packet structure attributes, including:

[0088] Step 31: When the communication operation interface is a data sending interface, use the standard parsing library to generate the first data packet based on the field values ​​and data packet structure attributes, and call the data sending interface to send the first data packet to the test object.

[0089] Step 32: When the communication operation interface is a data receiving interface, use the standard parsing library to call the data receiving interface to receive the second data packet sent by the test object, and verify the second data packet according to the field values ​​and data packet structure attributes.

[0090] Specifically, environmental testing software utilizes the hardware communication interface (such as a serial port) or software communication interface (such as a network communication interface) of the target testing environment to implement data sending and receiving interfaces.

[0091] Furthermore, the aforementioned data packet structure attributes may include the data packet structure, field types, field value ranges, and data packet encoding rules. In this embodiment, data packet assembly can be performed according to the specifications of the data packet structure attributes; and data packet parsing and verification can be performed according to the specifications of the data packet structure attributes, and field verification can be performed based on the field values ​​in the test case file.

[0092] In one implementation, generating a data packet based on field values ​​and data packet structure attributes includes:

[0093] Step 41: Generate a data packet based on the data packet structure, field type, field value, and field value range, and encode the data packet according to the data packet encoding rules;

[0094] Step 42: Serialize the encoded data packet into a binary data stream.

[0095] In one implementation, the validation of data packets based on field values ​​and data packet structure attributes includes:

[0096] Step 51: Deserialize the binary data stream to obtain data packets;

[0097] Step 52: Decode the data packet according to the data packet encoding rules, and verify the fields to be verified in the data packet according to the data packet structure, field type, field value, and field value range.

[0098] Furthermore, the aforementioned communication operation interface may also include a custom interface. When determining whether the operation instructions in the test case file correspond to a custom operation, the custom interface can be called using the standard parsing library to perform the custom operation on the test object.

[0099] Based on this, the method may also include:

[0100] Step 61: When the communication operation interface is a custom interface, the standard parsing library is used to call the custom interface to perform custom operations on the test object.

[0101] Based on the above embodiments, the present invention can set up a standard parsing library for the environmental testing software in the target testing environment, specifically for parsing test cases and encapsulating and verifying data packets. The input to the standard parsing library includes test case files and protocol files. The test case files contain operation instructions and the names and field values ​​of the data packets corresponding to the operation instructions, used to clarify the operations to be performed in the test and the data packets involved in the operations. The protocol files contain data packet structure attributes corresponding to the data packet names, used to clarify the data packet encapsulation and verification methods. Furthermore, the standard parsing library can define communication operation interfaces corresponding to the operation instructions, which are then implemented by the environmental testing software. During the testing process, test cases and protocol files can be obtained, and the standard parsing library can be used to parse the test cases and protocol files to obtain the operation instructions in the test cases, the names and field values ​​of the data packets corresponding to the operation instructions, and the data packet structure attributes corresponding to the names in the protocol files, thereby determining the communication operation interface corresponding to the operation instructions. Subsequently, a standard parsing library can be used to generate data packets based on field values ​​and data packet structure attributes. The communication operation interface can then be invoked to send the data packets to the test object in the target test environment. Alternatively, the standard parsing library can be used to receive data packets sent by the test object via the communication operation interface, and the data packets can be verified based on field values ​​and data packet structure attributes. In this way, the present invention can use a unified standard parsing library to implement test case parsing and data packet encapsulation and verification. The test case files and protocol files accompanying the standard parsing library can be used to clearly define the test operation logic and data packet encapsulation and verification methods. Different test environments only require different implementations of the communication operation interface, enabling the reuse of test cases in different test environments while ensuring protocol consistency and consistent execution results.

[0102] The above test processing method is described below with reference to specific diagrams. Please refer to... Figure 2 , Figure 2 This is a schematic diagram of a test processing system provided in an embodiment of the present invention. The system may consist of the following parts:

[0103] 1) Software Interface Document (ICD) based on a unified protocol: describes the structure, field types, value ranges and encoding rules of the software's input and output interfaces in a unified protocol XML format.

[0104] 2) Test Cases Based on Standard Scripting Language (CASE): Test cases are written based on a unified test script syntax. The scripts describe the input parameters and expected results through pseudocode and do not depend on the specific environment's sending interface or underlying implementation.

[0105] 3) Cross-Environment Test Case Standard Parser Library (TDP): This library loads both the protocol file and test cases, converting the logic in the scripts into binary stimulus data conforming to the protocol format according to the protocol file definition. Data can be transferred to the adapting software through the interfaces provided by TDP.

[0106] 4) Test Software Adaptation: TDP is introduced in test software for different environments. Based on the characteristics of each environment, TDP provides open send and receive interfaces. For example, real hardware test environments use real serial ports for sending and receiving, while simulation test environments use network protocols. In this way, the same case and ICD can be reused without modification in different test environments.

[0107] Please refer to Figure 3 , Figure 3 A flowchart illustrating a cross-environment test case reuse process provided in this embodiment of the invention demonstrates the interaction process of various modules in the standard parsing library, wherein:

[0108] Protocol parsing module: used to parse IDL protocol files and extract field types, encoding rules, and constraints;

[0109] Script parsing module: Used to parse standardized test case scripts and generate test steps and input data structures;

[0110] Data generation module: Based on the protocol parsing results, converts the test case scripts into binary stimulus data that conforms to the protocol format;

[0111] Reuse execution module: Before running, the underlying implementation of sending and receiving data is registered into the module. During runtime, the corresponding sending method is called according to the environment identifier to send the incentive data to the target environment.

[0112] Please refer to Figure 4 , Figure 4 This is a schematic diagram of another test processing flow provided by an embodiment of the present invention, which fully illustrates the data instruction parsing and sending process.

[0113] The test processing apparatus, electronic device, computer-readable storage medium, and computer program product provided in the embodiments of the present invention will be described below. The test processing apparatus, electronic device, computer-readable storage medium, and computer program product described below can be referred to in correspondence with the test processing method described above.

[0114] Please refer to Figure 5 , Figure 5 This is a structural block diagram of a test processing device provided in an embodiment of the present invention. The device may include:

[0115] Module 501 is used to set the standard parsing library for the environmental testing software in the target test environment.

[0116] The unified parsing module 502 is used to obtain test case files and protocol files, parse the test case files and protocol files using a standard parsing library, determine the operation instructions in the test case files, the names and field values ​​of the data packets corresponding to the operation instructions, the data packet structure attributes corresponding to the names in the protocol files, and determine the communication operation interface corresponding to the operation instructions; wherein, the communication operation interface is defined by the standard parsing library and implemented by the environment testing software;

[0117] Test module 503 is used to generate data packets based on field values ​​and data packet structure attributes using a standard parsing library, and to send data packets to test objects in the target test environment by calling the communication operation interface, or to receive data packets sent by test objects by calling the communication operation interface using a standard parsing library, and to verify the data packets based on field values ​​and data packet structure attributes.

[0118] Optionally, the communication operation interface includes at least a data sending interface and a data receiving interface;

[0119] Test module 503 may include:

[0120] The data sending submodule is used to generate the first data packet based on the field values ​​and data packet structure attributes using the standard parsing library when the communication operation interface is the data sending interface, and then call the data sending interface to send the first data packet to the test object.

[0121] The data verification submodule is used to receive the second data packet sent by the test object by calling the data receiving interface using the standard parsing library when the communication operation interface is the data receiving interface, and to verify the second data packet according to the field values ​​and data packet structure attributes.

[0122] Optionally, the communication operation interface may also include a custom interface;

[0123] Test module 503 may include:

[0124] The custom operation submodule is used to call the custom interface using the standard parsing library when the communication operation interface is a custom interface, so as to perform custom operations on the test object.

[0125] Optionally, the environmental testing software utilizes the hardware or software communication interface of the target testing environment to implement the data sending and receiving interfaces.

[0126] Optionally, the unified parsing module 502 may include:

[0127] The test case file parsing submodule is used to parse each script statement in the test case file using a standard parsing library, and sequentially extract the operation instructions, the name of the data packet corresponding to the operation instructions, and the field values ​​of each script statement.

[0128] Optionally, the data packet structure attributes include the data packet structure, field types, field value ranges, and data packet encoding rules;

[0129] Test module 503 may include:

[0130] The data packet generation submodule is used to generate data packets based on the data packet structure, field types, field values, and field value ranges, and to encode the data packets according to the data packet encoding rules; and to serialize the encoded data packets into a binary data stream.

[0131] The data packet verification submodule is used to deserialize the binary data stream to obtain data packets; decode the data packets according to the data packet encoding rules; and verify the fields to be verified in the data packets according to the data packet structure, field type, field value, and field value range.

[0132] Optionally, the unified parsing module 502 may include:

[0133] The error message submodule is used to output an error message if it is determined that the protocol file does not contain the data packet structure attribute corresponding to the name.

[0134] Please refer to Figure 6 , Figure 6 This is a structural block diagram of an electronic device provided in an embodiment of the present invention. The present invention provides an electronic device 10, including a processor 11 and a memory 12; wherein, the memory 12 is used to store a computer program; the processor 11 is used to execute the test processing method provided in the foregoing embodiment when executing the computer program.

[0135] For details regarding the specific process of the above-mentioned test processing method, please refer to the corresponding content provided in the foregoing embodiments, which will not be repeated here.

[0136] Furthermore, the memory 12, as a carrier for resource storage, can be a read-only memory, random access memory, disk, or optical disk, and the storage method can be temporary storage or permanent storage.

[0137] In addition, the electronic device 10 also includes a power supply 13, a communication interface 14, an input / output interface 15, and a communication bus 16; wherein, the power supply 13 is used to provide operating voltage for each hardware device on the electronic device 10; the communication interface 14 can create a data transmission channel between the electronic device 10 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this invention, and is not specifically limited here; the input / output interface 15 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.

[0138] This invention also provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the test processing method described in the above embodiments.

[0139] Since the embodiments of the computer program product part correspond to the embodiments of the test processing method part, please refer to the description of the embodiments of the test processing method part for the embodiments of the computer program product part, and will not be repeated here.

[0140] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the test processing method described in the above embodiments.

[0141] Since the embodiments of the computer-readable storage medium portion correspond to the embodiments of the test processing method portion, the embodiments of the storage medium portion are described in the description of the embodiments of the test processing method portion, and will not be repeated here.

[0142] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0143] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0144] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0145] The present invention has provided a detailed description of a testing and processing method, apparatus, electronic device, and storage medium. Specific examples have been used to illustrate the principles and implementation methods of the invention. The descriptions of these embodiments are merely illustrative and are intended to aid in understanding the method and core concepts of the invention. It should be noted that those skilled in the art can make various improvements and modifications to the invention without departing from its principles, and these improvements and modifications also fall within the scope of protection of the present invention.< / field> < / package>

Claims

1. A test processing method, characterized in that, include: Set up a standard parsing library for the environmental testing software in the target test environment; The test case file and protocol file are obtained, and the test case file and protocol file are parsed using the standard parsing library to determine the operation instructions in the test case file, the name and field values ​​of the data packets corresponding to the operation instructions, the data packet structure attributes corresponding to the names in the protocol file, and the communication operation interface corresponding to the operation instructions; wherein, the communication operation interface is defined by the standard parsing library and implemented by the environment testing software; The standard parsing library is used to generate a data packet based on the field values ​​and the data packet structure attributes, and the communication operation interface is called to send the data packet to the test object in the target test environment. Alternatively, the standard parsing library is used to call the communication operation interface to receive the data packet sent by the test object, and the data packet is verified based on the field values ​​and the data packet structure attributes.

2. The test processing method according to claim 1, characterized in that, The communication operation interface includes at least a data sending interface and a data receiving interface; The process involves using the standard parsing library to generate a data packet based on the field values ​​and the data packet structure attributes, and then calling the communication operation interface to send the data packet to the test object in the target test environment; or using the standard parsing library to call the communication operation interface to receive the data packet sent by the test object, and verifying the data packet based on the field values ​​and the data packet structure attributes, including: When the communication operation interface is the data sending interface, the standard parsing library is used to generate a first data packet based on the field values ​​and the data packet structure attributes, and the data sending interface is called to send the first data packet to the test object; When the communication operation interface is the data receiving interface, the standard parsing library is used to call the data receiving interface to receive the second data packet sent by the test object, and the second data packet is verified according to the field values ​​and the data packet structure attributes.

3. The test processing method according to claim 2, characterized in that, The communication operation interface also includes a custom interface; The method further includes: When the communication operation interface is the custom interface, the standard parsing library is used to call the custom interface to perform custom operations on the test object.

4. The test processing method according to claim 2, characterized in that, The environmental testing software utilizes the hardware or software communication interface of the target testing environment to implement the data sending interface and the data receiving interface.

5. The test processing method according to claim 1, characterized in that, The test case file and the protocol file are parsed using the standard parsing library, including: The standard parsing library is used to parse each script statement in the test case file, and the operation instructions, the name of the data packet corresponding to the operation instructions, and the field values ​​are extracted sequentially from each script statement.

6. The test processing method according to any one of claims 1 to 5, characterized in that, The data packet structure attributes include the data packet structure, field types, field value ranges, and data packet encoding rules; Generate a data packet based on the field values ​​and the data packet structure attributes, including: Data packets are generated based on the data packet structure, the field types, the field values, and the field value ranges, and the data packets are encoded according to the data packet encoding rules. Serialize the encoded data packet into a binary data stream; Validating the data packet based on the field values ​​and the data packet structure attributes includes: Deserializing a binary data stream yields data packets; The data packet is decoded according to the data packet encoding rules, and the fields to be verified in the data packet are verified according to the data packet structure, the field type, the field value, and the field value range.

7. The test processing method according to claim 6, characterized in that, Also includes: If it is determined that the protocol file does not contain the data packet structure attribute corresponding to the name, an error message is output.

8. A testing and processing apparatus, characterized in that, include: The configuration module is used to set the standard parsing library for the environmental testing software in the target test environment; A unified parsing module is used to obtain test case files and protocol files, parse the test case files and protocol files using the standard parsing library, determine the operation instructions in the test case files, the names and field values ​​of the data packets corresponding to the operation instructions, the data packet structure attributes corresponding to the names in the protocol files, and determine the communication operation interface corresponding to the operation instructions; wherein, the communication operation interface is defined by the standard parsing library and implemented by the environment testing software; The testing module is used to generate data packets based on the field values ​​and data packet structure attributes using the standard parsing library, and to send the data packets to the test object in the target test environment by calling the communication operation interface, or to receive data packets sent by the test object by calling the communication operation interface using the standard parsing library, and to verify the data packets based on the field values ​​and data packet structure attributes.

9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the test processing method as described in any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium stores computer-executable instructions, which, when loaded and executed by a processor, implement the test processing method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Test method and device, electronic equipment and storage medium

    CN117493158A

  • Test case generation method and device, equipment and medium

    CN120234246A