Software model testing method and device, and computer readable storage medium

By obtaining and utilizing the model feature information of the software model to configure and generate test cases, the problem of excessively long writing test cases in embedded software development is solved, and the efficiency of software development is improved.

CN113934628BActive Publication Date: 2025-03-21SVOLT ENERGY TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111163718.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-03-21
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

In controller embedded software development, due to the high software requirements, test engineers need to spend a lot of time writing test cases, resulting in a long software development cycle.

Method used

By obtaining the model feature information of the target software model, including interface information and functional requirements information, the interface of the software model is configured based on this information, and the target test cases are generated, and the configured software model is used to test the configured software model to obtain the test results.

Benefits of technology

It realizes the reduction of test case writing time, improves software development efficiency, shortens the software development cycle, and thus solves the problem of spending a lot of time writing test cases in the test link.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113934628B_ABST
    Figure CN113934628B_ABST
Patent Text Reader

Abstract

The present invention discloses a software model testing method and device, and a computer-readable storage medium. The method includes: obtaining model feature information of a target software model, wherein the model feature information includes: interface information, functional requirement information, and the target software model is a software model to be tested; configuring the interface of the software model to be tested based on the interface information to obtain a configured target software model; generating a target test case based on the functional requirement information; and testing the configured target software model using the target test case to obtain a test result of the target software model. The present invention solves the technical problem that a large amount of time is required to write test cases in the testing link of the software development process in the related technology, resulting in low development efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software testing, and in particular to a software model testing method and device, and a computer-readable storage medium. Background Art

[0002] At present, most controller embedded software development is carried out using model-based design. Software development based on this method can help designers find problems before converting the code. In order to verify the model function, a certain amount of data needs to be input into the model so that various logics inside the model can be triggered and the results processed by the model can be output. However, in the current software function requirement verification process, designers need to traverse the test model and write test cases according to the requirements. However, due to the large number of software requirements, test engineers need to spend a lot of time to write test cases, which makes the software development cycle longer and delays the time to market.

[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present invention provide a software model testing method and device, and a computer-readable storage medium, so as to at least solve the technical problem in the related art that the controller embedded software development has a large number of software requirements, requires test engineers to spend a lot of time to write test cases, and makes the software development cycle long.

[0005] According to one aspect of an embodiment of the present invention, a method for testing a software model is provided, comprising: obtaining model feature information of a target software model, wherein the model feature information comprises: interface information, functional requirement information, and the target software model is a software model to be tested; configuring the interface of the software model to be tested based on the interface information to obtain a configured target software model; generating a target test case based on the functional requirement information; and testing the configured target software model using the target test case to obtain a test result of the target software model.

[0006] Optionally, the interface of the target software model is configured based on the interface information, including: obtaining input interface information and input interface dimension information in the interface information, and performing a dimension-up configuration on a first external model of the target software model based on the input interface information and the input interface dimension information, wherein the first external model is connected to the input interface of the target software model; obtaining output interface information and output interface dimension information in the interface information, and performing a dimension-down configuration on a second external model of the target software model based on the output interface information and the output interface dimension information, wherein the second external model is connected to the output interface of the target software model.

[0007] Optionally, the first external model of the target software model is configured to be in an increased dimension based on the input interface information and the input interface dimension information, including: generating multiple input arrays in the first external model based on the input interface information, wherein the input arrays are used to store data corresponding to test cases; and dimensionally integrating the multiple input arrays using a dimension connector to configure the first external model of the target software model to be in an increased dimension.

[0008] Optionally, a second external model of the target software model is configured for dimensionality reduction based on the output interface information and the output interface dimension information, including: generating multiple output arrays in the second external model based on the output interface information, wherein the output arrays are used to store test results; and performing dimensionality decomposition on the multiple output arrays using a dimensionality decomposer to perform dimensionality reduction configuration on the second external model of the target software model.

[0009] Optionally, the interface of the target software model is a bus type interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, and multiple multidimensional connectors, wherein the multiple data type configuration modules are used to perform data type conversion, and the multidimensional connector is used to perform dimensional integration of the input of the target software model; the second external model includes: multiple output arrays, multiple data type configuration modules, and multiple multidimensional decomposers, wherein the multiple multidimensional decomposers are used to perform dimensional decomposition of the output of the target software model.

[0010] Optionally, the interface of the target software model is a numerical interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, multiple structures, and a multidimensional connector, wherein the multidimensional connector is used to perform dimension integration on the input of the target software model; the second external model includes: a multidimensional decomposer, multiple structures, multiple data type configuration modules, and multiple output arrays, wherein the structure is a collection of multiple input arrays or multiple output arrays, and the multidimensional decomposer is used to perform dimension decomposition on the output of the target software model.

[0011] Optionally, generating a target test case based on the functional requirement information includes: determining interface assignment information of the target software model based on the functional requirement information; generating a test strategy based on the interface assignment information; and generating the target test case based on the test strategy.

[0012] Optionally, generating the target test case based on the test strategy includes: retrieving an initial test case template, wherein the initial test case template is a template pre-generated based on a programmed script; and writing the test strategy into the initial test case template to obtain the target test case.

[0013] Optionally, the configured target software model is tested using the target test case to obtain the test result of the target software model, including: reading the target test case from the input array of the configured target software model; inputting the target test case into the configured target software model to process the target test case using the configured target software model to obtain a processing result; and outputting the processing result to an output array to obtain the test result of the target software model.

[0014] Optionally, the testing method of the software model also includes: after determining that the target test case in the input array has been read, obtaining the test result of the output array; comparing the test result with the numerical value of the expected result in the time step to obtain a comparison result.

[0015] Optionally, the software model testing method further includes: after recording the comparison result, clearing data in the input array and output array of the configured target software model.

[0016] According to another aspect of an embodiment of the present invention, a testing device for a software model is also provided, including: an acquisition module, used to acquire model feature information of a target software model, wherein the model feature information includes: interface information, functional requirement information, and the target software model is a software model to be tested; a configuration module, used to configure the interface of the software model to be tested based on the interface information to obtain a configured target software model; a generation module, used to generate a target test case based on the functional requirement information; and a testing module, used to test the configured target software model using the target test case to obtain a test result of the target software model.

[0017] Optionally, the configuration module includes: a first acquisition unit, used to acquire input interface information and input interface dimension information in the interface information, and perform a dimension-up configuration on the first external model of the target software model based on the input interface information and the input interface dimension information, wherein the first external model is connected to the input interface of the target software model; a second acquisition unit, used to acquire output interface information and output interface dimension information in the interface information, and perform a dimension-down configuration on the second external model of the target software model based on the output interface information and the output interface dimension information, wherein the second external model is connected to the output interface of the target software model.

[0018] Optionally, the first acquisition unit includes: a generation subunit, used to generate multiple input arrays in the first external model based on the input interface information, wherein the input arrays are used to store data corresponding to the test cases; and an integration subunit, used to dimensionally integrate the multiple input arrays using a dimensional connector to perform a dimensional configuration on the first external model of the target software model.

[0019] Optionally, the second acquisition unit includes: an output subunit, used to generate multiple output arrays in the second external model based on the output interface information, wherein the output arrays are used to store test results; a decomposition subunit, used to perform dimension decomposition on the multiple output arrays using a dimension decomposer to perform dimensionality reduction configuration on the second external model of the target software model.

[0020] Optionally, the interface of the target software model is a bus type interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, and multiple multidimensional connectors, wherein the multiple data type configuration modules are used to perform data type conversion, and the multidimensional connector is used to perform dimensional integration of the input of the target software model; the second external model includes: multiple output arrays, multiple data type configuration modules, and multiple multidimensional decomposers, wherein the multiple multidimensional decomposers are used to perform dimensional decomposition of the output of the target software model.

[0021] Optionally, the interface of the target software model is a numerical interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, multiple structures, and a multidimensional connector, wherein the multidimensional connector is used to perform dimension integration on the input of the target software model; the second external model includes: a multidimensional decomposer, multiple structures, multiple data type configuration modules, and multiple output arrays, wherein the structure is a collection of multiple input arrays or multiple output arrays, and the multidimensional decomposer is used to perform dimension decomposition on the output of the target software model.

[0022] Optionally, the generation module includes: a determination unit, used to determine the interface assignment information of the target software model based on the functional requirement information; a first generation unit, used to generate a test strategy based on the interface assignment information; and a second generation unit, used to generate the target test case based on the test strategy.

[0023] Optionally, the second generating unit comprises: a calling subunit, used to call an initial test case template, wherein the initial test case template is a template pre-generated based on a programmed script; and an acquiring subunit, used to write the test strategy into the initial test case template to obtain the target test case.

[0024] Optionally, the test module includes: a reading unit, used to read the target test case from the input array of the configured target software model; an input unit, used to input the target test case into the configured target software model, so as to process the target test case using the configured target software model to obtain a processing result; and an output unit, used to output the processing result to the output array, so as to obtain the test result of the target software model.

[0025] Optionally, the device also includes: a third acquisition unit, used to obtain the test result of the output array after determining that the target test case in the input array has been read; a comparison unit, used to compare the test result with the numerical value of the expected result in the time step to obtain a comparison result.

[0026] Optionally, the device further comprises: a clearing unit, configured to clear data in an input array and an output array of the configured target software model after recording the comparison result.

[0027] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned software model testing methods.

[0028] According to another aspect of an embodiment of the present invention, a processor is provided, wherein the processor is used to run a computer program, wherein the computer program executes any one of the above-mentioned software model testing methods when running.

[0029] In an embodiment of the present invention, the model characteristic information of the target software model is obtained, wherein the model characteristic information includes: interface information, functional requirement information, and the target software model is the software model to be tested; the interface of the software model to be tested is configured based on the interface information to obtain the configured target software model; a target test case is generated based on the functional requirement information; and the configured target software model is tested using the target test case to obtain the test result of the target software model. Through the software model testing method of the embodiment of the present invention, the purpose of configuring the interface based on the model characteristic information of the target software and testing the configured target software model and obtaining effective results is achieved, thereby achieving the technical effect of improving the software development efficiency, and further solving the technical problem that a lot of time is needed to write test cases in the testing link of the software development process in the related technology, resulting in low development efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0031] Figure 1 is a flow chart of a method for testing a software model according to an embodiment of the present invention;

[0032] Figure 2 is a flow chart of test model construction according to an embodiment of the present invention;

[0033] Figure 3 is a schematic diagram of a BUS type multi-dimensional interface test model architecture according to an embodiment of the present invention;

[0034] Figure 4 is a schematic diagram of a test model architecture of a numerical multi-dimensional interface according to an embodiment of the present invention;

[0035] Figure 5 is a flow chart of the unit model automated testing of an embodiment of the present invention;

[0036] Figure 6 is a flow chart of generating test cases based on functional requirements according to an embodiment of the present invention;

[0037] Figure 7 is a schematic diagram of a requirement test step template of an embodiment of the present invention;

[0038] FIG8 (a) is a schematic diagram of an initial template of a test case according to an embodiment of the present invention;

[0039] FIG8( b ) is a schematic diagram of a test case after the test step is introduced according to an embodiment of the present invention;

[0040] FIG8( c ) is a schematic diagram of a test case after improvement according to an embodiment of the present invention;

[0041] Fig. 9 is a flow chart of automated testing of test cases according to an embodiment of the present invention;

[0042] Fig.10 is a schematic diagram of a testing device for a software model according to an embodiment of the present invention. DETAILED DESCRIPTION

[0043] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0044] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0045] Example 1

[0046] According to an embodiment of the present invention, a method embodiment of a software model testing method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0047] Figure 1 is a flow chart of a method for testing a software model according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0048] Step S102, obtaining model feature information of the target software model, wherein the model feature information includes: interface information, functional requirement information, and the target software model is a software model to be tested.

[0049] Optionally, a software model refers to the correspondence between software testing and development stages, and can be used to guide the entire software testing process. Common software testing models include the V model, W model, and X model.

[0050] Step S104: configuring the interface of the software model to be tested based on the interface information to obtain a configured target software model.

[0051] Optionally, configuring the interface of the software model to be tested mainly configures the interaction points between external systems and internal subsystems to test whether the software meets the development requirements. Among them, the current software model interfaces are basically divided into BUS type interfaces and numerical type interfaces.

[0052] Step S106: Generate a target test case based on the functional requirement information.

[0053] It should be noted that the test case in the above steps refers to the description of the test task for a specific software product, reflecting the test plan, method, technology and strategy. Its content includes test objectives, test environment, input data, test steps, expected results, test scripts, etc., and finally forms a document. Furthermore, a test case is a set of test inputs, execution conditions and expected results compiled for a special goal, which is used to verify whether the requirements of a specific software are met.

[0054] Step S108, testing the configured target software model using the target test case to obtain the test result of the target software model.

[0055] As can be seen from the above, in the embodiment of the present invention, the model feature information of the target software model can be first obtained, wherein the model feature information includes: interface information, functional requirement information, and the target software model is the software model to be tested; then the interface of the software model to be tested is configured based on the interface information to obtain the configured target software model; then the target test case is generated based on the functional requirement information; finally, the configured target software model is tested using the target test case to obtain the test result of the target software model. Through the testing method of the software model of the embodiment of the present invention, the purpose of configuring the interface based on the model feature information of the target software and testing the configured target software model and obtaining effective results is achieved, thereby achieving the technical effect of improving the efficiency of software development, and further solving the technical problem that a lot of time is needed to write test cases in the testing link of the software development process in the related technology, resulting in low development efficiency.

[0056] As an optional embodiment, in the above step S104, the interface of the target software model is configured based on the interface information, including: obtaining input interface information and input interface dimension information in the interface information, and performing dimension-up configuration on the first external model of the target software model based on the input interface information and the input interface dimension information, wherein the first external model is connected to the input interface of the target software model; obtaining output interface information and output interface dimension information in the interface information, and performing dimension-down configuration on the second external model of the target software model based on the output interface information and the output interface dimension information, wherein the second external model is connected to the output interface of the target software model.

[0057] In the above optional embodiments, dimensionality upgrading mainly involves converting multiple one-dimensional arrays or structures into a multi-dimensional vector output interface and inputting the data into the model under test, which can improve test efficiency and shorten development time.

[0058] It should be noted that in the embodiment of the present invention, in order to reduce the number of model interfaces, interfaces with the same attributes and data types are generally integrated to form a multi-dimensional interface. For example, in the acquisition board of the power battery model 7AFE, each AFE must upload the collected temperature or voltage to the BMS main controller, that is, one interface receives data from 7 AFEs, and this interface is 7-dimensional. At this stage, this interface must be internally transformed into 7 interfaces before testing the software, otherwise it will not be recognized, but this will change the original model.

[0059] As an optional embodiment, the first external model of the target software model is configured to be upgraded in dimension based on the input interface information and the input interface dimension information, including: generating multiple input arrays in the first external model based on the input interface information, wherein the input arrays are used to store data corresponding to the test cases; and dimensionally integrating the multiple input arrays using a dimension connector to configure the first external model of the target software model to be upgraded in dimension.

[0060] In the above optional embodiment, the dimension connector can dimensionally integrate multiple input arrays and convert multiple one-dimensional arrays or structures into a multi-dimensional vector output interface to meet the conditions for upgrading the dimensionality of the first external model of the target software model.

[0061] As an optional embodiment, the second external model of the target software model is configured for dimensionality reduction based on the output interface information and the output interface dimension information, including: generating multiple output arrays in the second external model based on the output interface information, wherein the output arrays are used to store test results; and performing dimensionality decomposition on the multiple output arrays using a dimensionality decomposer to perform dimensionality reduction configuration on the second external model of the target software model.

[0062] In the above optional embodiment, dimensionality reduction is to convert the multidimensional output interface of the model under test into multiple one-dimensional output interfaces through a multidimensional decomposer outside the model, store the data of each one-dimensional interface into the unique corresponding output data or structure, and construct a test model of the multidimensional interface to avoid modifying any part of the model under test.

[0063] Figure 2 is a flow chart of constructing a test model according to an embodiment of the present invention. Figure 2 As shown, firstly, a Simulink software unit model is constructed, then the software model input interface information and interface dimension information are obtained, and then the model external dimensionality is upgraded for the multi-dimensional input interface, and then a matching exclusive array or structure is generated for the modified interface and other directly usable interfaces, and then the software model output interface information and interface dimension information are obtained, and the model external dimensionality is reduced for the multi-dimensional output interface, and finally, a matching exclusive array or structure is generated for the modified interface and other directly usable interfaces.

[0064] It should be noted that in the above optional embodiments, Simulink software is a visual simulation tool software and a module diagram environment that can be used for multi-domain policy and model-based design. This is used as an example in the embodiments of the present invention to explain in detail the construction of the test model.

[0065] As an optional embodiment, the interface of the target software model is a bus type interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, and multiple multidimensional connectors, wherein the multiple data type configuration modules are used for data type conversion, and the multidimensional connectors are used for dimensional integration of the input of the target software model; the second external model includes: multiple output arrays, multiple data type configuration modules, and multiple multidimensional decomposers, wherein the multiple multidimensional decomposers are used for dimensional decomposition of the output of the target software model.

[0066] Figure 3 is a schematic diagram of a BUS type multi-dimensional interface test model architecture according to an embodiment of the present invention, such as Figure 3 As shown, in the BUS type multidimensional interface, different types of arrays are input, which are configured with data types and assembled into data structures, wherein the multidimensional connector converts multiple one-dimensional arrays or structures into a multidimensional vector output interface, wherein the input interface is divided into one-dimensional and multi-dimensional, and the output signal passes through one-dimensional and multi-dimensional output interfaces, wherein, if the output signal is one-dimensional, it is output as a one-dimensional array through the data type configuration; if the output signal is multi-dimensional, it is decomposed into a structure through a multi-dimensional decomposer, and then output as a multi-dimensional array through the data type configuration.

[0067] As an optional embodiment, the interface of the target software model is a numerical interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, multiple structures, and a multidimensional connector, wherein the multidimensional connector is used to perform dimension integration on the input of the target software model; the second external model includes: a multidimensional decomposer, multiple structures, multiple data type configuration modules, and multiple output arrays, wherein the structure is a collection of multiple input arrays or multiple output arrays, and the multidimensional decomposer is used to perform dimension decomposition on the output of the target software model.

[0068] Figure 4 is a schematic diagram of a test model architecture of a numerical multi-dimensional interface according to an embodiment of the present invention, such as Figure 4 As shown, in the embodiment of the present invention, there are four possible ways for numerical values ​​to enter the input interface of the model under test. If the corresponding signal is not multi-dimensional, the value of the input array can be converted into the type required by the model under test through the data type configuration, and directly passed to the input interface of the model under test; if the corresponding signal is multi-dimensional, the value of the input array is converted into the type required by the model under test through the data type configuration, and then forms a multi-dimensional vector structure through a multi-dimensional connector and other array values ​​with the same interface, and then passes to the input interface of the model under test, and then outputs the interface corresponding to the corresponding dimension, decomposes the dimension through the multi-dimensional decomposer, and configures the output of data of the corresponding dimension through the data type configuration.

[0069] Figure 5is a flowchart of the unit model automated testing of an embodiment of the present invention, such as Figure 5 As shown, in the embodiment of the present invention, there are two parallel processes that converge into a test loop process, one process is to configure the input and output ports of the model under test, and the other process is to generate test cases based on the functional requirements of the model for model testing. The loop process uses the compiled test cases to run the configured model under test to detect whether the model meets the development requirements.

[0070] As an optional embodiment, in the above step S106, a target test case is generated based on the functional requirement information, including: determining the interface assignment information of the target software model based on the functional requirement information; generating a test strategy based on the interface assignment information; and generating a target test case based on the test strategy.

[0071] Figure 6 is a flow chart of generating test cases based on functional requirements according to an embodiment of the present invention, such as Figure 6 As shown, first obtain the software functional requirements of the model under test, then determine the type of input and output interface assignment and the time point of assignment based on the requirements, then perform the test steps according to a specific pattern, then use the script to generate a two-dimensional table of signals, arrays, and time steps, then use the script to fill in the test step values ​​into the generated table, and finally complete the test case table.

[0072] It should be noted that the test case is first determined by the test engineering according to the software functional requirements, the input and output values ​​of the model being tested are determined, and the test steps are written in a specific format. Specifically, Figure 7 Schematic diagram of a requirement test step template of an embodiment of the present invention, such as Figure 7 As shown in the figure, Step1 represents the first step of the time series, the Set keyword represents setting a value for the input array, and model interface 1=A represents assigning a value A to model interface 1, specifically representing that the value input to model input interface 1 is A in the first step of the model operation. Step6 represents the sixth step of the time series, the Check keyword represents setting a value for the output array, and model interface 1=AA represents assigning a value AA to model interface 1, specifically representing that the value output to model output interface 1 is AA in the sixth step of the model operation. Similarly, Step7 is the same as Step1, and Step12 is the same as Step6.

[0073] As an optional embodiment, generating a target test case based on a test strategy includes: calling an initial test case template, wherein the initial test case template is a template pre-generated based on a programmed script; writing the test strategy into the initial test case template to obtain a target test case.

[0074] FIG8 (a) is a schematic diagram of an initial test case template of an embodiment of the present invention. As shown in FIG8 (a), in an embodiment of the present invention, after completing the conversion of functional requirements into standard test steps, a program script can be used to generate an initialization test case template, which is used for subsequent automated testing.

[0075] As an optional embodiment, in the above step S108, the configured target software model is tested using the target test case to obtain the test result of the target software model, including: reading the target test case from the input array of the configured target software model; inputting the target test case into the configured target software model to process the target test case using the configured target software model to obtain the processing result; outputting the processing result to the output array to obtain the test result of the target software model.

[0076] FIG8 (b) is a schematic diagram of a test case after the test step is imported in an embodiment of the present invention. As shown in FIG8 (b), the first line of the table is the input and output signal names of the model under test, the second line is the input and output array names of the test model corresponding to the signals of the model under test, the third line is the place where the input and output are assigned, and the first column is the time step of the test, (Step1, Step2, Step3, Step4,), that is, the first value, the second value, the third value, etc. of the test model. That is to say, each signal and each time step will correspond to an input and output value, thereby importing the test steps written according to the requirements into the test case.

[0077] As an optional embodiment, the method further includes: after determining that the target test case in the input array has been read, obtaining the test result of the output array; comparing the test result with the numerical value of the expected result in the time step to obtain a comparison result.

[0078] FIG8 (c) is a schematic diagram of the improved test case of the embodiment of the present invention. As shown in FIG8 (c), Step1.Set: Model interface 1 = A. The mapping of this test step to the test case is: Step1: the corresponding test case row number, row 4; Set: corresponds to the input signal part; Model interface 1: corresponds to the test case column number, column 1; the overall expression is that the 4th row and the 1st column are assigned the value A. Step6.Check: Model interface 1 = AA. The mapping of this test step to the test case is: Step6: the corresponding test case row number, row 9; Check: corresponds to the output signal part; Model interface 1: corresponds to the test case column number, column 11; the overall expression is that the 9th row and the 11th column are assigned the value AA. Similarly, other statements are assigned in the same way. After the test step is executed, the value of the blank space needs to be improved. The value of the blank space will keep the value of the previous state. For example, Step2 in the table is not assigned a value and is a blank value. The value of the previous state is kept, that is, the input value of step1 is copied. It can be seen that the test engineer only needs to complete the transformation of software functional requirements into test steps, and the subsequent parts can all be automatically generated by the machine. Reducing the manual participation part, most of the work is completed by the machine, improving efficiency, and avoiding errors caused by manual filling. This method only needs to change the value in the test step when the function changes, and the modification can be completed by some statements, which greatly reduces the workload of later maintenance.

[0079] As an optional embodiment, the method further includes: after recording the comparison result, clearing the data in the input array and the output array of the configured target software model.

[0080] Fig. 9 Flowchart of test case automation test of the embodiment of the present invention, such as Fig. 9 As shown in the figure, the automated test process based on the test model and test case first obtains a test case from the test case library, and writes the value of the input data in the test case into the corresponding test model input array through the script, such as writing all the values ​​in input array 1 in the test case into input array 1 of the test model, and the same is true for other input arrays. Run the test model, read data from the input array to the model under test, and store the output value in the output array after the logical operation of the model under test. After the values ​​of the input array are read, calculated, and the results are stored in the last step, stop running the model. Get the result after the operation, and compare the output array with the expected output result in the test case to see if the value is the same in the time step position (that is, the number of rows). After recording the comparison results, clear all the data in the input and output arrays of the test model, and start the next test case assignment test, and repeat until the test cases in the test case library are tested. The whole process can be automatically controlled by machine programming.

[0081] From the above, it can be seen that in an embodiment of the present invention, based on the interface information of the model under test, a multi-array dimensionality increase communication structure is constructed outside the model under test, which can output single-dimensional / multi-dimensional numerical and Bus-type signals to meet the situation where the input of the model under test is a multi-dimensional signal; and a multi-array dimensionality reduction communication structure is constructed outside the model under test, which can decompose the single-dimensional / multi-dimensional numerical and Bus-type signals into single-dimensional numerical signals, simplifying the difficulty of numerical storage and reading when the input / output of the model under test is a multi-dimensional signal, avoiding modification of the interface part of the model under test, making the model under test more complete, and the feasibility of the test results higher, and it will be more convenient to use single-dimensional arrays for input and output assignment.

[0082] Furthermore, through the method for automatically generating test cases for functional requirements of the embodiment of the present invention, text is converted into specific sentences according to software requirements, and a specific test step that can be recognized by the generating machine is automatically generated by the machine according to the specific test step, and a machine-readable test step is formed by specific processing of the software requirements, which is combined with the input and output interfaces of the test model to construct a test case that can be used by the model. The test case can be automatically generated through script control, and the control of automated testing can improve the test efficiency and avoid the error problem caused by manually filling in the test value. Through the testing method of the software model provided by the embodiment of the present invention, when the test case needs to be modified due to the later functional changes, only the value in the test step is changed, and the modification can be completed for some statements, which greatly reduces the later maintenance workload and improves the overall project development time.

[0083] Example 2

[0084] According to another aspect of the embodiment of the present invention, a software model testing device is further provided. The software model testing device uses the software model testing method in the above-mentioned embodiment 1. Fig.10 is a schematic diagram of a testing device for a software model according to an embodiment of the present invention, such as Fig.10 As shown, the testing device of the software model includes: an acquisition module 1001, a configuration module 1003, a generation module 1005 and a testing module 1007. The testing device of the software model is described below.

[0085] The acquisition module 1001 is used to acquire model feature information of a target software model, wherein the model feature information includes: interface information, functional requirement information, and the target software model is a software model to be tested.

[0086] The configuration module 1003 is used to configure the interface of the software model to be tested based on the interface information to obtain a configured target software model.

[0087] The generating module 1005 is used to generate a target test case based on the functional requirement information.

[0088] The testing module 1007 is used to test the configured target software model using the target test case to obtain the test result of the target software model.

[0089] It should be noted that the acquisition module 1001, configuration module 1003, generation module 1005 and test module 1007 correspond to steps S102 to S108 in Example 1, and the examples and application scenarios implemented by the modules are the same as those of the corresponding steps, but are not limited to the contents disclosed in the above-mentioned Example 1. It should be noted that the modules as part of the apparatus can be executed in a computer system such as a set of computer executable instructions.

[0090] As can be seen from the above, in the embodiment of the present invention, firstly, the acquisition module 1001 can be used to acquire the model feature information of the target software model, wherein the model feature information includes: interface information, functional requirement information, and the target software model is the software model to be tested; then, the configuration module 1003 is used to configure the interface of the software model to be tested based on the interface information to obtain the configured target software model; then, the generation module 1005 is used to generate the target test case based on the functional requirement information; finally, the configured target software model is tested using the target test case with the help of the test module 1007 to obtain the test result of the target software model. Through the testing device of the software model of the embodiment of the present invention, the purpose of configuring the interface based on the model feature information of the target software and testing the configured target software model and obtaining effective results is achieved, thereby achieving the technical effect of improving the software development efficiency, and further solving the technical problem that a lot of time is needed to write test cases in the testing link of the software development process in the related technology, resulting in low development efficiency.

[0091] Optionally, the configuration module includes: a first acquisition unit, used to acquire input interface information and input interface dimension information in the interface information, and perform a dimension-up configuration on the first external model of the target software model based on the input interface information and the input interface dimension information, wherein the first external model is connected to the input interface of the target software model; a second acquisition unit, used to acquire output interface information and output interface dimension information in the interface information, and perform a dimension-down configuration on the second external model of the target software model based on the output interface information and the output interface dimension information, wherein the second external model is connected to the output interface of the target software model.

[0092] Optionally, the first acquisition unit includes: a generation subunit, used to generate multiple input arrays in the first external model based on the input interface information, wherein the input arrays are used to store data corresponding to the test cases; and an integration subunit, used to perform dimension integration on the multiple input arrays using a dimension connector to perform dimension-up configuration on the first external model of the target software model.

[0093] Optionally, the second acquisition unit includes: an output subunit, used to generate multiple output arrays in the second external model based on the output interface information, wherein the output arrays are used to store test results; a decomposition subunit, used to perform dimension decomposition on the multiple output arrays using a dimension decomposer to perform dimensionality reduction configuration on the second external model of the target software model.

[0094] Optionally, the interface of the target software model is a bus type interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, and multiple multidimensional connectors, wherein the multiple data type configuration modules are used for data type conversion, and the multidimensional connectors are used to perform dimensional integration of the input of the target software model; the second external model includes: multiple output arrays, multiple data type configuration modules, and multiple multidimensional decomposers, wherein the multiple multidimensional decomposers are used to perform dimensional decomposition of the output of the target software model.

[0095] Optionally, the interface of the target software model is a numerical interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, multiple structures, and a multidimensional connector, wherein the multidimensional connector is used to perform dimension integration on the input of the target software model; the second external model includes: a multidimensional decomposer, multiple structures, multiple data type configuration modules, and multiple output arrays, wherein the structure is a collection of multiple input arrays or multiple output arrays, and the multidimensional decomposer is used to perform dimension decomposition on the output of the target software model.

[0096] Optionally, the generation module includes: a determination unit for determining interface assignment information of a target software model based on functional requirement information; a first generation unit for generating a test strategy based on the interface assignment information; and a second generation unit for generating a target test case based on the test strategy.

[0097] Optionally, the second generation unit includes: a calling subunit, used to call an initial test case template, wherein the initial test case template is a template pre-generated based on a programmed script; and an acquisition subunit, used to write a test strategy into the initial test case template to obtain a target test case.

[0098] Optionally, the test module includes: a reading unit, used to read target test cases from the input array of the configured target software model; an input unit, used to input the target test cases into the configured target software model, so as to process the target test cases using the configured target software model to obtain processing results; and an output unit, used to output the processing results to the output array to obtain the test results of the target software model.

[0099] Optionally, the testing device of the software model also includes: a third acquisition unit, used to obtain the test result of the output array after determining that the target test case in the input array has been read; a comparison unit, used to compare the test result with the numerical value of the expected result in the time step to obtain a comparison result.

[0100] Optionally, the testing device for the software model further includes: a clearing unit, configured to clear the data in the input array and the output array of the configured target software model after recording the comparison result.

[0101] Example 3

[0102] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is also provided, the computer-readable storage medium including a stored computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned software model testing methods.

[0103] Example 4

[0104] According to another aspect of an embodiment of the present invention, a processor is provided, and the processor is used to run a computer program, wherein the computer program executes any of the above-mentioned software model testing methods when running.

[0105] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0106] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0107] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0108] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0109] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0110] If the integrated unit 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 this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or 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, including several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk, etc. Various media that can store program codes.

[0111] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A software model testing method, characterized in that: include: Acquire model feature information of a target software model, wherein the model feature information includes: interface information and functional requirement information, and the target software model is a software model to be tested; configuring the interface of the software model to be tested based on the interface information to obtain a configured target software model; Generate a target test case based on the functional requirement information; Using the target test case to test the configured target software model to obtain a test result of the target software model; Among them, configuring the interface of the target software model based on the interface information includes: obtaining input interface information and input interface dimension information in the interface information, and performing dimension-up configuration on the first external model of the target software model based on the input interface information and the input interface dimension information, wherein the first external model is connected to the input interface of the target software model; obtaining output interface information and output interface dimension information in the interface information, and performing dimension-down configuration on the second external model of the target software model based on the output interface information and the output interface dimension information, wherein the second external model is connected to the output interface of the target software model; integrating interfaces with the same attributes and data types to form a multi-dimensional interface.

2. The method according to claim 1, characterized in that The first external model of the target software model is configured to be dimensionally upgraded based on the input interface information and the input interface dimension information, including: Generating a plurality of input arrays in the first external model based on the input interface information, wherein the input arrays are used to store data corresponding to the test cases; The plurality of input arrays are dimensionally integrated using a dimension connector to perform dimensionally upgraded configuration on the first external model of the target software model.

3. The method according to claim 1, characterized in that Performing dimension reduction configuration on the second external model of the target software model based on the output interface information and the output interface dimension information includes: generating a plurality of output arrays in the second external model based on the output interface information, wherein the output arrays are used to store test results; The plurality of output arrays are dimensionally decomposed using a dimension decomposer to perform dimension reduction configuration on a second external model of the target software model.

4. The method according to claim 1, characterized in that: The interface of the target software model is a bus type interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, and multiple multidimensional connectors, wherein the multiple data type configuration modules are used to perform data type conversion, and the multidimensional connector is used to perform dimensional integration on the input of the target software model; the second external model includes: multiple output arrays, multiple data type configuration modules, and multiple multidimensional decomposers, wherein the multiple multidimensional decomposers are used to perform dimensional decomposition on the output of the target software model.

5. The method according to claim 1, characterized in that The interface of the target software model is a numerical interface, and the first external model includes: multiple input arrays, multiple data type configuration modules, multiple structures, and a multidimensional connector, wherein the multidimensional connector is used to perform dimension integration on the input of the target software model; the second external model includes: a multidimensional decomposer, multiple structures, multiple data type configuration modules, and multiple output arrays, wherein the structure is a collection of multiple input arrays or multiple output arrays, and the multidimensional decomposer is used to perform dimension decomposition on the output of the target software model.

6. The method according to claim 1, characterized in that Generating a target test case based on the functional requirement information includes: Determine interface assignment information of the target software model based on the functional requirement information; Generate a test strategy based on the interface assignment information; The target test case is generated based on the test strategy.

7. The method according to claim 6, characterized in that Generating the target test case based on the test strategy includes: Retrieving an initial test case template, wherein the initial test case template is a template pre-generated based on a programmed script; The test strategy is written into the initial test case template to obtain the target test case.

8. The method according to claim 1, characterized in that Testing the configured target software model using the target test case to obtain a test result of the target software model includes: Reading the target test case from the input array of the configured target software model; Inputting the target test case into the configured target software model, so as to process the target test case using the configured target software model to obtain a processing result; The processing results are output to an output array to obtain the test results of the target software model.

9. The method according to claim 8, characterized in that The method further comprises: After determining that the target test case in the input array has been read, obtaining the test result of the output array; The test result is compared with the expected result in terms of the time step to obtain a comparison result.

Citation Information

Patent Citations

  • Test method and system of BMS

    CN108107373A

  • Testing method, device and equipment for wind generating set simulation software, and storage medium

    CN108197026A