CN113934628A - Software model testing method and device and computer readable storage medium - Google Patents

Software model testing method and device and computer readable storage medium Download PDF

Info

Publication number
CN113934628A
CN113934628A CN202111163718.9A CN202111163718A CN113934628A CN 113934628 A CN113934628 A CN 113934628A CN 202111163718 A CN202111163718 A CN 202111163718A CN 113934628 A CN113934628 A CN 113934628A
Authority
CN
China
Prior art keywords
model
software model
interface
target software
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111163718.9A
Other languages
Chinese (zh)
Inventor
孙家辉
张建彪
杨红新
徐治户
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Svolt Energy Technology Co Ltd
Original Assignee
Svolt Energy Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Svolt Energy Technology Co Ltd filed Critical Svolt Energy Technology Co Ltd
Priority to CN202111163718.9A priority Critical patent/CN113934628A/en
Publication of CN113934628A publication Critical patent/CN113934628A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a software model testing method and device and a computer readable storage medium. Wherein, the method comprises the following steps: obtaining model feature information of a target software model, wherein the model feature information comprises: interface information, function requirement information and a target software model are to-be-tested software models; configuring an 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 by using the target test case to obtain the test result of the target software model. The invention solves the technical problem that development efficiency is low due to the fact that a large amount of time is needed to compile test cases in a testing link in the software development process in the related technology.

Description

Software model testing method and device and computer readable storage medium
Technical Field
The invention relates to the field of software testing, in particular to a software model testing method and device and a computer readable storage medium.
Background
At present, most controller embedded software is developed by using a model-based design mode. Software development based on the method can facilitate designers to find problems before code conversion. In order to verify the function of the model, a certain amount of data needs to be input into the model, so that various logics in the model are triggered, and the processed result of the model is output. However, in the current software function requirement verification process, designers need to traverse the test model and write test cases according to requirements. However, as software is in more demand, a test engineer is required, and a great amount of time is spent on writing test cases, so that the software development period is longer, and the time for products to appear on the market is delayed.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a test method and a test device of a software model and a computer readable storage medium, which at least solve the technical problem that the software development period is longer because a controller embedded software development needs more software and needs a test engineer to spend a large amount of time to write test cases in the related art.
According to an aspect of an embodiment of the present invention, there is provided a method for testing a software model, including: obtaining model feature information of a target software model, wherein the model feature information comprises: interface information and function requirement information, wherein the target software model is a software model to be tested; configuring an 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 function requirement information; and testing the configured target software model by using the target test case to obtain a test result of the target software model.
Optionally, configuring an interface of the target software model based on the interface information includes: acquiring input interface information and input interface dimension information in the interface information, and performing dimension-increasing 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 with an input interface of the target software model; and acquiring output interface information and output interface dimension information in the interface information, and performing dimension reduction 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 with an output interface of the target software model.
Optionally, 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, including: generating a plurality of input arrays in the first external model based on the input interface information, wherein the input arrays are used for storing data corresponding to test cases; dimension integration is performed on the plurality of input arrays by using a dimension connector so as to perform dimension ascending configuration on a first external model of the target software model.
Optionally, 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, including: generating a plurality of output arrays in the second external model based on the output interface information, wherein the output arrays are used for storing test results; and carrying out dimension decomposition on the plurality of output arrays by using a dimension decomposer so as to carry out dimension reduction configuration on a second external model of the target software model.
Optionally, the interface of the target software model is a BUS type interface, and the first external model includes: the system comprises a plurality of input arrays, a plurality of data type configuration modules and a plurality of multidimensional connectors, wherein the data type configuration modules are used for carrying out data type conversion, and the multidimensional connectors are used for carrying out dimension integration on the input of a target software model; the second external model includes: the system comprises a plurality of output arrays, a plurality of data type configuration modules and a plurality of multi-dimensional resolvers, wherein the multi-dimensional resolvers are used for carrying out dimension decomposition on the output of the target software model.
Optionally, the interface of the target software model is a numerical interface, and the first external model includes: the system comprises a plurality of input arrays, a plurality of data type configuration modules, a plurality of structural bodies and a multi-dimensional connector, wherein the multi-dimensional connector is used for carrying out dimension integration on the input of the target software model; the second external model includes: the multi-dimensional decomposer comprises a multi-dimensional decomposer, a plurality of structural bodies, a plurality of data type configuration modules and a plurality of output arrays, wherein the structural bodies are a plurality of input arrays or a plurality of output arrays, and the multi-dimensional decomposer is used for carrying out dimension decomposition on the output of the target software model.
Optionally, generating a target test case based on the function requirement information includes: determining interface assignment information of the target software model based on the function requirement information; generating a test strategy based on the interface assignment information; and generating the target test case based on the test strategy.
Optionally, generating the target test case based on the test policy includes: calling an initial test case template, wherein the initial test case template is a template generated in advance based on a programming script; and writing the test strategy into the initial test case template to obtain the target test case.
Optionally, the testing the configured target software model by using the target test case to obtain a test result of the target software model includes: reading the target test case from the configured input array of the target software model; inputting the target test case into the configured target software model so as to process the target test case by 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.
Optionally, the software model testing method further includes: after the target test case in the input array is determined to be read completely, obtaining a test result of the output array; and comparing the test result with the expected result in the time step to obtain a comparison result.
Optionally, the software model testing method further includes: and after the comparison result is recorded, clearing data in the input array and the output array of the configured target software model.
According to another aspect of the embodiments of the present invention, there is provided a software model testing apparatus, including: the obtaining module is used for obtaining model characteristic information of a target software model, wherein the model characteristic information comprises: interface information and function requirement information, wherein the target software model is a software model to be tested; the configuration module is used for configuring the interface of the software model to be tested based on the interface information to obtain a configured target software model; the generating module is used for generating a target test case based on the function requirement information; and the test module is used for testing the configured target software model by using the target test case so as to obtain a test result of the target software model.
Optionally, the configuration module includes: a first obtaining unit, configured to obtain input interface information and input interface dimension information in the interface information, and perform dimension-increasing configuration on a first external model of the target software model based on the input interface information and the input interface dimension information, where the first external model is connected to an input interface of the target software model; and the second obtaining unit is used for obtaining output interface information and output interface dimension information in the interface information, and performing dimension reduction 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 with an output interface of the target software model.
Optionally, the first obtaining unit includes: the generating subunit is used for generating a plurality of input arrays in the first external model based on the input interface information, wherein the input arrays are used for storing data corresponding to the test cases; and the integration subunit is used for performing dimension integration on the plurality of input arrays by using a dimension connector so as to perform dimension-increasing configuration on a first external model of the target software model.
Optionally, the second obtaining unit includes: the output subunit is used for generating a plurality of output arrays in the second external model based on the output interface information, wherein the output arrays are used for storing test results; and the decomposition subunit is used for performing dimension decomposition on the plurality of output arrays by using a dimension decomposer so as to perform dimension reduction configuration on a second external model of the target software model.
Optionally, the interface of the target software model is a BUS type interface, and the first external model includes: the system comprises a plurality of input arrays, a plurality of data type configuration modules and a plurality of multidimensional connectors, wherein the data type configuration modules are used for carrying out data type conversion, and the multidimensional connectors are used for carrying out dimension integration on the input of a target software model; the second external model includes: the system comprises a plurality of output arrays, a plurality of data type configuration modules and a plurality of multi-dimensional resolvers, wherein the multi-dimensional resolvers are used for carrying out dimension decomposition on the output of the target software model.
Optionally, the interface of the target software model is a numerical interface, and the first external model includes: the system comprises a plurality of input arrays, a plurality of data type configuration modules, a plurality of structural bodies and a multi-dimensional connector, wherein the multi-dimensional connector is used for carrying out dimension integration on the input of the target software model; the second external model includes: the multi-dimensional decomposer comprises a multi-dimensional decomposer, a plurality of structural bodies, a plurality of data type configuration modules and a plurality of output arrays, wherein the structural bodies are a plurality of input arrays or a plurality of output arrays, and the multi-dimensional decomposer is used for carrying out dimension decomposition on the output of the target software model.
Optionally, the generating module includes: the determining unit is used for determining interface assignment information of the target software model based on the function requirement information; the first generating unit is used for generating a test strategy based on the interface assignment information; and the second generating unit is used for generating the target test case based on the test strategy.
Optionally, the second generating unit includes: the test case template processing unit is used for processing the initial test case template, and comprises a calling subunit and a calling subunit, wherein the calling subunit is used for calling the initial test case template which is a template generated in advance based on a programming script; and the obtaining subunit is used for writing the test strategy into the initial test case template to obtain the target test case.
Optionally, the test module includes: the reading unit is used for reading the target test case from the input array of the configured target software model; the input unit is used for inputting the target test case into the configured target software model so as to process the target test case by using the configured target software model to obtain a processing result; and the output unit is used for outputting the processing result to an output array so as to obtain the test result of the target software model.
Optionally, the apparatus further comprises: the third obtaining unit is used for obtaining the test result of the output array after the target test case in the input array is determined to be completely read; and the comparison unit is used for comparing the test result with the expected result in the time step to obtain a comparison result.
Optionally, the apparatus further comprises: and the clearing unit is used for clearing data in the input array and the output array of the configured target software model after the comparison result is recorded.
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is executed by a processor, the computer-readable storage medium controls a device to execute the software model testing method according to any one of the above.
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a computer program, where the computer program executes a method for testing a software model according to any one of the above methods.
In the embodiment of the present invention, model feature information of a target software model is obtained, where the model feature information includes: interface information, function requirement information and a target software model are to-be-tested software models; configuring an 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 by using the target test case to obtain the test result of the target software model. By the software model testing method, the purposes of interface configuration based on the model characteristic information of the target software, testing the configured target software model and obtaining an effective result are achieved, the technical effect of improving the software development efficiency is achieved, and the technical problem that the development efficiency is low due to the fact that a large amount of time is spent in a testing link in the software development process in the related technology to compile test cases is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a method of testing a software model according to an embodiment of the invention;
FIG. 2 is a flow diagram of test model construction according to an embodiment of the invention;
FIG. 3 is a schematic diagram of a BUS-type multidimensional interface test model architecture according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a test model architecture of a numerical multidimensional interface in accordance with an embodiment of the present invention;
FIG. 5 is a flow chart of a unit model automation test of an embodiment of the present invention;
FIG. 6 is a flow diagram of generating test cases based on functional requirements according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a requirement test step template of an embodiment of the present invention;
FIG. 8(a) is a diagram of a test case initial template according to an embodiment of the present invention;
FIG. 8(b) is a diagram illustrating a test case after a test step is introduced according to an embodiment of the present invention;
FIG. 8(c) is a diagram of a test case after completion according to an embodiment of the present invention;
FIG. 9 is a flow diagram of test case automation testing of an embodiment of the present invention;
FIG. 10 is a schematic diagram of a test setup for a software model according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In accordance with an embodiment of the present invention, there is provided a method embodiment of a method for testing a software model, it being noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
Fig. 1 is a flowchart of a method for testing a software model according to an embodiment of the present invention, as shown in fig. 1, the method including the steps of:
step S102, obtaining model characteristic information of the target software model, wherein the model characteristic information comprises: interface information, function requirement information and a target software model are to-be-tested software models.
Optionally, the software model refers to a corresponding relationship between software testing and development stages, and may be used to guide the whole software testing process, and common software testing models include a V model, a W model, an X model, and the like.
And step S104, configuring the interface of the software model to be tested based on the interface information to obtain the configured target software model.
Optionally, configuring the interface of the software model to be tested mainly configures interaction points between the external system and the system and between each internal subsystem, so as to test whether the software meets the development requirement. The software model interfaces at the present stage are basically divided into a BUS type interface and a numerical type interface.
And step S106, generating a target test case based on the function requirement information.
It should be noted that the test case in the above steps refers to the description of the test task performed on a specific software product, and embodies the test scheme, method, technique and strategy. The contents of the test object, the test environment, the input data, the test steps, the expected results, the test scripts and the like are included, and finally, a document is formed. Further test cases are a set of test inputs, execution conditions, and expected results tailored for a particular target to verify that the requirements of a particular piece of software are met.
And S108, testing the configured target software model by using the target test case to obtain a test result of the target software model.
As can be seen from the above, in the embodiment of the present invention, first, model feature information of a target software model may be obtained, where the model feature information includes: interface information, function requirement information and a target software model are to-be-tested software models; then, configuring an interface of the software model to be tested based on the interface information to obtain a configured target software model; then generating a target test case based on the function requirement information; and finally, testing the configured target software model by using the target test case to obtain the test result of the target software model. By the software model testing method, the purposes of interface configuration based on the model characteristic information of the target software, testing the configured target software model and obtaining an effective result are achieved, the technical effect of improving the software development efficiency is achieved, and the technical problem that the development efficiency is low due to the fact that a large amount of time is spent in a testing link in the software development process in the related technology to compile test cases is solved.
As an alternative embodiment, in step S104, configuring the interface of the target software model based on the interface information includes: acquiring input interface information and input interface dimension information in the interface information, and performing dimension-increasing 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 with an input interface of the target software model; and acquiring output interface information and output interface dimension information in the interface information, and performing dimension reduction 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 with an output interface of the target software model.
In the above optional embodiment, the dimension raising mainly converts a plurality of one-dimensional arrays or structures into a multi-dimensional vector output interface, and inputs data into the tested model, so that the test efficiency can be improved, and the development time can be shortened.
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 attribute and data type are generally integrated to form a multidimensional interface, for example, in a power battery type 7AFE acquisition board, each AFE uploads the acquired temperature or voltage to the BMS host controller, that is, an interface receives data of 7 AFEs, that is, the interface is 7-dimensional. Before testing software at the present stage, the interface needs to be internally reformed into 7 interfaces, otherwise, the 7 interfaces cannot be identified, but the original model is changed.
As an alternative embodiment, performing dimension-up configuration on a first external model of a target software model based on input interface information and input interface dimension information includes: generating a plurality of input arrays in the first external model based on the input interface information, wherein the input arrays are used for storing data corresponding to the test cases; and performing dimension integration on the plurality of input arrays by using a dimension connector so as to perform dimension ascending configuration on a first external model of the target software model.
In the above optional embodiment, the dimension connector may perform dimension integration on the plurality of input arrays, and convert the plurality of one-dimensional arrays or the structure body into a multi-dimensional vector output interface, so as to meet a condition for performing dimension-increasing configuration on the first external model of the target software model.
As an alternative embodiment, 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 for storing the test result; and carrying out dimension decomposition on the plurality of output arrays by using a dimension decomposer so as to carry out dimension reduction configuration on a second external model of the target software model.
In the above optional embodiment, the dimension reduction is to convert a multidimensional output interface of the tested model into a plurality of one-dimensional output interfaces through a multidimensional decomposer outside the model, store data of each one-dimensional interface into uniquely corresponding output data or a structure body, and construct a test model of the multidimensional interface, so as to avoid modifying any part of the tested model.
Fig. 2 is a flowchart of test model construction according to an embodiment of the present invention, and as shown in fig. 2, a Simulink software unit model is first constructed, then, input interface information and interface dimension information of the software model are acquired, then, model external dimension-increasing transformation is performed on a multidimensional input interface, then, a dedicated array or structure matched with the transformed interface and other interfaces that can be directly utilized is generated, then, interface information and interface dimension information output by the software model are acquired, model external dimension-decreasing transformation is performed on a multidimensional output interface, and finally, a dedicated array or structure matched with the transformed interface and other interfaces that can be directly utilized is generated.
It should be noted that, in the above alternative embodiment, the Simulink software is a visual simulation tool software, is a block diagram environment, and can be used for multi-domain guidelines and model-based design, and the construction of the test model is described in detail in this embodiment of the present invention by taking this as an example.
As an alternative embodiment, the interface of the target software model is a BUS type interface, and the first external model includes: the system comprises a plurality of input arrays, a plurality of data type configuration modules and a plurality of multidimensional connectors, wherein the data type configuration modules are used for carrying out data type conversion, and the multidimensional connectors are used for carrying out dimension integration on the input of a target software model; the second external model includes: the system comprises a plurality of output arrays, a plurality of data type configuration modules and a plurality of multi-dimensional resolvers, wherein the multi-dimensional resolvers are used for carrying out dimension decomposition on the output of a target software model.
Fig. 3 is a schematic diagram of a BUS-type multidimensional interface test model architecture according to an embodiment of the present invention, as shown in fig. 3, different types of arrays are input in a BUS-type multidimensional interface, and configured and integrated into a data structure through data types, wherein a multidimensional connector converts a plurality of one-dimensional arrays or structures into a multidimensional vector output interface, wherein the input interface is divided into one-dimensional and multidimensional, and an output signal passes through one-dimensional and multidimensional output interfaces, wherein if the output signal is one-dimensional, the one-dimensional array is output through data type configuration; if the output signal is multidimensional, the output signal is decomposed into a structural body through a multidimensional decomposer and then is output as a multidimensional array through data type configuration.
As an alternative embodiment, the interface of the target software model is a numerical interface, and the first external model includes: the system comprises a plurality of input arrays, a plurality of data type configuration modules, a plurality of structural bodies and a multi-dimensional connector, wherein the multi-dimensional connector is used for performing dimension integration on input of a target software model; the second external model includes: the multi-dimensional decomposer comprises a multi-dimensional decomposer, a plurality of structural bodies, a plurality of data type configuration modules and a plurality of output arrays, wherein the structural bodies are a plurality of input arrays or a plurality of output arrays, and the multi-dimensional decomposer is used for carrying out dimension decomposition on the output of a target software model.
FIG. 4 is a schematic diagram of a test model architecture of a numerical multidimensional interface according to an embodiment of the present invention, as shown in FIG. 4, in the embodiment of the present invention, there may be 4 ways for a numerical value to enter a tested model input interface, if a signal corresponding to the numerical value is not multidimensional, a value of an input array may be converted into a type required by a tested model through data type configuration and directly transmitted to the input interface of the tested model; if the corresponding signal is multidimensional, the value of the input array is converted into the type required by the tested model through data type configuration, then forms a multidimensional vector structure with other array values of the same interface through a multidimensional connector, and outputs the interface which continuously corresponds to the corresponding dimension in the input interface of the tested model, and decomposes the dimension through a multidimensional decomposer, and configures and outputs the data of the corresponding dimension through data type configuration.
Fig. 5 is a flowchart of an automated unit model test according to an embodiment of the present invention, and as shown in fig. 5, in the embodiment of the present invention, two parallel flows are merged into a test loop flow, one flow is for configuring input and output ports of a tested model, the other flow is for generating a test case according to functional requirements of the model for use in the model test, and the loop flow is for using the compiled test case to run the tested model after configuration to detect whether the tested model meets development requirements.
As an alternative embodiment, in step S106, generating a target test case based on the function 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 a target test case based on the test strategy.
Fig. 6 is a flowchart of generating a test case based on functional requirements according to an embodiment of the present invention, as shown in fig. 6, first obtaining functional requirements of a model software to be tested, then determining types of assignments of input and output interfaces and time points of the assignments according to the requirements, then performing a test step according to a specific mode, then generating a two-dimensional table of signals, arrays and time step by using a script, then filling values of the test step into the generated table by using the script, and finally completing the test case table.
It should be noted that, in a test case, first, an input/output value of a tested model is determined according to a software function requirement during a test engineering, and a test Step is written according to a specific format, specifically, fig. 7 is a schematic diagram of a template of a requirement test Step according to an embodiment of the present invention, as shown in fig. 7, Step1 represents a first Step of a time sequence, a Set keyword represents a Set value for an input group, a model interface 1 — a represents an assignment a value for the model interface 1, and specifically, a value input to the model input interface 1 in the first Step of model operation is a. Step6 represents the sixth Step of the time series, the Check keyword represents that a numerical value is set for the output numerical group, the model interface 1 is AA, the model interface 1 is assigned with an AA value, and specifically, the value output to the model output interface 1 in the sixth Step of the model operation is AA. Similarly, Step7 is the same as Step1, and Step12 is the same as Step6.
As an optional embodiment, generating a target test case based on a test policy includes: calling an initial test case template, wherein the initial test case template is a template generated in advance based on a programming script; and writing the test strategy into the initial test case template to obtain the target test case.
Fig. 8(a) is a schematic diagram of a test case initial template according to an embodiment of the present invention, and as shown in fig. 8(a), after the functional requirements are converted into standard test steps, an initial test case template may be generated by using a program script, and the template is used for the next automated test.
As an alternative embodiment, in step S108, testing the configured target software model by using the target test case to obtain a test result of the target software model, includes: reading a target test case from an input array of the configured target software model; inputting the target test case into a configured target software model, and processing the target test case by 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.
Fig. 8(b) is a schematic diagram of the test case after the test Step is imported, as shown in fig. 8(b), the first row of the table is names of input and output signals of the tested model, the names of input and output arrays of the second behavior test model correspond to the signals of the tested model one to one, the third row starts to be a place for assigning values to the input and the output, the first column is a time Step of the test, (Step1, Step2, Step3, Step 4), that is, a first value, a second value, a third value, and the like of the test model. That is, each time step of each signal corresponds to an input/output value, so that test steps written according to requirements are introduced into test cases.
As an alternative embodiment, the method further comprises: after the target test case in the input array is determined to be read, obtaining a test result of the output array; and comparing the test result with the expected result in the time step to obtain a comparison result.
Fig. 8(c) is a schematic diagram of a test case after completion according to an embodiment of the present invention, as shown in fig. 8(c), step1.set: model interface 1 ═ a, and the mapping of this test step to the test case is: step 1: the number of rows of the corresponding test case, row 4; set, corresponding to the input signal part; model interface 1: corresponding to the number of columns of the test case, column 1; the overall expression is that at row 4, column 1 is assigned the value of a. Step6. check: the model interface 1 is AA, and the mapping of this test step to the test case is: step 6: the number of rows of the corresponding test case, row 9; check, corresponding to the output signal portion; model interface 1: corresponding to the number of columns of the test cases, column 11; the overall expression is that at line 9, column 11 is assigned the AA value. And similarly, other statements are assigned according to the same method. After the test Step is completed, the value of the blank is input to be perfected, the value of the blank keeps the value of the last state, for example, Step2 in the table is not assigned, the value of the blank is the value of the last state, and the value of the last state is kept, namely, the input value of Step1 is copied. Therefore, the test engineer only needs to complete the conversion from the software function requirement to the test step, and the subsequent part can be automatically generated by the machine. The manual participation part is reduced, most of work is completed by a machine, the submission efficiency is improved, and the error problem caused by manual filling is avoided. When the function changes and the test case needs to be modified, the method only changes the value in the test step, and partial sentences can be modified, so that the workload of later maintenance is greatly reduced.
As an alternative embodiment, the method further comprises: and after the comparison result is recorded, clearing the data in the input array and the output array of the configured target software model.
Fig. 9 is a flowchart of an automated test of test cases according to an embodiment of the present invention, and as shown in fig. 9, based on an automated test process of a test model and a test case, first, a test case is obtained from a test case library, and values of input data in the test case are written into a test model input array corresponding to the test case through a script, for example, all values in the input array 1 in the test case are written into the input array 1 in the test model, which is the same as other input arrays. And operating the test model, reading data from the input array to the tested model, and storing the output value into the output array after the logical operation of the tested model. And stopping running the model after the last step of reading, calculating and storing the result of the input array. And acquiring the operated result, and comparing whether the value of the output array is the same as the value of the expected output result in the test case in the time step position (namely the row number). And after the comparison result is recorded, all data in the input array and the output array of the test model are cleared, the next test case assignment test is started, the steps are circulated until the test cases in the test case library are tested, and the whole process can be automatically controlled by programming the machine.
As can be seen from the above, in the embodiment of the present invention, according to the interface information of the measured model, a multi-array multidimensional scaling communication structure is constructed outside the measured model, and single-dimensional/multi-dimensional numerical signals and Bus signals can be output to satisfy the condition that the input of the measured model is multi-dimensional signals; and a multi-array is built outside the tested model and reduced to a dimensional communication structure, so that single-dimensional/multi-dimensional numerical signals and Bus signals can be decomposed into single-dimensional numerical signals, the difficulty of numerical value storage and reading under the condition that the input/output of the tested model is multi-dimensional signals is simplified, the interface part of the tested model is prevented from being modified, the tested model is more complete, the feasibility of a test result is higher, and the input/output assignment by using the single-dimensional array is more convenient.
Furthermore, according to the method for automatically generating the test case with the functional requirements, provided by the embodiment of the invention, the characters are converted into specific sentences according to the software requirements, the specific test steps can be recognized by the generating machine, the machine automatically generates the test case matched with the test model according to the specific test steps, the machine readable test steps are formed by specifically processing the software requirements, the test case capable of being used by the model is constructed by combining with the input and output interfaces of the test model, the test case can be automatically generated by script control, the test efficiency is improved by controlling the automatic test, and meanwhile, the error problem caused by manually filling the test values is avoided. By the software model testing method provided by the embodiment of the invention, when the test case needs to be modified in the later stage function change, only the value in the testing step is changed, and partial sentences can be modified, so that the later maintenance workload is greatly reduced, and the project development time can be integrally improved.
Example 2
According to another aspect of the embodiments of the present invention, there is also provided a test apparatus for a software model, the test apparatus for a software model uses the test method for a software model in embodiment 1, fig. 10 is a schematic diagram of the test apparatus for a software model according to the embodiments of the present invention, and as shown in fig. 10, the test apparatus for a software model includes: an acquisition module 1001, a configuration module 1003, a generation module 1005, and a test module 1007. The following describes a test apparatus for the software model.
An obtaining module 1001, configured to obtain model feature information of a target software model, where the model feature information includes: interface information, function requirement information and a target software model are to-be-tested software models.
The configuration module 1003 is configured to configure an interface of the software model to be tested based on the interface information, so as to obtain a configured target software model.
A generating module 1005, configured to generate a target test case based on the function requirement information.
The testing module 1007 is configured to test the configured target software model by using the target test case to obtain a test result of the target software model.
It should be noted here that the acquiring module 1001, the configuring module 1003, the generating module 1005 and the testing module 1007 correspond to steps S102 to S108 in embodiment 1, and the modules are the same as the examples and application scenarios realized by the corresponding steps, but are not limited to the disclosure in embodiment 1. It should be noted that the modules described above as part of an apparatus may be implemented in a computer system such as a set of computer-executable instructions.
As can be seen from the above, in the embodiment of the present invention, first, the obtaining module 1001 may obtain model feature information of the target software model, where the model feature information includes: interface information, function requirement information and a target software model are to-be-tested software models; then, the configuration module 1003 is used for configuring the interface of the software model to be tested based on the interface information to obtain a configured target software model; a target test case is generated by the reuse generation module 1005 based on the function requirement information; and finally, testing the configured target software model by using the target test case through the test module 1007 to obtain a test result of the target software model. By the testing device of the software model, the purposes of carrying out interface configuration based on the model characteristic information of the target software, testing the configured target software model and obtaining an effective result are achieved, so that the technical effect of improving the software development efficiency is achieved, and the technical problem that the development efficiency is low due to the fact that a large amount of time is spent on compiling test cases in the testing link in the software development process in the related technology is solved.
Optionally, the configuration module comprises: the first acquisition unit is used for acquiring input interface information and input interface dimension information in the interface information and performing dimension-increasing 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 with an input interface of the target software model; and the second obtaining unit is used for obtaining the output interface information and the output interface dimension information in the interface information, and performing dimension reduction 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 with the output interface of the target software model.
Optionally, the first obtaining unit includes: the generating subunit is used for generating a plurality of input arrays in the first external model based on the input interface information, wherein the input arrays are used for storing data corresponding to the test cases; and the integration subunit is used for performing dimension integration on the plurality of input arrays by using the dimension connector so as to perform dimension-increasing configuration on the first external model of the target software model.
Optionally, the second obtaining unit includes: the output subunit is used for generating a plurality of output arrays in the second external model based on the output interface information, wherein the output arrays are used for storing the test result; and the decomposition subunit is used for performing dimension decomposition on the plurality of output arrays by using the dimension decomposer so as to perform dimension reduction configuration on a second external model of the target software model.
Optionally, the interface of the target software model is a BUS type interface, and the first external model includes: the system comprises a plurality of input arrays, a plurality of data type configuration modules and a plurality of multidimensional connectors, wherein the data type configuration modules are used for carrying out data type conversion, and the multidimensional connectors are used for carrying out dimension integration on the input of a target software model; the second external model includes: the system comprises a plurality of output arrays, a plurality of data type configuration modules and a plurality of multi-dimensional resolvers, wherein the multi-dimensional resolvers are used for carrying out dimension decomposition on the output of a target software model.
Optionally, the interface of the target software model is a numerical interface, and the first external model includes: the system comprises a plurality of input arrays, a plurality of data type configuration modules, a plurality of structural bodies and a multi-dimensional connector, wherein the multi-dimensional connector is used for performing dimension integration on input of a target software model; the second external model includes: the multi-dimensional decomposer comprises a multi-dimensional decomposer, a plurality of structural bodies, a plurality of data type configuration modules and a plurality of output arrays, wherein the structural bodies are a plurality of input arrays or a plurality of output arrays, and the multi-dimensional decomposer is used for carrying out dimension decomposition on the output of a target software model.
Optionally, the generating module includes: the determining unit is used for determining interface assignment information of the target software model based on the function requirement information; the first generating unit is used for generating a test strategy based on the interface assignment information; and the second generating unit is used for generating the target test case based on the test strategy.
Optionally, the second generating unit includes: the test case template processing unit is used for processing the initial test case template, and the initial test case template is generated in advance based on the programming script; and the obtaining subunit is used for writing the test strategy into the initial test case template to obtain the target test case.
Optionally, a test module comprising: the reading unit is used for reading a target test case from the configured input array of the target software model; the input unit is used for inputting the target test case into the configured target software model so as to process the target test case by using the configured target software model to obtain a processing result; and the output unit is used for outputting the processing result to the output array so as to obtain the test result of the target software model.
Optionally, the testing apparatus for a software model further includes: the third obtaining unit is used for obtaining the test result of the output array after the target test case in the input array is determined to be completely read; and the comparison unit is used for comparing the test result with the expected result in the time step to obtain a comparison result.
Optionally, the testing apparatus for a software model further includes: and the clearing unit is used for clearing data in the input array and the output array of the configured target software model after the comparison result is recorded.
Example 3
According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium including a stored computer program, wherein when the computer program is executed by a processor, the apparatus where the computer-readable storage medium is located is controlled to execute the software model testing method of any one of the above.
Example 4
According to another aspect of the embodiments of the present invention, there is also provided a processor, configured to execute a computer program, where the computer program executes a method for testing a software model of any one of the above.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for testing a software model, comprising:
obtaining model feature information of a target software model, wherein the model feature information comprises: interface information and function requirement information, wherein the target software model is a software model to be tested;
configuring an 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 function requirement information;
and testing the configured target software model by using the target test case to obtain a test result of the target software model.
2. The method of claim 1, wherein configuring the interface of the target software model based on the interface information comprises:
acquiring input interface information and input interface dimension information in the interface information, and performing dimension-increasing 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 with an input interface of the target software model;
and acquiring output interface information and output interface dimension information in the interface information, and performing dimension reduction 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 with an output interface of the target software model.
3. The method of claim 2, wherein the step of performing the upscaling configuration on the first external model of the target software model based on the input interface information and the input interface dimension information comprises:
generating a plurality of input arrays in the first external model based on the input interface information, wherein the input arrays are used for storing data corresponding to test cases;
dimension integration is performed on the plurality of input arrays by using a dimension connector so as to perform dimension ascending configuration on a first external model of the target software model.
4. The method of claim 2, wherein performing a dimension reduction configuration on a second external model of the target software model based on the output interface information and the output interface dimension information comprises:
generating a plurality of output arrays in the second external model based on the output interface information, wherein the output arrays are used for storing test results;
and carrying out dimension decomposition on the plurality of output arrays by using a dimension decomposer so as to carry out dimension reduction configuration on a second external model of the target software model.
5. The method of claim 2, wherein the interface of the target software model is a BUS type interface, and wherein the first external model comprises: the system comprises a plurality of input arrays, a plurality of data type configuration modules and a plurality of multidimensional connectors, wherein the data type configuration modules are used for carrying out data type conversion, and the multidimensional connectors are used for carrying out dimension integration on the input of a target software model; the second external model includes: the system comprises a plurality of output arrays, a plurality of data type configuration modules and a plurality of multi-dimensional resolvers, wherein the multi-dimensional resolvers are used for carrying out dimension decomposition on the output of the target software model.
6. The method of claim 2, wherein the interface of the target software model is a numeric interface, and wherein the first external model comprises: the system comprises a plurality of input arrays, a plurality of data type configuration modules, a plurality of structural bodies and a multi-dimensional connector, wherein the multi-dimensional connector is used for carrying out dimension integration on the input of the target software model; the second external model includes: the multi-dimensional decomposer comprises a multi-dimensional decomposer, a plurality of structural bodies, a plurality of data type configuration modules and a plurality of output arrays, wherein the structural bodies are a plurality of input arrays or a plurality of output arrays, and the multi-dimensional decomposer is used for carrying out dimension decomposition on the output of the target software model.
7. The method of claim 1, wherein generating a target test case based on the functional requirement information comprises:
determining interface assignment information of the target software model based on the function requirement information;
generating a test strategy based on the interface assignment information;
and generating the target test case based on the test strategy.
8. The method of claim 7, wherein generating the target test case based on the test policy comprises:
calling an initial test case template, wherein the initial test case template is a template generated in advance based on a programming script;
and writing the test strategy into the initial test case template to obtain the target test case.
9. The method according to claim 1, wherein testing the configured target software model by using the target test case to obtain a test result of the target software model comprises:
reading the target test case from the configured input array of the target software model;
inputting the target test case into the configured target software model so as to process the target test case by 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.
10. The method of claim 9, further comprising:
after the target test case in the input array is determined to be read completely, obtaining a test result of the output array;
and comparing the test result with the expected result in the time step to obtain a comparison result.
CN202111163718.9A 2021-09-30 2021-09-30 Software model testing method and device and computer readable storage medium Pending CN113934628A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111163718.9A CN113934628A (en) 2021-09-30 2021-09-30 Software model testing method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111163718.9A CN113934628A (en) 2021-09-30 2021-09-30 Software model testing method and device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN113934628A true CN113934628A (en) 2022-01-14

Family

ID=79277744

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111163718.9A Pending CN113934628A (en) 2021-09-30 2021-09-30 Software model testing method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN113934628A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114741289A (en) * 2022-03-31 2022-07-12 重庆长安新能源汽车科技有限公司 Automatic generation method and system of test case for controller software storage function

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110288840A1 (en) * 2010-05-24 2011-11-24 Gm Global Technology Operations, Inc. Vehicle system modeling systems and methods
US20140089887A1 (en) * 2012-09-27 2014-03-27 Tata Consultancy Services Limited Method and system for estimating size and effort of software assurance projects
CN107885500A (en) * 2017-10-31 2018-04-06 惠州市蓝微新源技术有限公司 A kind of runtime environment generation method towards AUTOSAR software architectures
CN108107373A (en) * 2017-12-15 2018-06-01 上海璞恒新能源科技有限公司 A kind of BMS test methods and system
CN108197026A (en) * 2017-12-30 2018-06-22 北京金风科创风电设备有限公司 Method, device and equipment for testing simulation software of wind generating set and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110288840A1 (en) * 2010-05-24 2011-11-24 Gm Global Technology Operations, Inc. Vehicle system modeling systems and methods
US20140089887A1 (en) * 2012-09-27 2014-03-27 Tata Consultancy Services Limited Method and system for estimating size and effort of software assurance projects
CN107885500A (en) * 2017-10-31 2018-04-06 惠州市蓝微新源技术有限公司 A kind of runtime environment generation method towards AUTOSAR software architectures
CN108107373A (en) * 2017-12-15 2018-06-01 上海璞恒新能源科技有限公司 A kind of BMS test methods and system
CN108197026A (en) * 2017-12-30 2018-06-22 北京金风科创风电设备有限公司 Method, device and equipment for testing simulation software of wind generating set and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
李妙峰;: "基于模型开发的测试自动化在汽车行业的应用", 信息与电脑(理论版), no. 06, 23 March 2017 (2017-03-23) *
林晓欲;石磊;: "嵌入式软件系统测试模型的研究与实现", 科学技术与工程, no. 24, 15 December 2009 (2009-12-15) *
赵建平;赵建辉;刘晓阳;施斌;顾美;: "基于软件复用技术的海上测控软件测试模型", 兵工自动化, no. 02, 15 February 2011 (2011-02-15) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114741289A (en) * 2022-03-31 2022-07-12 重庆长安新能源汽车科技有限公司 Automatic generation method and system of test case for controller software storage function
CN114741289B (en) * 2022-03-31 2024-06-04 深蓝汽车科技有限公司 Automatic generation method and system for test cases aiming at controller software storage function

Similar Documents

Publication Publication Date Title
US9098650B2 (en) Method and an apparatus for automatically generating a target simulation model for a defined simulation object
US5960182A (en) Hardware-software co-simulation system, hardware-software co-simulation method, and computer-readable memory containing a hardware-software co-simulation program
US20060212268A1 (en) Diagnosis of an automation system
JP2014203314A (en) ECU simulation device
CN105069183A (en) Weld simulation method and device
Haberl et al. Model-level debugging of embedded real-time systems
CN113934628A (en) Software model testing method and device and computer readable storage medium
CN111767589A (en) Batch processing method, system, terminal and storage medium based on static rigidity of automobile mounting point
US20060020441A1 (en) Method and system for creating timing constraint library
CN114091383A (en) Test sequence generation method, device and system and related equipment
CN114239477A (en) Hardware connection checking method and device, storage medium and electronic equipment
CN112732556B (en) Automatic testing method, device, equipment and storage medium of distributed system
CN103559350A (en) Load file processing method and device of vehicle
CN117390810A (en) Terminal wiring automatic drawing method and terminal equipment
CN116090380A (en) Automatic method and device for verifying digital integrated circuit, storage medium and terminal
CN111398703A (en) Automatic test method and device for voltage analog-to-digital converter and storage medium
Seybold et al. Evolution of requirements models by simulation
US7962796B2 (en) State testing device and methods thereof
CN111104334B (en) Test method and device based on EEPROM module interface software and readable storage medium
CN113569419B (en) Rapid generation system and method for three-dimensional final assembly model of liquid rocket engine
CN113220664A (en) Satellite telemetering intelligent interpretation system and method for quickly generating Lua script rule
JP4355930B2 (en) Semiconductor integrated circuit power supply model creation method, program, and information processing apparatus
US20240201965A1 (en) Method for generating source code
CN112347723B (en) Layout-based ROM code extraction verification method and device
CN111007836B (en) New energy BMS hardware-in-the-loop test case library establishing method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination