Functional block test method and device, equipment, storage medium and program product
By directly conducting functional block testing in computer equipment, the complex problem of test scripts is solved, and an efficient and visual testing process is realized, and testing efficiency and flexibility is improved.
Patent Information
- Application Number
- CN202410005421.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-02
- Publication Date
- 2025-07-08
AI Technical Summary
In the existing functional block testing methods, the writing of test scripts is complicated and it is difficult to efficiently test functional blocks.
By using test blocks in computer equipment to input excitation signals and generate response signals, the functional blocks are tested directly, avoid writing test scripts, and use the test management interface to perform visual operations and display results to achieve a modular test process.
It simplifies the writing process of test scripts, improves the testing efficiency and visualization level, reduces the workload of code development, and improves the management and maintenance capabilities of test results.
Smart Images

Figure CN120276967A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of functional block testing, and particularly to a functional block testing method, device, equipment, storage medium, and program product. Background Art
[0002] A functional block is a basic program unit containing standard processing functions. After writing a functional block, it is necessary to test the functional block to ensure that it meets the design constraints and requirements.
[0003] Currently, the solution for functional block testing is as follows: First, start the test task for the target functional block. In response to the test task, obtain the test case set corresponding to the target functional block, and execute the test scripts corresponding to each test case in the test case set to obtain the test results.
[0004] However, the current functional block testing method has the problem of complex test script writing. Summary of the Invention
[0005] Based on this, in view of the above technical problems, it is necessary to provide a functional block testing method, device, equipment, storage medium, and program product that can reduce the complexity of test script writing.
[0006] In a first aspect, this application provides a functional block testing method. This method is applied to a computer device, and a candidate test case set is deployed on the computer device. The method includes:
[0007] Determine a set of test cases to be tested from the candidate test case set;
[0008] Input an excitation signal to the functional block to be tested in the set of test cases to be tested through the output interface of the test block in the set of test cases to be tested; the test block is created based on the function of the functional block to be tested;
[0009] Generate a response signal based on the excitation signal, and send the response signal to the test block through the output interface of the functional block to be tested;
[0010] Obtain the test result of the set of test cases to be tested according to the response signal.
[0011] In the embodiments of this application, inputting an excitation signal to the functional block to be tested in the set of test cases to be tested through the output interface of the test block can achieve the test of the functional block to be tested without writing a test script, thereby reducing the complexity of test script writing.
[0012] In one of the embodiments, the method further includes:
[0013] Determine a target sub-test block from sub-test blocks with different functions according to the test requirement information of the functional block to be tested;
[0014] Obtain a test block according to a target sub - test block.
[0015] In an embodiment of the present application, by determining a target sub - test block from sub - test blocks with different functions according to the test requirement information of a function block to be tested, the target sub - test blocks can be further spliced into a test block, thereby achieving the effect of generating a test block with complex logic by combining and splicing sub - test blocks with simple logic, improving the reuse efficiency of sub - test blocks, reducing the code development workload, and simplifying the code structure of the test case set to be tested, i.e., the test project.
[0016] In one embodiment, determining the test case set to be tested from a candidate test case set includes:
[0017] Obtain an operation instruction based on a test management interface;
[0018] In response to the operation instruction, determine the test case set to be tested from the candidate test case set.
[0019] In an embodiment of the present application, since the test case set to be tested is determined based on a test management interface, and the test case set to be tested includes a test block and a function block to be tested, the visualization of the test block and the function block to be tested in the test case set to be tested is realized. Further, since the function block to be tested and the test block are modularized, the structure of the test case set to be tested is clearer, the flexibility of developing the test case set to be tested is improved, the test case set to be tested is convenient to maintain, and the development efficiency of the test case set to be tested is enhanced.
[0020] In one embodiment, obtaining an operation instruction based on a test management interface includes:
[0021] In response to a triggering operation on a target control in a test case set selector in the test management interface, obtain the operation instruction.
[0022] In an embodiment of the present application, a user can perform a triggering operation on a target control in a test case set selector in the test management interface, thereby facilitating the user to visually select the test case set to be tested and meeting the test requirements.
[0023] In one embodiment, the method further includes:
[0024] Obtain the test results of each test case set to be tested;
[0025] According to the test results of each test case set to be tested, determine the statistical results of each test case set to be tested.
[0026] In an embodiment of the present application, since the test results of each test case set to be tested can be summarized to obtain statistical results, it is convenient to manage the test case set to be tested.
[0027] In one embodiment, the method further includes:
[0028] Display the test results of the test case set to be tested on the test management interface, and / or display the statistical results on the test management interface.
[0029] In the embodiments of the present application, by displaying the test results and / or statistical results on the test management interface, software developers can be assisted in locating the cause of errors and the management efficiency of each test case set to be tested can be improved.
[0030] In one of the embodiments, inputting an excitation signal to the functional block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested includes:
[0031] When the test block in the test case set to be tested receives an enable signal, input an excitation signal to the functional block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested.
[0032] The test block in the present application can receive an enable signal. When the enable signal is received, an excitation signal is input to the functional block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested, and then the test results are obtained. That is, as long as an enable signal is input to the test block, the test process can be triggered, thereby realizing one-key testing.
[0033] In one of the embodiments, obtaining the test results of the test case set to be tested by the test block according to the response signal includes:
[0034] Obtain the first parameter information by using the parameter interface of the test block;
[0035] Obtain the test results of the test case set to be tested by the test block according to the first parameter information and the response signal.
[0036] In the embodiments of the present application, the test block can obtain the test results of the test case set to be tested according to the first parameter information and the response signal, thereby realizing the testing of the test case set to be tested.
[0037] In one of the embodiments, generating a response signal by the functional block to be tested based on the excitation signal includes:
[0038] Obtain the second parameter information by using the parameter interface of the functional block to be tested, and generate a response signal by the functional block to be tested based on the second parameter information and the excitation signal.
[0039] In the embodiments of the present application, the second parameter information can be obtained by using the parameter interface of the functional block to be tested, and a response signal is generated based on the second parameter information and the excitation signal, so that the test block can obtain the test results based on the response signal and realize the testing of the functional block to be tested.
[0040] In a second aspect, the present application also provides a functional block testing device. The device is arranged in a computer device, and the computer device is deployed with a candidate test case set. The device includes:
[0041] A first determination module, configured to determine a to-be-tested case set from the candidate test case set;
[0042] A first sending module, configured to input an excitation signal to a to-be-tested functional block in the to-be-tested case set through an output interface of a test block in the to-be-tested case set; the test block is created based on the function of the to-be-tested functional block;
[0043] A second sending module, configured to generate a response signal based on the excitation signal through the to-be-tested functional block, and send the response signal to the test block through an output interface of the to-be-tested functional block;
[0044] An acquisition module, configured to obtain a test result of the to-be-tested case set through the test block according to the response signal.
[0045] In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the method provided in the above embodiment are implemented.
[0046] In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method provided in the above embodiment are implemented.
[0047] In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the method provided in the above embodiment are implemented.
[0048] The above description is only an overview of the technical solution of the present application. In order to be able to understand the technical means of the present application more clearly, it can be implemented according to the content of the specification. And in order to make the above and other purposes, features and advantages of the present application more obvious and understandable, the following specifically illustrates the specific implementation manners of the present application. Description of the Drawings
[0049] By reading the detailed description of the preferred embodiments below, various other advantages and benefits will become clear to those of ordinary skill in the art. The drawings are only for the purpose of showing the preferred embodiments and are not considered to be a limitation of the present application. And in all the drawings, the same reference numerals are used to represent the same components. In the drawings:
[0050] Figure 1 It is the internal structure diagram of the computer device in one embodiment;
[0051] Figure 2It is a schematic flowchart of a functional block testing method provided by an embodiment of the present application;
[0052] Figure 3 It is a schematic diagram of a candidate test case set provided by an embodiment of the present application;
[0053] Figure 4 It is a schematic flowchart of a test block determination method provided by an embodiment of the present application;
[0054] Figure 5 It is a schematic flowchart of a test case set to be tested determination method provided by an embodiment of the present application;
[0055] Figure 6 It is a schematic diagram of a test management interface provided by an embodiment of the present application;
[0056] Figure 7 It is a schematic flowchart of a statistical result determination method provided by an embodiment of the present application;
[0057] Figure 8 It is a schematic flowchart of a test result acquisition method provided by an embodiment of the present application;
[0058] Figure 9 It is a schematic structural diagram of a test block provided by an embodiment of the present application;
[0059] Figure 10 It is a schematic diagram of a specific example of a functional block testing method provided by an embodiment of the present application;
[0060] Figure 11 It is a schematic structural diagram of a functional block testing device provided by an embodiment of the present application;
[0061] Figure 12 It is a schematic structural diagram of another functional block testing device provided by an embodiment of the present application. Detailed implementation manners
[0062] Next, embodiments of the technical solution of the present application will be described in detail with reference to the accompanying drawings. The following embodiments are only used to illustrate the technical solution of the present application more clearly, so they are only examples and cannot be used to limit the protection scope of the present application.
[0063] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs; the terms used herein are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" and any variations thereof in the specification and claims of this application and the above accompanying drawings are intended to cover non-exclusive inclusion.
[0064] In the description of the embodiments of the present application, technical terms such as "first" and "second" are only used to distinguish different objects, and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity, specific order or primary-secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "a plurality of" is more than two, unless otherwise specifically defined.
[0065] Mentioning "embodiment" in this context means that the specific features, structures or characteristics described in connection with the embodiment may be included in at least one embodiment of the present application. The phrase appearing in various positions in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0066] In the description of the embodiments of the present application, the term "and / or" is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this text generally represents an "or" relationship between the associated objects before and after.
[0067] In the description of the embodiments of the present application, the term "a plurality of" means more than two (including two). Similarly, "a plurality of groups" means more than two groups (including two groups), and "a plurality of pieces" means more than two pieces (including two pieces).
[0068] In the description of the embodiments of the present application, technical terms such as "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", "axial", "radial", "circumferential", etc. indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the embodiments of the present application and simplifying the description, rather than indicating or implying that the indicated device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be construed as a limitation on the embodiments of the present application.
[0069] In the description of the embodiments of the present application, unless otherwise clearly specified and limited, technical terms such as "installation", "connection", "connection", "fixation", etc. should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or integrated; it can also be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and can be the communication inside two elements or the interaction relationship between two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to specific circumstances.
[0070] A function block is a basic program unit containing standard processing functions. After writing the function block, it is necessary to test the function block to ensure that it meets the design constraints and requirements.
[0071] Currently, the function block testing solution is as follows: First, start the test task for the target function block. In response to the test task, obtain the test case set corresponding to the target function block, and execute the test scripts corresponding to each test case in the test case set to obtain the test results.
[0072] However, the current function block testing method has the problem of complex test script writing.
[0073] To solve the above technical problems, in an embodiment of the present application, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 1 shown. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a function block testing method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the computer device housing, or an external keyboard, touchpad, or mouse, etc.
[0074] Those skilled in the art can understand that Figure 1 the structure shown in
[0075] is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements. Figure 2 shown, Figure 2 is a schematic flowchart of a function block testing method provided by an embodiment of the present application. This method is applied to the computer device shown in Figure 1 The computer device is deployed with a candidate test case set, and each candidate test case set includes a test block and a function block to be tested. This method includes the following steps S201 - S204:
[0076] S201. Determine the test case set to be tested from the candidate test case set.
[0077] In a possible implementation, an operation instruction can be obtained based on the test management interface. In response to the operation instruction, the test case set to be tested is determined from the candidate test case set. Exemplarily, a test management interface can be displayed on a computer device. Multiple candidate test case sets can be displayed on the test management interface. A user can click on the candidate test case set to be tested. The computer device can obtain the operation instruction in response to the click operation and use the candidate test case set selected by the user through clicking as the test case set to be tested based on the operation instruction.
[0078] In another possible implementation, a configuration file can be stored on the computer device. A user can modify the information in the configuration file to select the candidate test case set to be tested from the configuration file. Correspondingly, the computer device can use the candidate test case set selected by the user as the test case set to be tested according to the information in the modified configuration file.
[0079] S202. Input an excitation signal to the function block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested; the test block is created based on the function of the function block to be tested.
[0080] As Figure 3 shown, Figure 3 is a schematic diagram of a candidate test case set provided by an embodiment of the present application. The candidate test case set includes a function block 301 and a test block 302. The test block 302 is created based on the function of the function block 301 and can form a test block 302 corresponding to the function of the function block 301 through logic or code combination. Exemplarily, for example, when the function of the function block 301 is that after receiving a fault signal from module A, the function block 301 can execute the operation of switching from module A to module B, and module B replaces module A to work and outputs a response signal. Then the test block has the function of being able to judge whether the function block 301 correctly executes the action of switching from module A to module B based on the response signal.
[0081] Among them, the function block 301 is provided with an input interface 3011 and an output interface 3012. The number of the input interface 3011 and the output interface 3012 can be at least one, and the number of the input interface 3011 and the output interface 3012 can be equal or not equal. The test block 302 is provided with an input interface 3021 and an output interface 3022. The number of the input interface 3021 and the output interface 3022 can be at least one, and the number of the input interface 3021 and the output interface 3022 can be equal or not equal.
[0082] The test case set to be tested can include one or more candidate test case sets in the candidate test case sets. Taking the candidate test case set shown in Figure 3 as the test case set to be tested, the test block in the test case set to be tested is the test block 302 shown in Figure 3 , and the function block to be tested in the test case set to be tested is the function block 301 shown in Figure 3 .
[0083] Among them, the output interface 3022 of the test block 302 is connected to the input interface 3011 of the function block 301, and the output interface 3012 of the function block 301 is connected to the input interface 3021 of the test block 302. Since the output interface 3022 of the test block 302 is connected to the input interface 3011 of the function block 301, the test block can input an excitation signal to the function block based on this connection. Exemplarily, the excitation signal can include but is not limited to a power failure signal, a module failure signal, a high-level signal, and a low-level signal.
[0084] S203, generating a response signal based on the excitation signal through the function block to be tested, and sending the response signal to the test block through the output interface of the function block to be tested.
[0085] The computer device generates a response signal based on the excitation signal through the function block to be tested, and sends the response signal to the test block through the output interface of the function block to be tested. Exemplarily, taking the excitation signal as the module failure signal of module A, and the function block to be tested responds based on the module failure signal, module A can be switched to module B. If the function block to be tested can normally switch module A to module B, the response signal can indicate that the function block to be tested has normally executed the module switch, and the module switching function of the function block to be tested is normal. After the function block to be tested generates the response signal, the response signal can be sent to the test block through the output interface of the function block to be tested.
[0086] It should be noted that multiple excitation signals can be input into the function block to be tested in the test case set to be tested through multiple output interfaces of the test block in the test case set to be tested. That is, one output interface of the test block can input one excitation signal into the function block to be tested through one input interface of the function block to be tested. By using multiple output interfaces of the test block in the test case set to be tested, multiple excitation signals can be input into the function block to be tested in the test case set to be tested. In this case, the function block to be tested can generate a response signal based on multiple excitation signals. Exemplarily, when the function block to be tested receives both the fault signal of module A and the fault signal of module B at the same time, the function block to be tested can determine which fault signal to respond to first according to the preset fault handling priority. If it is necessary to respond to the fault signal of module A first, the response signal can indicate whether the fault signal of module A is preferentially responded to according to the fault handling priority. If the response signal indicates that the fault signal of module A is preferentially responded to according to the fault handling priority, it means that the fault response function of the function block to be tested is normal. If the response signal indicates that the fault signal of module A is not preferentially responded to according to the fault handling priority, it means that the fault response function of the function block to be tested is abnormal.
[0087] S204. Obtain the test result of the test case set to be tested through the test block according to the response signal.
[0088] The computer device can obtain the test result of the test case set to be tested through the test block according to the response signal. Exemplarily, if the module switching function of the function block to be tested is normal, the test result is that the test case set to be tested passes the test. If the module switching function of the function block to be tested is abnormal, the test result is that the test case set to be tested fails the test. The test result can include content such as an exception code and log information.
[0089] In the embodiments of the present application, the test of the function block to be tested can be realized by inputting an excitation signal into the function block to be tested in the test case set to be tested through the output interface of the test block, without writing a test script, thereby reducing the complexity of writing the test script.
[0090] Refer to Figure 4 , Figure 4 is a schematic flowchart of a method for determining a test block provided by an embodiment of the present application. On the basis of the above embodiments, the method may include the following steps S401-S402:
[0091] S401. Determine a target sub-test block from sub-test blocks with different functions according to the test requirement information of the function block to be tested.
[0092] In the embodiments of the present application, sub-test blocks with different basic functions can be developed. In practical applications, according to the test requirement information of the function block to be tested, a target sub-test block can be determined from the sub-test blocks with different functions, and the target sub-test blocks can be spliced into a test block. Exemplarily, sub-test blocks with basic functions such as addition, subtraction, multiplication, and division can be developed, so that these four sub-test blocks with different functions can be spliced into a test block with complex functions, such as a test block with the ability of mixed addition, subtraction, multiplication, and division operations.
[0093] S402. Obtain a test block according to the target sub-test block.
[0094] In the embodiments of the present application, by determining the target sub-test block from the sub-test blocks with different functions according to the test requirement information of the function block to be tested, the target sub-test blocks can be further spliced into a test block, thereby achieving the effect of generating a test block with complex logic by combining and splicing sub-test blocks with simple logic, improving the reuse efficiency of sub-test blocks, reducing the code development workload, and simplifying the code structure of the test case set to be tested, i.e., the test project.
[0095] Refer to Figure 5 , Figure 5 FIG. is a schematic flowchart of a method for determining a test case set provided by an embodiment of the present application. On the basis of the above embodiments, the above S201 may include the following steps S501-S502:
[0096] S501. Obtain an operation instruction based on the test management interface.
[0097] Multiple candidate test case sets may be displayed on the test management interface. The user can click on the candidate test case set to be tested, and correspondingly, the computer device obtains the click operation instruction. Or, the user can also double-click on the candidate test case set to be tested, and correspondingly, the computer device can obtain the operation instruction in response to the double-click operation. Or, the user uses a stylus to trigger the candidate test case set to be tested, and correspondingly, the computer device can obtain the operation instruction in response to the trigger operation. It should be noted that obtaining the operation instruction based on the test management interface includes, but is not limited to, the above-exemplified methods.
[0098] S502. Determine the test case set to be tested from the candidate test case sets in response to the operation instruction.
[0099] Based on the operation instruction, the computer device uses the candidate test case set selected by the user through clicking as the test case set to be tested.
[0100] In the embodiments of the present application, since the test case set to be tested is determined based on the test management interface, and the test case set to be tested includes test blocks and function blocks to be tested, the visualization of the test blocks and function blocks to be tested in the test case set to be tested is realized. Further, since the function blocks to be tested and the test blocks are modularized, the structure of the test case set to be tested becomes clearer, the flexibility of developing the test case set to be tested is improved, it is convenient to maintain the test case set to be tested, and the development efficiency of the test case set to be tested is enhanced.
[0101] In one of the embodiments, based on the above embodiment, for the above S501, obtaining the operation instruction based on the test management interface can be implemented in the following manner:
[0102] In response to the triggering operation on the target control in the test case set selector in the test management interface, obtain the operation instruction.
[0103] As Figure 6 shown, Figure 6 FIG. is a schematic diagram of a test management interface provided by an embodiment of the present application. A test case set selector 601 can be displayed on the test management interface. A drop-down list can be displayed in the test case set selector 601, and the target control includes the drop-down list. After the user clicks the drop-down list, multiple candidate test case sets can be displayed, and the candidate test case set to be tested is clicked and selected from the multiple candidate test case sets. Correspondingly, the computer device can obtain the operation instruction in response to the click operation, and based on the operation instruction, use the candidate test case set selected by the user through clicking as the test case set to be tested, without writing a test script as the test case set to be tested, thereby reducing the complexity of the function test of the function blocks to be tested in the test case set to be tested and enhancing the construction efficiency of the test case set to be tested.
[0104] In the embodiments of the present application, the user can perform a triggering operation on the target control in the test case set selector in the test management interface, so as to facilitate the user to visually select the test case set to be tested and meet the test requirements.
[0105] Referring to Figure 7 , Figure 7 FIG. is a schematic flowchart of a method for determining a statistical result provided by an embodiment of the present application. Based on the above embodiment, the method may include the following steps S701-S702:
[0106] S701, obtain the test results of each test case set to be tested.
[0107] The test blocks in each test case set to be tested can output the test results to the management module 602. Correspondingly, the management module obtains the test results of each test case set to be tested.
[0108] S702, determine the statistical results of each test case set to be tested according to the test results of each test case set to be tested.
[0109] The statistical results may include, but are not limited to, result statistics items such as the test coverage rate of the test case set to be tested, the unqualified test case set to be tested, the pass rate of the test case set to be tested, error codes, etc. The unqualified test case set to be tested refers to the test case set to be tested whose test result is that the test fails.
[0110] In the embodiments of the present application, since the test results of each test case set to be tested can be summarized to obtain statistical results, it is convenient to manage the test case set to be tested.
[0111] In one of the embodiments, the method may include the following steps:
[0112] Display the test results of the test case set to be tested on the test management interface, and / or display the statistical results on the test management interface.
[0113] In the embodiments of the present application, by displaying the test results and / or statistical results on the test management interface, software developers can be assisted in locating the cause of errors and the management efficiency of each test case set to be tested can be improved.
[0114] In one of the embodiments, for the above S202, inputting an excitation signal to the function block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested may include the following steps:
[0115] In the embodiments of the present application, when the test block in the test case set to be tested receives an enable signal, an excitation signal is input to the function block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested.
[0116] The test block in the present application can receive an enable signal. When the enable signal is received, an excitation signal is input to the function block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested, and then the test result is obtained. That is, as long as an enable signal is input to the test block, the test process can be triggered, thereby realizing one-key testing.
[0117] Refer to Figure 8 , Figure 8 is a schematic flowchart of a method for obtaining a test result provided by an embodiment of the present application. This embodiment relates to a possible implementation manner of how to obtain the test result of the test case set to be tested according to the response signal. On the basis of the above embodiment, the above S204 may include the following steps S801 - S802:
[0118] S801, obtain first parameter information by using the parameter interface of the test block.
[0119] As Figure 9 shown, Figure 9This is a schematic structural diagram of a test block provided by an embodiment of the present application. The test block includes an input interface, an output interface, a parameter interface, and a logic processing module. The first parameter information can be obtained through Figure 9 the parameter interface of the test block shown in. The first parameter information includes, for example, the mode information and the delay duration of the parameter interface of the test block. The mode information can be an enable mode, a non-enable mode, or other modes. When the mode information is the enable mode, the parameter of the delay duration can be obtained by using the parameter interface of the test block. When the mode information is the non-enable mode, the parameter of the delay duration cannot be obtained by using the parameter interface of the test block.
[0120] S802. The test block obtains the test result of the to-be-tested use case set according to the first parameter information and the response signal.
[0121] Among them, the test block can obtain the test result of the to-be-tested use case set according to the first parameter information and the response signal. Exemplarily, when the first parameter information obtained by the test block includes the delay duration, the test result can be determined or output after delaying the delay duration.
[0122] In the embodiment of the present application, the test block can obtain the test result of the to-be-tested use case set according to the first parameter information and the response signal, so as to implement the test of the to-be-tested use case set.
[0123] In one of the embodiments, the generation of the response signal based on the excitation signal in S203 above can be implemented in the following manner:
[0124] The second parameter information is obtained by using the parameter interface of the to-be-tested functional block, and the response signal is generated based on the second parameter information and the excitation signal by the to-be-tested functional block.
[0125] The to-be-tested functional block has a parameter interface. The second parameter information can be obtained through the parameter interface, and the number of parameter interfaces can be at least one. The second parameter information can include, but is not limited to, parameters such as the delay duration. Exemplarily, when the second parameter information includes the delay duration, the to-be-tested functional block can delay the delay duration after receiving the excitation signal and then generate the response signal based on the excitation signal.
[0126] In the embodiment of the present application, the second parameter information can be obtained by using the parameter interface of the to-be-tested functional block, and the response signal is generated based on the second parameter information and the excitation signal, so that the test block can obtain the test result based on the response signal and implement the test of the to-be-tested functional block.
[0127] For a clearer introduction of the embodiments of the present application, the following is combined with Figure 10 for description. Refer to Figure 10 , Figure 10It is a schematic diagram of a specific example of a function block test method provided by an embodiment of the present application. This diagram shows a test case set for testing the bypass function of an energy storage valve. This test case set includes a function block to be tested for a bypass function of the energy storage valve and a test block 1001 corresponding to this function block to be tested. This function block to be tested includes a sending sub-module 1002 and a receiving sub-module 1003. Connect the output interface of the test block 1001 to the input interface of the receiving sub-module 1003, connect the output interface of the sending sub-module 1002 to the input interface of the test block 1001, and connect the output interface of the receiving sub-module 1003 to the input interface of the sending sub-module 1002.
[0128] During the operation of the test project, that is, during the operation of this test case set, the test block 1001 receives an enable signal, outputs a fault signal message, outputs this fault signal message to the receiving sub-module 1003. The receiving sub-module 1003 receives the fault signal message and parses this fault signal message to obtain fault information. After the receiving sub-module 1003 performs internal logic processing based on this fault information to obtain an energy storage valve bypass signal, the receiving sub-module 1003 outputs this bypass signal to the sending sub-module 1002. The sending sub-module 1002 sends this bypass signal to the test block 1001. After the test block 1001 receives this bypass signal, it determines whether the bypass function is correct based on the bypass signal. If it is determined that the bypass function is correct, the test result output by the test block is that the test passes, and the test of the bypass function is completed.
[0129] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are sequentially shown according to the indication of the arrows, these steps do not necessarily need to be executed in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps does not have a strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages do not necessarily need to be executed at the same moment, but can be executed at different moments. The execution order of these steps or stages does not necessarily need to be sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0130] Based on the same inventive concept, an embodiment of the present application also provides a function block test device for implementing the function block test method involved above. The implementation solutions provided by this device to solve problems are similar to the implementation solutions described in the above method. Therefore, the specific limitations in one or more embodiments of the function block test device provided below can refer to the limitations on the function block test method in the above text, and will not be repeated here.
[0131] In one embodiment, as Figure 11 shownFigure 11 FIG. Figure 11 is a schematic structural diagram of a functional block testing device provided by an embodiment of the present application. The device 1100 is disposed in a computer device, and a candidate test case set is deployed in the computer device. The device 1100 includes:
[0132] A first determination module 1101, configured to determine a test case set to be tested from the candidate test case set.
[0133] A first sending module 1102, configured to input an excitation signal to a functional block to be tested in the test case set to be tested through an output interface of a test block in the test case set to be tested; the test block is created based on the function of the functional block to be tested;
[0134] A second sending module 1103, configured to generate a response signal based on the excitation signal through the functional block to be tested, and send the response signal to the test block through an output interface of the functional block to be tested;
[0135] An acquisition module 1104, configured to obtain a test result of the test case set to be tested by the test block according to the response signal.
[0136] In this embodiment, the first sending module 1102 inputs an excitation signal to the functional block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested, that is, the test block in the test case set to be tested inputs an excitation signal to the functional block to be tested through the output interface of the test block. The second sending module 1103 is configured to generate a response signal based on the excitation signal through the functional block to be tested, and send the response signal to the test block through the output interface of the functional block to be tested, that is, the functional block to be tested is configured to generate a response signal based on the excitation signal, and send the response signal to the test block through the output interface of the functional block to be tested. The acquisition module 1104 is configured to obtain a test result of the test case set to be tested by the test block according to the response signal, that is, the test block is configured to obtain a test result of the test case set to be tested according to the response signal.
[0137] In one embodiment, as Figure 12 shown, Figure 12 FIG. Figure 12 is a schematic structural diagram of another functional block testing device provided by an embodiment of the present application. The device 1200 includes:
[0138] A second determination module 1201, configured to determine a target sub-test block from sub-test blocks with different functions according to test requirement information of the functional block to be tested; and obtain a test block according to the target sub-test block.
[0139] In one embodiment, the first determination module 1101 includes:
[0140] An acquisition unit 11011, configured to obtain an operation instruction based on a test management interface;
[0141] A determination unit 11012, configured to determine a test case set to be tested from a candidate test case set in response to an operation instruction.
[0142] In one embodiment, an acquisition unit 11011 is specifically configured to acquire an operation instruction in response to a triggering operation on a target control in a test case set selector in a test management interface.
[0143] In one embodiment, the apparatus 1200 further includes:
[0144] A third determination module 1202, configured to acquire test results of each test case set to be tested; and determine statistical results of each test case set to be tested according to the test results of each test case set to be tested.
[0145] In one embodiment, the apparatus 1200 further includes:
[0146] A display module 1203, configured to display test results of the test case set to be tested on a test management interface, and / or display statistical results on the test management interface.
[0147] In one embodiment, a first sending module 1102 is specifically configured to input an excitation signal to a to-be-tested function block in the test case set to be tested through an output interface of a test block in the test case set to be tested when the test block in the test case set to be tested receives an enabling signal.
[0148] In one embodiment, an acquisition module 1104 is specifically configured to acquire first parameter information by using a parameter interface of a test block; and obtain a test result of the test case set to be tested according to the first parameter information and a response signal.
[0149] In one embodiment, a second sending module 1103 is specifically configured to acquire second parameter information by using a parameter interface of a to-be-tested function block, and generate a response signal based on the second parameter information and the excitation signal.
[0150] Each module in the above function block testing apparatus can be implemented in whole or in part by software, hardware, and a combination thereof. Each of the above modules can be embedded in a processor in a computer device in a hardware form or be independent of the processor, or can be stored in a memory in the computer device in a software form so that the processor can call and execute operations corresponding to each of the above modules.
[0151] In one embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory. When the processor executes the computer program, the following steps are implemented:
[0152] Determine a test case set to be tested from a candidate test case set;
[0153] Input an excitation signal to the function block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested; the test block is created based on the function of the function block to be tested;
[0154] The function block to be tested generates a response signal based on the excitation signal, and sends the response signal to the test block through the output interface of the function block to be tested;
[0155] Obtain the test result of the test case set to be tested through the test block according to the response signal.
[0156] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0157] Determine the target sub-test block from the sub-test blocks with different functions according to the test requirement information of the function block to be tested; obtain the test block according to the target sub-test block.
[0158] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0159] Obtain an operation instruction based on the test management interface; in response to the operation instruction, determine the test case set to be tested from the candidate test case sets.
[0160] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0161] In response to the triggering operation on the target control in the test case set selector in the test management interface, obtain the operation instruction.
[0162] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0163] Obtain the test results of each test case set to be tested; according to the test results of each test case set to be tested, determine the statistical results of each test case set to be tested.
[0164] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0165] Display the test results of the test case set to be tested on the test management interface, and / or display the statistical results on the test management interface.
[0166] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0167] When the test block in the test case set to be tested receives an enable signal, input an excitation signal to the function block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested.
[0168] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0169] Obtain the first parameter information using the parameter interface of the test block;
[0170] Based on the first parameter information and the response signal, obtain the test results of the test case set to be tested through the test block.
[0171] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0172] Obtain the second parameter information using the parameter interface of the functional block to be tested, and generate a response signal based on the second parameter information and the excitation signal through the functional block to be tested.
[0173] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0174] Determine the test case set to be tested from the candidate test case set;
[0175] Input an excitation signal to the functional block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested; the test block is created based on the function of the functional block to be tested;
[0176] Generate a response signal based on the excitation signal through the functional block to be tested, and send the response signal to the test block through the output interface of the functional block to be tested;
[0177] Obtain the test results of the test case set to be tested according to the response signal through the test block.
[0178] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0179] According to the test requirement information of the functional block to be tested, determine the target sub-test block from the sub-test blocks with different functions; obtain the test block according to the target sub-test block.
[0180] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0181] Obtain an operation instruction based on the test management interface; in response to the operation instruction, determine the test case set to be tested from the candidate test case set.
[0182] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0183] In response to the triggering operation on the target control in the test case set selector in the test management interface, obtain the operation instruction.
[0184] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0185] Obtain the test results of each test case set to be tested; determine the statistical results of each test case set to be tested according to the test results of each test case set to be tested.
[0186] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0187] Display the test results of the test case set to be tested on the test management interface, and / or display the statistical results on the test management interface.
[0188] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0189] When the test block in the test case set to be tested receives an enable signal, input an excitation signal to the function block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested.
[0190] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0191] Obtain first parameter information through the parameter interface of the test block;
[0192] Obtain the test results of the test case set to be tested through the test block according to the first parameter information and the response signal.
[0193] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0194] Obtain second parameter information through the parameter interface of the function block to be tested, and generate a response signal through the function block to be tested based on the second parameter information and the excitation signal.
[0195] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0196] Determine the test case set to be tested from the candidate test case sets;
[0197] Input an excitation signal to the function block to be tested in the test case set to be tested through the output interface of the test block in the test case set to be tested; the test block is created based on the function of the function block to be tested;
[0198] Generate a response signal through the function block to be tested based on the excitation signal, and send the response signal to the test block through the output interface of the function block to be tested;
[0199] Obtain the test results of the test case set to be tested through the test block according to the response signal.
[0200] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0201] Determine a target sub - test block from sub - test blocks with different functions according to the test requirement information of the function block to be tested; obtain a test block according to the target sub - test block.
[0202] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0203] Obtain an operation instruction based on a test management interface; in response to the operation instruction, determine a set of test cases to be tested from a candidate set of test cases.
[0204] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0205] In response to a triggering operation on a target control in a test case set selector in a test management interface, obtain an operation instruction.
[0206] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0207] Obtain the test results of each set of test cases to be tested; according to the test results of each set of test cases to be tested, determine the statistical results of each set of test cases to be tested.
[0208] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0209] Display the test results of the set of test cases to be tested on the test management interface, and / or display the statistical results on the test management interface.
[0210] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0211] In the case where an enable signal is received by a test block in the set of test cases to be tested, input an excitation signal to the function block to be tested in the set of test cases to be tested through the output interface of the test block in the set of test cases to be tested.
[0212] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0213] Obtain first parameter information by using the parameter interface of the test block;
[0214] Obtain the test results of the set of test cases to be tested by the test block according to the first parameter information and the response signal.
[0215] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0216] Obtain second parameter information by using the parameter interface of the function block to be tested, and generate a response signal by the function block to be tested based on the second parameter information and the excitation signal.
[0217] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0218] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAMs), magnetoresistive random access memories (MRAMs), ferroelectric random access memories (FRAMs), phase change memories (PCMs), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logics, data processing logics based on quantum computing, etc., without limitation.
[0219] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0220] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A functional block testing method, characterized in that The method is applied to a computer device which deploys a candidate test case set, and the method includes: Determine a test case set to be tested from the candidate test case set; Input an excitation signal to a function block to be tested in the test case set to be tested through an output interface of a test block in the test case set to be tested; the test block is created based on the function of the function block to be tested; Generate a response signal by the function block to be tested based on the excitation signal, and send the response signal to the test block through an output interface of the function block to be tested; Obtain a test result of the test case set to be tested by the test block according to the response signal.
2. The method according to claim 1, wherein The method further includes: Determine a target sub-test block from sub-test blocks with different functions according to test requirement information of the function block to be tested; Obtain the test block according to the target sub-test block.
3. The method according to claim 1 or 2, characterized in that, The determining a test case set to be tested from the candidate test case set includes: Obtain an operation instruction based on a test management interface; In response to the operation instruction, determine the test case set to be tested from the candidate test case set.
4. The method according to claim 3, characterized in that, The obtaining an operation instruction based on a test management interface includes: In response to a trigger operation on a target control in a test case set selector in the test management interface, obtain the operation instruction.
5. The method according to claim 3 or 4, characterized in that, The method further includes: Obtain test results of each test case set to be tested; Determine a statistical result of each test case set to be tested according to the test results of each test case set to be tested.
6. The method according to claim 5, wherein The method further includes: Display the test results of the test case set to be tested on the test management interface, and / or display the statistical result on the test management interface.
7. The method according to any one of claims 1-6, characterized in that, The inputting an excitation signal to a function block to be tested in the test case set to be tested through an output interface of a test block in the test case set to be tested includes: When the test block in the test case set to be tested receives an enable signal, input an excitation signal to a function block to be tested in the test case set to be tested through an output interface of the test block in the test case set to be tested.
8. The method according to any one of claims 1-6, characterized in that The obtaining a test result of the test case set to be tested by the test block according to the response signal includes: Obtain first parameter information by using a parameter interface of the test block; Obtain a test result of the test case set to be tested by the test block according to the first parameter information and the response signal.
9. The method according to any one of claims 1-6, characterized in that, The generating a response signal by the function block to be tested based on the excitation signal includes: Obtain second parameter information by using a parameter interface of the function block to be tested, and generate the response signal by the function block to be tested based on the second parameter information and the excitation signal.
10. A functional block test device, characterized in that, The device is arranged in a computer device which deploys a candidate test case set, and the device includes: A first determination module, configured to determine a test case set to be tested from the candidate test case set; A first sending module, configured to input an excitation signal to a function block to be tested in the test case set to be tested through an output interface of the test block in the test case set to be tested; the test block is created based on the function of the function block to be tested; A second sending module, configured to generate a response signal based on the excitation signal through the function block under test, and send the response signal to the test block through an output interface of the function block under test; An acquisition module, configured to obtain a test result of the test case set to be tested through the test block according to the response signal.
11. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, the steps of the method according to any one of claims 1-9 are implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1-9 are implemented.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, the steps of the method according to any one of claims 1-9 are implemented.