CN113672508B - Simulink testing method based on risk strategy and diversity strategy - Google Patents
Simulink testing method based on risk strategy and diversity strategy Download PDFInfo
- Publication number
- CN113672508B CN113672508B CN202110944362.6A CN202110944362A CN113672508B CN 113672508 B CN113672508 B CN 113672508B CN 202110944362 A CN202110944362 A CN 202110944362A CN 113672508 B CN113672508 B CN 113672508B
- Authority
- CN
- China
- Prior art keywords
- simulink
- risk
- keyword
- test cases
- strategy
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test 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 application discloses a Simulink testing method based on a risk strategy and a diversity strategy, which comprises the following specific steps: collecting test cases; processing the generated test cases: counting the names and the times of occurrence of the Simulink modules in each test case; modeling keyword vectors: forming a keyword dictionary by using the Simulink module names appearing in all the test cases, recording the occurrence times of each keyword, and deleting the keywords with occurrence times lower than a set threshold value; constructing a keyword matrix KV, a risk vector RV and a distance matrix DM; the method comprises the steps of prioritizing Simulink test cases by using a risk strategy Dan based on a risk vector RV, a diversity strategy Var based on a distance matrix DM and a diversity risk mixing strategy VarDan combining the two strategies.
Description
Technical Field
The application relates to the field of selection and sequencing of test cases, in particular to a Simulink test method based on a risk strategy and a diversity strategy.
Background
Chips are called "industrial grain" and are the core technology of the manufacturing industry. With the increasing emphasis of the country on the chip industry, the chip design industry is under vigorous development. EDA is a necessary, and most important, software tool for chip design, and therefore how to achieve efficient and stable EDA is of great importance. Simulink is an increasingly stringent requirement for its ability to perform properly and achieve its intended effect as a circuit design EDA in a wide range of applications.
In recent years, several approaches have been proposed to facilitate automated Simulink testing. These techniques rely on some test case generation tools (e.g., SLforge) to generate a large number of test programs by running these generated test programs to detect Simulink errors. The common method is that new test cases are generated in batches by learning test cases generated by SLforge based on rules through LSTM, and the test cases generated based on learning are more random than the test cases generated based on rules, so that the test cases are more likely to find Simulink errors. There have been studies in which SLEMI variation was performed on an existing Simulink model and new test cases were generated by processing zombie blocks in the test cases. The specific method is that firstly, the coverage information of each block is obtained through preprocessing, and the nested dynamic zombie blocks are identified. Then, the following three processing modes are adopted for different situations: (1) For nested zombie blocks, the blocks are deleted and then the front and back blocks are connected. (2) And (3) adopting an alternative mode for the top-level zombie blocks, and ensuring that the alternative blocks have the same sampling time. (3) otherwise, performing mutation on the active hierarchy. And finally, detecting the Simulink error by carrying out differential test on the test case before mutation and the newly generated test case. The Simulink test techniques have serious efficiency problems because they generally require a large number of Simulink models to be generated and tested continuously, and thus require a long time to discover Simulink errors. Although the method only needs to search the Simulink error by executing the EMI variation on the existing test case, the variation method is single, and more various error types cannot be found.
Disclosure of Invention
According to the problems existing in the prior art, the application discloses a Simulink testing method based on a risk strategy and a diversity strategy, which specifically comprises the following steps:
collecting test cases, adopting a Simulink program random generation tool Slforce to generate test cases, judging whether Simulink crashes or not through an error detection program, and marking the Simulink crashes as fault if the Simulink errors are found;
processing the generated test cases: counting the names and the times of occurrence of the Simulink modules in each test case;
modeling keyword vectors: forming a keyword dictionary by using the Simulink module names appearing in all the test cases, recording the occurrence times of each keyword, and deleting the keywords with occurrence times lower than a set threshold value;
constructing a keyword matrix KV, a risk vector RV and a distance matrix DM;
prioritizing the test cases: the method comprises the steps of prioritizing Simulink test cases by using a risk strategy Dan based on a risk vector RV, a diversity strategy Var based on a distance matrix DM and a diversity risk mixing strategy VarDan combining the two strategies.
When the key word matrix KV is constructed:
building a keyword vector tr for each test case i =(e i,1 ,e i,2 ,...,e i,m ) Wherein m is the number of keywords in the keyword dictionary; e if the ith test case contains the jth keyword in the keyword dictionary i,j =1, otherwise e i,j =0, kv is an n×m matrix, n represents that there are n test cases, and m represents that there are m keywords in the keyword dictionary.
The risk vector RV is constructed by: statistical keyword vector tr i 1 in the test case and using the number of 1 as a risk value in the test caseThe risk value of each test case is calculated, so that a risk vector RV formed by n error reports is constructed.
The distance matrix DM is constructed by: calculating the distance between each pair of test cases based on the keyword matrix KV, and for two keyword vectors tr i And tr k Will correspond to e in position j i,j And e k,j The number of different values is the distance D (tr i ,tr k ) And a distance matrix DM is constructed by calculating the distance between each pair of test cases.
When the risk policy Dan is adopted to prioritize and sort the Simulink test cases: selecting the test case tr with the highest risk value RV (i) i Put it intoIn the ordered queue QTR, the test case is deleted from tr, and then the test case tr with the highest risk value RV (i) is selected from the rest test cases of tr i The above operation is repeated until tr is 0.
When the diversified strategy Var is adopted to prioritize and sort the Simulink test cases: selecting the test case tr with the highest risk value i Put into QTR, delete it from tr, and select the test case tr with the farthest distance from QTR, i.e. the largest D (tr, QTR), from tr j Put into QTR, it is also deleted from TR, and the above operation is repeated until TR length is 0.
When the diversified risk mixing strategy VarDan is adopted to prioritize and sort the Simulink test cases: selecting test case with maximum risk value, checking, putting it into QTR, deleting it from tr, selecting tr and the first n with maximum D (tr, QTR) in QTR c Constructing a candidate set CTR by using the non-tested cases, and selecting the test case tr with the largest risk in the CTR j Checking, adding it to the QTR queue and deleting it from tr if the test case is marked as fault and delta>0, the keyword vector KV will be updated, the risk value RV will be updated, and then the above operations are repeated until the tr length is 0.
By adopting the technical scheme, the Simulink testing method based on the risk strategy and the diversity strategy provided by the application utilizes two key strategies: the diversity strategy Var helps to check various test cases, avoiding erroneous classification of test repetition; the risk policy Dan helps identify test cases that are more likely to reveal errors. By combining the two strategies, as early as possible and as many errors as possible are found.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings may be obtained according to the drawings without inventive effort to those skilled in the art.
FIG. 1 is a flow chart of the method of the present application
FIG. 2 is a schematic diagram of a Simulink model file according to the present application
FIG. 3 is a schematic diagram of a Simulink model according to the present application
FIG. 4 is a schematic diagram of a conventional Simulink module according to the present application
FIG. 5 is a schematic diagram of a keyword dictionary in accordance with an embodiment of the present application
FIG. 6 is a schematic diagram of an exemplary keyword matrix in the present application
FIG. 7 is a schematic view of an exemplary distance matrix according to the present application
Detailed Description
In order to make the technical scheme and advantages of the present application more clear, the technical scheme in the embodiment of the present application is clearly and completely described below with reference to the accompanying drawings in the embodiment of the present application:
the Simulink testing method based on the risk strategy and the diversity strategy shown in fig. 1 specifically comprises the following steps:
collecting test cases, and generating the test cases by adopting a Simulink program random generation tool Slforce, wherein FIG. 2 is a generated Simulink model file, and FIG. 3 is a corresponding Simulink model. Judging whether the Simulink crashes or not through an error detection program, and marking the Simulink as 'fault' if the Simulink errors are found;
processing the generated test cases: the Simulink test cases record the corresponding modules in the Simulink model and the connection relation between the modules, and statistics is carried out on the names and the times of occurrence of the Simulink modules in each test case; as shown in fig. 4, a common Simulink module is shown.
Modeling keyword vectors: forming a keyword dictionary by using the Simulink module names appearing in all the test cases, recording the occurrence times of each keyword, and removing some keywords with occurrence times lower than a threshold epsilon by setting the threshold epsilon, as shown in figure 5;
constructing a keyword matrix KV: building a key for each test caseWord vector tr i =(e i,1 ,e i,2 ,...,e i,m ) Where m is the number of keywords in the keyword dictionary. E if the ith test case contains the jth keyword in the keyword dictionary i,j =1, otherwise e i,j =0; KV is an n×m matrix, n represents that n test cases exist, m represents that m keywords exist in a keyword dictionary, and is shown in FIG. 6;
building a risk vector RV: statistical keyword vector tr i The number of 1's is used as the risk value in the test caseThe method comprises the steps of representing, by calculating a risk value of each test case, constructing a risk vector RV formed by n error reports;
building a distance matrix DM: calculating the distance between each pair of test cases based on the keyword matrix KV, and for two keyword vectors tr i And tr k Will correspond to e in position j i,j And e k,j The number of different values is the distance D (tr i ,tr k ). The distance matrix DM is constructed by calculating the distance of each pair of test cases, as shown in FIG. 7;
prioritizing the test cases: the method comprises the steps of prioritizing Simulink test cases by using a risk strategy Dan based on a risk vector RV, a diversity strategy Var based on a distance matrix DM and a diversity risk mixing strategy VarDan combining the two strategies.
Further, the risk policy Dan is that the test case tr with the highest risk value RV (i) is selected every time i Put it in the ordered queue QTR and delete the test case from tr. Then selecting the test case tr with the highest risk value RV (i) from the rest test cases tr i Repeating the above operation until tr is 0;
and adopting a dynamic prioritization strategy according to the risk vector RV and the checking result. I.e. if test case tr k Is determined to be found to be an error, tr in KV k Is increased by weight of all keywords of (2)Delta, the risk vector RV also changes;
the diversity strategy Var mode is that firstly, a test case tr with the highest risk value is selected i Put into QTR, delete it from tr, and select the test case tr with the farthest distance from QTR, i.e. the largest D (tr, QTR), from tr j Putting the sample into QTR, deleting the sample from TR, repeating the operation until the TR length is 0;
further, the diversity risk mixing strategy VarDan mode is that the risk strategy and the diversity strategy are combined into one mixing strategy. Selecting test case with maximum risk value, checking, putting it into QTR, deleting it from tr, selecting tr and the first n with maximum D (tr, QTR) in QTR c Constructing a candidate set CTR by using the non-tested cases, and selecting the test case tr with the largest risk in the CTR j Checking, adding it to the QTR queue and deleting it from tr if the test case is marked "fault" and delta>0, the keyword vector KV is updated, the risk value RV is updated, and then the operation is repeated until tr is 0;
the foregoing is only a preferred embodiment of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art, who is within the scope of the present application, should make equivalent substitutions or modifications according to the technical scheme of the present application and the inventive concept thereof, and should be covered by the scope of the present application.
Claims (7)
1. A Simulink testing method based on a risk strategy and a diversity strategy is characterized by comprising the following steps:
collecting test cases, adopting a Simulink program random generation tool Slforce to generate test cases, judging whether Simulink crashes or not through an error detection program, and marking the Simulink crashes as fault if the Simulink errors are found;
processing the generated test cases: counting the names and the times of occurrence of the Simulink modules in each test case;
modeling keyword vectors: forming a keyword dictionary by using the Simulink module names appearing in all the test cases, recording the occurrence times of each keyword, and deleting the keywords with occurrence times lower than a set threshold value;
constructing a keyword matrix KV, a risk vector RV and a distance matrix DM;
prioritizing the test cases: the method comprises the steps of prioritizing Simulink test cases by using a risk strategy Dan based on a risk vector RV, a diversity strategy Var based on a distance matrix DM and a diversity risk mixing strategy VarDan combining the two strategies.
2. The method according to claim 1, characterized in that: when the key word matrix KV is constructed: building a keyword vector tr for each test case i =(e i,1 ,e i,2 ,...,e i,m ) Wherein m is the number of keywords in the keyword dictionary; e if the ith test case contains the jth keyword in the keyword dictionary i,j =1, otherwise e i,j =0, kv is an n×m matrix, n represents that there are n test cases, and m represents that there are m keywords in the keyword dictionary.
3. The method according to claim 1, characterized in that: the risk vector RV is constructed by: statistical keyword vector tr i 1 in the test case and using the number of 1 as a risk value in the test caseThe risk value of each test case is calculated, so that a risk vector RV formed by n error reports is constructed.
4. The method according to claim 2, characterized in that: the distance matrix DM is constructed by: calculating the distance between each pair of test cases based on the keyword matrix KV, and for two keyword vectors tr i And tr k Will correspond to e in position j i,j And e k,j The number of different values is the distance D (tr i ,tr k ) Through meterThe distance of each pair of test cases is calculated to construct a distance matrix DM.
5. The method according to claim 1, characterized in that: when the risk policy Dan is adopted to prioritize and sort the Simulink test cases: selecting the test case tr with the highest risk value RV (i) i Putting the test cases into an ordered queue QTR, deleting the test cases from tr, and selecting the test case tr with the highest risk value RV (i) from the rest test cases of tr i The above operation is repeated until tr is 0.
6. The method according to claim 1, characterized in that: when the diversified strategy Var is adopted to prioritize and sort the Simulink test cases: selecting the test case tr with the highest risk value i Put into QTR, delete it from tr, and select the test case tr with the farthest distance from QTR, i.e. the largest D (tr, QTR), from tr j Put into QTR, it is also deleted from TR, and the above operation is repeated until TR length is 0.
7. The method according to claim 1, characterized in that: when the diversified risk mixing strategy VarDan is adopted to prioritize and sort the Simulink test cases: selecting test case with maximum risk value, checking, putting it into QTR, deleting it from tr, selecting tr and the first n with maximum D (tr, QTR) in QTR c Constructing a candidate set CTR by using the non-tested cases, and selecting the test case tr with the largest risk in the CTR j Checking, adding it to the QTR queue and deleting it from tr if the test case is marked as fault and delta>0, the keyword vector KV will be updated, the risk value RV will be updated, and then the above operations are repeated until the tr length is 0.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110944362.6A CN113672508B (en) | 2021-08-17 | 2021-08-17 | Simulink testing method based on risk strategy and diversity strategy |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110944362.6A CN113672508B (en) | 2021-08-17 | 2021-08-17 | Simulink testing method based on risk strategy and diversity strategy |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113672508A CN113672508A (en) | 2021-11-19 |
CN113672508B true CN113672508B (en) | 2023-09-22 |
Family
ID=78543477
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110944362.6A Active CN113672508B (en) | 2021-08-17 | 2021-08-17 | Simulink testing method based on risk strategy and diversity strategy |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113672508B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114896144B (en) * | 2022-04-26 | 2024-06-14 | 大连海事大学 | CPS model equivalent mode input variation test method based on knowledge base |
CN115098358B (en) * | 2022-05-19 | 2024-10-01 | 大连海事大学 | Test case prioritization method for Simulink test |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7506312B1 (en) * | 2008-01-31 | 2009-03-17 | International Business Machines Corporation | Method and system for automatically determining risk areas to retest |
JP2009294846A (en) * | 2008-06-04 | 2009-12-17 | Denso Corp | Test case generator, and test case generation program and method |
US8849626B1 (en) * | 2010-06-23 | 2014-09-30 | Iowa State University Research Foundation, Inc. | Semantic translation of stateflow diagrams into input/output extended finite automata and automated test generation for simulink/stateflow diagrams |
CN104536881A (en) * | 2014-11-28 | 2015-04-22 | 南京慕测信息科技有限公司 | Public testing error report priority sorting method based on natural language analysis |
CN111651722A (en) * | 2020-04-08 | 2020-09-11 | 西窗科技(苏州)有限公司 | Risk assessment method and platform for advertisement putting effect of advertiser |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7197427B2 (en) * | 2004-03-31 | 2007-03-27 | Genworth Financial Inc. | Method for risk based testing |
-
2021
- 2021-08-17 CN CN202110944362.6A patent/CN113672508B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7506312B1 (en) * | 2008-01-31 | 2009-03-17 | International Business Machines Corporation | Method and system for automatically determining risk areas to retest |
JP2009294846A (en) * | 2008-06-04 | 2009-12-17 | Denso Corp | Test case generator, and test case generation program and method |
US8849626B1 (en) * | 2010-06-23 | 2014-09-30 | Iowa State University Research Foundation, Inc. | Semantic translation of stateflow diagrams into input/output extended finite automata and automated test generation for simulink/stateflow diagrams |
CN104536881A (en) * | 2014-11-28 | 2015-04-22 | 南京慕测信息科技有限公司 | Public testing error report priority sorting method based on natural language analysis |
CN111651722A (en) * | 2020-04-08 | 2020-09-11 | 西窗科技(苏州)有限公司 | Risk assessment method and platform for advertisement putting effect of advertiser |
Non-Patent Citations (1)
Title |
---|
划分测试用例选择的风险决策方法;张德平;查日军;;计算机应用研究(第12期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN113672508A (en) | 2021-11-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113672508B (en) | Simulink testing method based on risk strategy and diversity strategy | |
Friedman | On multivariate goodness-of-fit and two-sample testing | |
CN114936158B (en) | Software defect positioning method based on graph convolution neural network | |
CN108304328B (en) | Text description generation method, system and device for crowdsourcing test report | |
CN116737510B (en) | Data analysis-based intelligent keyboard monitoring method and system | |
CN105871879A (en) | Automatic network element abnormal behavior detection method and device | |
CN114266289A (en) | Complex equipment health state assessment method | |
CN112184679A (en) | YOLOv 3-based wine bottle flaw automatic detection method | |
CN114799561A (en) | Laser cutting process parameter optimization method based on case reasoning and model reasoning | |
CN112948193B (en) | FPGA comprehensive tool defect detection method based on difference test | |
CN101268465A (en) | Method for sorting a set of electronic documents | |
CN113901667A (en) | Method for evaluating building collapse risk in fire | |
Aman et al. | A comparative study of vectorization-based static test case prioritization methods | |
CN108846476A (en) | A kind of intelligent terminal security level classification method based on convolutional neural networks | |
CN110059966A (en) | The contribution analysis method and device of influence factor | |
CN113486347B (en) | Deep learning hardware Trojan horse detection method based on semantic understanding | |
CN113296994B (en) | Fault diagnosis system and method based on domestic computing platform | |
CN105989095A (en) | Association rule significance test method and device capable of considering data uncertainty | |
CN115098358B (en) | Test case prioritization method for Simulink test | |
Zhou et al. | Convolutional neural network and data augmentation method for electricity theft detection | |
CN115981911A (en) | Memory failure prediction method, electronic device and computer-readable storage medium | |
CN113792141A (en) | Feature selection method based on covariance measurement factor | |
CN113434408B (en) | Unit test case sequencing method based on test prediction | |
CN114490396B (en) | Software test requirement mining method and system | |
CN116776134B (en) | Photovoltaic output prediction method based on PCA-SFFS-BiGRU |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |