Automatic testing method and device, electronic equipment and storage medium
By introducing multi-functional execution functions in embedded software testing, combining memory and remote testing channels, the problem of insufficient flexibility in CCU system testing is solved, and an efficient and flexible automated testing process is achieved to adapt to the needs of different projects.
Patent Information
- Application Number
- CN202510343447.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-07-04
AI Technical Summary
The prior art lacks flexibility in embedded software testing, especially when data acquisition, control, and energy management of the CCU system of the battery system, the conventional Internet testing framework cannot cover the use cases where environment initialization or other requests functions cannot cover, resulting in low testing efficiency and error-prone.
Provide an automated testing method, by obtaining test case tables, determining the test framework and execution functions, including the first execution function for memory reading and writing, the second execution function for remote testing commands, and the third execution function for use cases that cannot be completed through the first two methods, combining the memory communication interface and the remote testing channel to achieve an efficient and flexible testing process.
It improves the efficiency and accuracy of automated testing of CCU systems, can quickly generate test cases for different projects, enhances the flexibility of testing, and adapts to the needs of environment initialization and other special use cases.
Smart Images

Figure CN120256303A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded software testing, and in particular, to an automated testing method, device, electronic device, and storage medium. Background Art
[0002] Currently, in the traditional embedded software testing process, test cases need to be manually written according to the project requirement document for each project, and differential testing and regression testing are manually performed. This method not only consumes time and effort but also is prone to errors.
[0003] In order to improve testing efficiency and accuracy, in the prior art, generally, interface testing of the Internet is referred to, and test cases are written using Excel based on the requests (request) plugin. The test cases only need to write input parameters and output assertion results.
[0004] However, for the CCU (Charging Control Unit) system that performs data acquisition, control, and energy management on the battery system, the conventional Internet test frames in the prior art are basically written based on the parameter input and output of the requests framework. For use cases that cannot be covered by the initialization of the environment or other requests functions, since the logic is directly written in the test framework in the prior art and cannot be additionally configured in Excel, it lacks flexibility. Summary of the Invention
[0005] In view of this, the purpose of the present invention is to provide an automated testing method, device, electronic device, and storage medium, in which most test scenarios can verify the logic through fixed function calls for input and output, realizing an efficient and flexible testing process.
[0006] In a first aspect, an embodiment of the present invention provides an automated testing method, which is applied to an automated testing system. The testing system is communicatively connected to the system under test. The method includes: obtaining a test case table; determining a test framework and execution functions based on the fields of the test case table; where the execution functions include: a first execution function, a second execution function, and a third execution function; the first execution function is used to perform memory read and write on the system under test, the second execution function is used to execute remote test commands on the system under test, and the third execution function is used to execute use cases that cannot be completed by both memory read and write and remote test commands; the test framework tests the system under test based on the execution functions.
[0007] In an alternative embodiment of the present application, the above test case table includes: a first field, a second field, a third field, a fourth field, a fifth field, a sixth field, a seventh field, and an eighth field; the first field represents whether the test case is executed, the second field represents the precondition before the test case, the third field represents the operation to be performed in the test case, the fourth field represents the waiting time after the test case is executed, the fifth field represents the number of waiting times of the test case, the sixth field represents the number of assertion times of the test case, the seventh field represents the assertion configured for the test case, and the eighth field represents the operation after the test case is executed; the above method further includes: determining whether the test case is executed based on the first field; performing preparatory operations before the execution of the test case based on the second field; determining the operation for executing the test case based on the third field; waiting before the assertion operation based on the fourth field and the fifth field; performing the assertion operation based on the sixth field and the seventh field; and performing the operation after the execution of the test case based on the eighth field.
[0008] In an alternative embodiment of the present application, the step of performing preparatory operations before the execution of the test case based on the second field includes: determining the execution function corresponding to the second field, and performing preparatory operations before the execution of the test case based on the execution function corresponding to the second field; the step of determining the operation for executing the test case based on the third field includes: determining the execution function corresponding to the third field, and executing the operation of the test case based on the execution function corresponding to the third field; the step of performing the assertion operation based on the sixth field and the seventh field includes: determining the number of assertion times corresponding to the sixth field and the execution function corresponding to the seventh field, and performing the assertion operation based on the number of assertion times corresponding to the sixth field and the execution function corresponding to the seventh field.
[0009] In an alternative embodiment of the present application, a memory communication interface channel and a remote test channel are provided between the above test system and the system under test; wherein, the first execution function is executed through the memory communication interface channel, the second execution function is executed through the remote test channel, and the third execution function is executed through the memory communication interface channel and / or the remote test channel.
[0010] In an alternative embodiment of the present application, the step of the above test framework testing the system under test based on the execution function includes: the test framework obtaining the project number and the test case template; the test framework sending the project number to the project platform and receiving the project information corresponding to the project number returned by the project platform; the test framework generating project test cases based on the test case template and the project information; and the test framework testing the system under test based on the project test cases and the execution function.
[0011] In an alternative embodiment of the present application, after the step of the above test framework generating project test cases based on the test case template and the project information, the method further includes: the test framework adding test cases manually written by the user to the project test cases.
[0012] In a second aspect, an embodiment of the present invention further provides an automated test device, which is applied to an automated test system. The test system is communicatively connected to the system under test. The device includes: a test case table acquisition module for acquiring a test case table; a test framework and execution function determination module for determining a test framework and execution functions based on the fields of the test case table; wherein the execution functions include: a first execution function, a second execution function, and a third execution function; the first execution function is used to perform memory read and write operations on the system under test, the second execution function is used to execute remote test commands on the system under test, and the third execution function is used to execute test cases that cannot be completed by both memory read and write operations and remote test commands; an automated test module for testing the system under test by the test framework based on the execution functions.
[0013] In a third aspect, an embodiment of the present invention further provides an electronic device, including a processor and a memory. The memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the above-mentioned automated test method.
[0014] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the above-mentioned automated test method.
[0015] The embodiments of the present invention bring the following beneficial effects:
[0016] The embodiments of the present invention provide an automated test method, device, electronic device, and storage medium, which are applied to an automated test system. The test system is communicatively connected to the system under test; a test case table is acquired; a test framework and execution functions are determined based on the fields of the test case table; wherein the execution functions include: a first execution function, a second execution function, and a third execution function; the first execution function is used to perform memory read and write operations on the system under test, the second execution function is used to execute remote test commands on the system under test, and the third execution function is used to execute test cases that cannot be completed by both memory read and write operations and remote test commands; the test framework tests the system under test based on the execution functions. In this way, most of the test cases of the CCU system can be completed by the first execution function; on this basis, considering that remote test commands are required for environment initialization, a second execution function for executing the command is defined; considering flexibility, a third execution function is also defined in the test framework for test cases that cannot be completed by the above two methods, thereby further improving the flexibility of automated testing.
[0017] Other features and advantages of the present disclosure will be described in the following specification, or, some features and advantages can be inferred from the specification without doubt, or can be learned by implementing the above technologies of the present disclosure.
[0018] In order to make the above objects, features, and advantages of the present disclosure more obvious and understandable, the following will specifically describe preferred embodiments in conjunction with the accompanying drawings as follows. Description of the Drawings
[0019] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0020] Figure 1 It is a flowchart of an automated testing method provided by an embodiment of the present invention;
[0021] Figure 2 It is a flowchart of another automated testing method provided by an embodiment of the present invention;
[0022] Figure 3 It is a schematic diagram of a testing system and a system under test provided by an embodiment of the present invention;
[0023] Figure 4 It is a schematic diagram of generating project test cases provided by an embodiment of the present invention;
[0024] Figure 5 It is a schematic diagram of an actual use case provided by an embodiment of the present invention;
[0025] Figure 6 It is a schematic structural diagram of an automated testing device provided by an embodiment of the present invention;
[0026] Figure 7 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Detailed Embodiments
[0027] In order to make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions of the present invention in conjunction with the drawings. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
[0028] Currently, for the CCU system that collects data, controls, and manages energy for the battery system, the conventional Internet test frames in the prior art are basically written with test cases based on the parameter input and output of the requests framework. For the initialization of the environment or test cases that cannot be covered by other requests functions, since the logic is directly written in the test framework in the prior art and cannot be configured additionally in Excel, it lacks flexibility.
[0029] Based on this, an automated test method, device, electronic device, and storage medium provided by an embodiment of the present invention specifically provide an automated test solution for an embedded system. Most test scenarios can verify the logic through fixed function calls for input and output, realizing an efficient and flexible test process.
[0030] To facilitate the understanding of this embodiment, first, a detailed introduction to an automated test method disclosed by an embodiment of the present invention will be given.
[0031] Embodiment 1:
[0032] An embodiment of the present invention provides an automated test method, which is applied to an automated test system, and the test system is communicatively connected to the system under test. Among them, the system under test in this embodiment can be a CCU system, and the CCU system is used to collect data, control, and manage energy for the battery system.
[0033] Based on the above description, referring to Figure 1 the flowchart of an automated test method shown, this automated test method includes the following steps:
[0034] Step S102, obtain the test case table.
[0035] In this embodiment, the test case table can be obtained first, and multiple fields can be set in the test case table.
[0036] Step S104, determine the test framework and execution functions based on the fields of the test case table.
[0037] Among them, the execution functions include: a first execution function, a second execution function, and a third execution function; the first execution function is used to perform memory read and write on the system under test, the second execution function is used to execute remote test commands on the system under test, and the third execution function is used to execute test cases that cannot be completed by both memory read and write and remote test commands.
[0038] In this embodiment, the test framework and the execution function can be determined based on the fields of the test case table. Among them, multiple execution functions can be set in this embodiment. Most of the test cases can be executed by calling the first execution function and the second execution function with parameters. At the same time, to improve flexibility, for the initialization of the environment and other use cases that cannot be covered by a single function, flexibility can be achieved by means of a custom function (i.e., the third execution function) and corresponding configuration in Excel.
[0039] Therefore, in this embodiment, the manual testing of the CCU system can be transformed into an automated testing model, and a similar automated testing framework can be developed. To further improve flexibility, a third execution function can also be added as a custom function on the basis of the interface automated testing framework and called through the configuration of Excel.
[0040] Step S106, the test framework tests the system under test based on the execution function.
[0041] After determining the test framework and the execution function in this embodiment, the test framework can perform automated testing on the system under test based on the execution function. Among them, since a large part of the functions of different projects of the CCU system are basic functions, and each project imports a requirements confirmation form from an internal platform. Therefore, in this embodiment, project information can also be directly obtained from the confirmation form for generating test cases.
[0042] Therefore, in this embodiment, according to the commonalities and differences of the projects, the requirements confirmation form of each project can be obtained through the company's internal platform. By establishing a test case template and adding the test case template and the project information obtained from the requirements confirmation form to the automated testing framework, the test cases of this project can be generated. By directly obtaining project information from the requirements confirmation form, test cases for different projects can be generated quickly.
[0043] An embodiment of the present invention provides an automated testing method, which is applied to an automated testing system. The testing system is communicatively connected to the system under test; obtain a test case table; determine a test framework and execution functions based on the fields of the test case table; wherein, the execution functions include: a first execution function, a second execution function, and a third execution function; the first execution function is used to perform memory read and write operations on the system under test, the second execution function is used to execute remote test commands on the system under test, and the third execution function is used to execute test cases that cannot be completed by both memory read and write operations and remote test commands; the test framework tests the system under test based on the execution functions. In this way, most of the test cases of the CCU system can be completed by the first execution function; on this basis, considering that remote test commands are required for environment initialization, a second execution function for executing this command is defined; considering flexibility, a third execution function is also defined in the test framework for test cases that cannot be completed by the above two methods, thereby further improving the flexibility of automated testing.
[0044] Embodiment 2:
[0045] This embodiment provides another automated testing method, which is implemented on the basis of the above embodiment. Refer to Figure 2 the flowchart of another automated testing method shown in
[0046] Step S202, obtain a test case table.
[0047] In some embodiments, the above test case table includes: a first field, a second field, a third field, a fourth field, a fifth field, a sixth field, a seventh field, and an eighth field; the first field represents whether the test case is executed, the second field represents the precondition before the test case, the third field represents the operation to be performed in the test case, the fourth field represents the waiting time after the test case is executed, the fifth field represents the number of waiting times of the test case, the sixth field represents the number of assertion times of the test case, the seventh field represents the assertion for configuring the test case, and the eighth field represents the operation after the test case is executed.
[0048] In this embodiment, the structure of the Excel test case table can be defined, including: a first field Exe_Flag, a second field Before_Case, a third field Operate_Case, a fourth field Wait_Time, a fifth field Wait_Times, a sixth field check_time, a seventh field Exe_Result, and an eighth field After_Case.
[0049] Among them, Exe_Flag being 1 indicates that the test case needs to be executed, and 0 indicates not to execute. The preconditions before the test case execution can be configured in Before_Case. The operations to be executed are configured in Operate_Case. Wait_Time represents the waiting time after execution, Wait_Times represents the number of waiting times, check_time represents the number of assertion times, the assertion of the test case is configured in Exe_Result, and some operations to be performed after the test case execution are configured in After_Case.
[0050] Step S204: Determine the test framework and execution functions based on the fields of the test case table. Among them, the execution functions include: the first execution function, the second execution function, and the third execution function. The first execution function is used to perform memory read and write operations on the system under test. The second execution function is used to execute remote test commands on the system under test. The third execution function is used to execute test cases that cannot be completed by both memory read and write operations and remote test commands.
[0051] In some embodiments, it is possible to determine whether to execute a test case based on the first field, perform preparatory operations before the execution of the test case based on the second field, determine the operations for executing the test case based on the third field, wait before the assertion operation based on the fourth and fifth fields, perform the assertion operation based on the sixth and seventh fields, and perform operations after the execution of the test case based on the eighth field.
[0052] This embodiment can build a test framework that can automatically read Excel test cases and develop corresponding functions according to the defined Excel fields.
[0053] For example, after the program internally reads the test data in Excel, the first step is to determine whether the test case needs to be executed. If the value of Exe_Flag read is 1, the test case is executed; if it is 0, the test case is skipped. The second step is to prepare the pre-execution link of the test case and execute the content read in Before_Case. The third step is to execute the test and read the content in Operate_Case, which includes the key operations for the test case execution. The fourth step is to perform the assertion. Read the content in Wait_Time and Wait_Times, which are used to determine the waiting before the assertion. Wait_Time represents the waiting time for one time, and Wait_Times represents the number of waiting cycles. Read the content in Exe_Result and perform the assertion operation, that is, if the expected result is achieved, the test case is successful. Read the content of check_time and determine the number of assertion times according to check_time, which is used for scenarios where the response time of some test results is not particularly certain. The fifth step is to restore the link and read the content in After_Case to execute the operations for restoring the link so as not to affect the execution of the next test case.
[0054] The above is the design for the overall test case loading and execution. The columns of Exe_Flag, Wait_Time, Wait_Times, and check_time are all designed to fill in numbers.
[0055] In some embodiments, the execution function corresponding to the second field can be determined, and preparatory operations before test case execution are performed based on the execution function corresponding to the second field; the execution function corresponding to the third field is determined, and the operation of executing the test case is performed based on the execution function corresponding to the third field; the number of assertions corresponding to the sixth field and the execution function corresponding to the seventh field are determined, and assertion operations are performed based on the number of assertions corresponding to the sixth field and the execution function corresponding to the seventh field.
[0056] In this embodiment, the content written in Before_Case, Operate_Case, and Exe_Result can also be defined in the form of "keyword corresponding to the execution function: parameter, keyword corresponding to the execution function: parameter2...". When there are multiple calls, they are separated by ",". Inside the program, "," is used as the delimiter to extract all the content to be executed, and each piece of content is executed in sequence. After obtaining the keyword of each piece of content, the execution function is determined, and then after obtaining the parameters, the corresponding execution function is executed to achieve this.
[0057] In some embodiments, a memory communication interface channel and a remote test channel are set between the test system and the system under test; among them, the first execution function is executed through the memory communication interface channel, the second execution function is executed through the remote test channel, and the third execution function is executed through the memory communication interface channel and / or the remote test channel.
[0058] Reference can be made to Figure 3 the schematic diagram of a test system and a system under test as shown. The system under test is a CCU system, and it can be installed with a memory call (esccu-rda-rpcsrv) service. The test system and the system under test have two data channels. The memory communication interface channel can access all memory points of the system under test through defined interface rules, and the remote test channel can perform operations such as executing linux commands and file transfer.
[0059] This embodiment can perform manual test analysis based on these two channels and the system under test, define three execution functions and the keywords for configuring and executing the corresponding functions in Excel. The first execution function reads and writes the memory of the object under test. Since the first execution function will be the most commonly used function in writing test cases later, the keyword is omitted and it is executed as the first execution function when no keyword is defined. The second execution function is used to execute remote test commands, and the keyword is defined as "cmd". The third execution function is defined as a custom function. If there are test cases that cannot be completed by directly reading and writing memory and directly executing remote test commands, the third execution function is used. When the third execution function is required, additional function development needs to be done.
[0060] This embodiment can also provide usage examples for each execution function:
[0061] Example 1, a test case that can be completed by directly configuring memory points and remote test commands: For example, it is necessary to write a test case for protection in a system. The use case is that when the monomer overvoltage is severe, the corresponding overvoltage alarm needs to be triggered, and charging, discharging, and tripping are prohibited. Transformed into our memory logic, when the memory point of cluster_clucelvol_up1 is equal to 1, it is asserted that the corresponding event point array_cellvolupwarnl1 = 1, and the memory points for prohibiting charging, discharging, and tripping are array_notchg = 1, array_notdis = 1, array_reqtz = 1. The power reduction needs to be reduced to 0, corresponding to the memory points array_chgltd = 0 and array_disltd = 0. Before executing this use case, it is also necessary to prepare the test environment and turn off the interference of other systems. Before executing this use case, a protection test environment needs to be prepared. The "cmd" keyword is configured in Case_Precondition. Some of the services need to be renamed and then turned off to prevent them from running. Each piece of data is separated by a comma in English. Writing some of the memory points in Operate_Case during environment preparation is also part of the test environment preparation. Reading the corresponding status from the memory of Exe_Result indicates that the test environment is ready.
[0062] Example 2, test cases that cannot be directly completed through memory and remote test command configurations: A test case for process inspection needs to be completed. The actual manual operation process is to copy the written inspection script to the machine under test, execute the script, and check if the log printed by the script contains characters indicating pass or fail of the test. Converting it into an automated test case requires the use of custom functions. We develop a function named cunstom_run_check_process in the test program to copy the test script to the machine under test, execute the script, obtain the execution result, create a text, and place it in the test system. The corresponding keyword in Excel is custom:run_check_process. We also develop a program for corresponding assertions in the test program to find the character indicating pass in the text of the corresponding path and determine that the test case passes. The function name is cunstom_result_check_process, and the corresponding keyword in Excel is custom:result_check_process. Add the corresponding parameter custom:result_check_process (test passed) after the keyword.
[0063] In summary, when there are automated test cases that cannot be directly implemented through memory and remote test commands, the corresponding manual operation process needs to be written into a program, and the corresponding keywords are agreed upon. These keywords can then be used to configure test cases in Excel.
[0064] In step S206, the test framework obtains the project number and the test case template; the test framework sends the project number to the project platform and receives the project information corresponding to the project number returned by the project platform; the test framework generates project test cases based on the test case template and the project information; the test framework tests the system under test based on the project test cases and the execution function.
[0065] In this embodiment, existing manual test cases can be converted into automated test cases, and an automated test case template can be sorted out. For regular projects, parameters can be modified on this automated test case template for direct use.
[0066] See Figure 4 As shown in the schematic diagram of generating project test cases, in this embodiment, an automatic test case generation function is defined in the test framework to automatically generate test cases. Configure the configuration file that the function needs to call and set the project number of the project under test in this file. Running the test case generation function will automatically load the configured test case template, obtain the project number for which test cases need to be generated through the configuration file, obtain some project information corresponding to the project number from the interface of the company's internal project platform, and fill in this project information into the test case template to generate project test cases.
[0067] In some embodiments, the test framework can also add test cases manually written by users to the project test cases.
[0068] Such as Figure 4 As shown, if there is a requirement, test cases manually written by users can also be added to the automatically generated project test cases to obtain the final project test cases.
[0069] After the project test cases are written, the test system can automatically load the test cases according to the configuration and execute the test cases that need to be executed in sequence according to the flag of the cases. The test cases include whether to execute, the preconditions for execution, the execution actions, the waiting time, the assertion content, and the number of assertions. The system can execute the test cases automatically, record the test results, and generate test reports.
[0070] The above method provided by the embodiments of the present invention proposes an automated test system. To achieve interface automation, a memory call (esccu-rda-rpcsrv) service is developed using a memory communication framework. This service is installed in the system under test (which can be a CCU system). The test framework can access all the memory of the system under test in a manner similar to an http request, that is, similar to a database in an Internet system. Most of the test cases of the CCU system can complete the verification of functional cases through the first execution function of memory setting and reading. On this basis, considering that remote test commands are needed for environment initialization, a second execution function and keyword for executing this command are defined. Considering flexibility, a third execution function is also defined in the test framework as a custom function for cases that cannot be completed by the above two methods.
[0071] The above method provided by the embodiments of the present invention compiles a test case template based on the summary of past project tests. Conventional projects can obtain project information from the project platform within the company and generate project test cases based on the test case template and project information.
[0072] Embodiment 3:
[0073] Corresponding to the above method embodiment, the embodiments of the present invention provide a specific example for performing a single-cell voltage mild fault test, which can be seen in Figure 5 the schematic diagram of an actual use case shown in
[0074] I. Test environment preparation: Clear the error code configuration file in the machine under test. Kill the services that interfere with this test. Set some data and assert the corresponding data to confirm that the test environment has been initialized.
[0075] II. Conversion of test environment preparation use cases: Transfer the script that clears the error code configuration file to the device under test through a custom function; execute the script on the device under test through a remote test function. Kill the services that need to be shut down after modifying their names by executing a remote test function on the device under test. Initialize the parameters through a memory communication function and assert that the parameters reach the expected values through a memory communication function.
[0076] III. Single-cell voltage mild fault test: Trigger a single-cell voltage mild fault. Wait for 1 s to perform data assertion. Confirm that the single-cell voltage mild fault has been triggered, i.e., the test passes. If the assertion fails, it will be repeated 5 times. If the number of repetitions is exceeded, the test is judged to fail. Wait for 1 s after the test ends to restore the single-cell voltage fault without affecting the test of the next use case.
[0077] IV. Conversion of single-cell voltage mild fault use cases: Set parameters through a memory communication function to trigger a mild voltage fault. Set the waiting time to 1 s. Set the maximum number of assertions to 5 times and assert that the corresponding parameters reach the expected values through a memory communication function. Set the waiting time after the use case is executed to 1 s. Set parameters through a memory communication function to restore the environment.
[0078] Example 4:
[0079] Corresponding to the above method embodiments, an embodiment of the present invention provides an automated test device, which is applied to an automated test system. The test system is communicatively connected to the device under test. Refer to Figure 6 the structural schematic diagram of an automated test device shown in
[0080] A test case table acquisition module 61, configured to acquire a test case table;
[0081] A test framework and execution function determination module 62, configured to determine a test framework and execution functions based on the fields of the test case table; wherein, the execution functions include: a first execution function, a second execution function, and a third execution function; the first execution function is used to perform memory read and write on the device under test, the second execution function is used to execute remote test commands on the device under test, and the third execution function is used to execute use cases that cannot be completed by both memory read and write and remote test commands;
[0082] An automated test module 63, configured to test the device under test based on the test framework and the execution functions.
[0083] An embodiment of the present invention provides an automated test device, which is applied to an automated test system. The test system is communicatively connected to the system under test; obtains a test case table; determines a test framework and an execution function based on the fields of the test case table; wherein, the execution function includes: a first execution function, a second execution function, and a third execution function; the first execution function is used to perform memory read and write operations on the system under test, the second execution function is used to execute remote test commands on the system under test, and the third execution function is used to execute test cases that cannot be completed by both memory read and write operations and remote test commands; the test framework tests the system under test based on the execution function. In this way, most of the test cases of the CCU system can be completed by the first execution function; on this basis, considering that remote test commands are required for environment initialization, a second execution function for executing this command is defined; considering flexibility, a third execution function is also defined in the test framework for test cases that cannot be completed by the above two methods, thereby further improving the flexibility of automated testing.
[0084] The above test case table includes: a first field, a second field, a third field, a fourth field, a fifth field, a sixth field, a seventh field, and an eighth field; the first field represents whether the test case is executed, the second field represents the precondition before the test case, the third field represents the operation to be performed during the execution of the test case, the fourth field represents the waiting time after the execution of the test case, the fifth field represents the number of waiting times of the test case, the sixth field represents the number of assertion times of the test case, the seventh field represents the assertion configured for the test case, and the eighth field represents the operation after the execution of the test case; the above test framework and execution function determination module is used to determine whether the test case is executed based on the first field; perform preparation operations before the execution of the test case based on the second field; determine the operation for executing the test case based on the third field; wait before the assertion operation based on the fourth field and the fifth field; perform the assertion operation based on the sixth field and the seventh field; perform the operation after the execution of the test case based on the eighth field.
[0085] The above test framework and execution function determination module is used to determine the execution function corresponding to the second field and perform preparation operations before the execution of the test case based on the execution function corresponding to the second field; the above test framework and execution function determination module is used to determine the execution function corresponding to the third field and execute the operation of the test case based on the execution function corresponding to the third field; the above test framework and execution function determination module is used to determine the number of assertion times corresponding to the sixth field and the execution function corresponding to the seventh field and perform the assertion operation based on the number of assertion times corresponding to the sixth field and the execution function corresponding to the seventh field.
[0086] A memory communication interface channel and a remote test channel are provided between the above-mentioned test system and the system under test; among them, the first execution function is executed through the memory communication interface channel, the second execution function is executed through the remote test channel, and the third execution function is executed through the memory communication interface channel and / or the remote test channel.
[0087] The above-mentioned automated test module is used for the test framework to obtain the project number and the test case template; the test framework sends the project number to the project platform and receives the project information corresponding to the project number returned by the project platform; the test framework generates project test cases based on the test case template and the project information; the test framework tests the system under test based on the project test cases and the execution function.
[0088] The above-mentioned automated test module is also used for the test framework to add test cases manually written by users to the project test cases.
[0089] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working process of the above-described automated test device can refer to the corresponding process in the embodiments of the foregoing automated test method, which will not be elaborated herein.
[0090] Embodiment 4:
[0091] The embodiment of the present invention also provides an electronic device for running the above-mentioned automated test method; see Figure 7 The structural schematic diagram of an electronic device shown. The electronic device includes a memory 100 and a processor 101. Among them, the memory 100 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 101 to implement the above-mentioned automated test method.
[0092] Furthermore, Figure 7 The shown electronic device further includes a bus 102 and a communication interface 103, and the processor 101, the communication interface 103, and the memory 100 are connected through the bus 102.
[0093] Among them, the memory 100 may include a high-speed random access memory (RAM, Random Access Memory), and may also include a non-volatile memory, such as at least one disk memory. Through at least one communication interface 103 (which can be wired or wireless), the communication connection between the system network element and at least one other network element can be realized, and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 can be an ISA bus, a PCI bus, an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 7It is represented by only one bidirectional arrow, but it does not mean that there is only one bus or one type of bus.
[0094] The processor 101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor 101 or instructions in the form of software. The above-mentioned processor 101 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by the hardware decoding processor, or executed and completed by the combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and combines its hardware to complete the steps of the method in the foregoing embodiments.
[0095] The embodiments of the present invention also provide a computer-readable storage medium. The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by the processor, the computer-executable instructions cause the processor to implement the above-mentioned automated test method. For the specific implementation, reference can be made to the method embodiments, and details are not described herein again.
[0096] The computer program product of the automated test method, device, electronic device, and storage medium provided by the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods in the foregoing method embodiments. For the specific implementation, reference can be made to the method embodiments, and details are not described herein again.
[0097] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described system and / or device can refer to the corresponding processes in the foregoing method embodiments, and details are not described herein again.
[0098] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "install", "connect", and "couple" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0099] If a function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0100] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.
[0101] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting it. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that any technician familiar with the technical field of the present invention can still modify the technical solutions described in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements for some of the technical features; and these modifications, changes or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. An automated testing method, characterized in that, Applied to an automated test system, the test system is communicatively connected to the system under test, and the method includes: Obtain a test case table; Determine a test framework and execution functions based on the fields of the test case table; wherein, the execution functions include: a first execution function, a second execution function, and a third execution function; the first execution function is used to perform memory read and write on the system under test, the second execution function is used to execute remote test commands on the system under test, and the third execution function is used to execute test cases that cannot be completed by both memory read and write and remote test commands; The test framework tests the system under test based on the execution functions.
2. The method according to claim 1, wherein The test case table includes: a first field, a second field, a third field, a fourth field, a fifth field, a sixth field, a seventh field, and an eighth field; The first field represents whether the test case is executed, the second field represents the precondition before the test case, the third field represents the operation to be performed in the test case, the fourth field represents the waiting time after the test case is executed, the fifth field represents the number of waiting times of the test case, the sixth field represents the number of assertion times of the test case, the seventh field represents the assertion configured for the test case, and the eighth field represents the operation after the test case is executed; The method further includes: determining whether the test case is executed based on the first field; performing preparatory operations before the execution of the test case based on the second field; determining the operation to execute the test case based on the third field; waiting before the assertion operation based on the fourth field and the fifth field; performing the assertion operation based on the sixth field and the seventh field; Performing the operation after the execution of the test case based on the eighth field.
3. The method according to claim 2, characterized in that, The step of performing preparatory operations before the execution of the test case based on the second field includes: determining the execution function corresponding to the second field, and performing preparatory operations before the execution of the test case based on the execution function corresponding to the second field; The step of determining the operation to execute the test case based on the third field includes: determining the execution function corresponding to the third field, and executing the operation of the test case based on the execution function corresponding to the third field; The step of performing the assertion operation based on the sixth field and the seventh field includes: determining the number of assertion times corresponding to the sixth field and the execution function corresponding to the seventh field, and performing the assertion operation based on the number of assertion times corresponding to the sixth field and the execution function corresponding to the seventh field.
4. The method according to claim 1, characterized in that, A memory communication interface channel and a remote test channel are provided between the test system and the system under test; wherein, the first execution function is executed through the memory communication interface channel, the second execution function is executed through the remote test channel, and the third execution function is executed through the memory communication interface channel and / or the remote test channel.
5. The method according to claim 1, wherein The step of the test framework testing the system under test based on the execution functions includes: The test framework obtains a project number and a test case template; The test framework sends the project number to the project platform and receives the project information corresponding to the project number returned by the project platform; The test framework generates project test cases based on the test case template and the project information; The test framework tests the system under test based on the project test cases and the execution functions.
6. The method according to claim 5, characterized in that After the step that the test framework generates project test cases based on the test case template and the project information, the method further includes: The test framework adds test cases manually written by users to the project test cases.
7. An automated testing device, characterized in that, Applied to an automated test system, the test system is communicatively connected to the system under test, and the device includes: A test case table acquisition module, configured to acquire a test case table; A test framework and execution function determination module, configured to determine a test framework and execution functions based on the fields of the test case table; wherein, the execution functions include: a first execution function, a second execution function, and a third execution function; the first execution function is used to perform memory read and write on the system under test, the second execution function is used to execute remote test commands on the system under test, and the third execution function is used to execute test cases that cannot be completed by both memory read and write and remote test commands; An automated test module, configured to test the system under test by the test framework based on the execution functions.
8. An electronic device, characterized in that, It includes a processor and a memory, the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the automated test method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the automated test method according to any one of claims 1 to 6.