CN114077544A - Software testing method, device, equipment and medium - Google Patents

Software testing method, device, equipment and medium Download PDF

Info

Publication number
CN114077544A
CN114077544A CN202111318196.5A CN202111318196A CN114077544A CN 114077544 A CN114077544 A CN 114077544A CN 202111318196 A CN202111318196 A CN 202111318196A CN 114077544 A CN114077544 A CN 114077544A
Authority
CN
China
Prior art keywords
software
analysis
test
code
coverage rate
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
CN202111318196.5A
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.)
Guoqi Intelligent Control Beijing Technology Co Ltd
Original Assignee
Guoqi Intelligent Control Beijing 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 Guoqi Intelligent Control Beijing Technology Co Ltd filed Critical Guoqi Intelligent Control Beijing Technology Co Ltd
Priority to CN202111318196.5A priority Critical patent/CN114077544A/en
Publication of CN114077544A publication Critical patent/CN114077544A/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/3688Test management for test execution, e.g. scheduling of test suites
    • 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/3676Test management for coverage analysis
    • 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

Abstract

The invention discloses a software testing method, a device, equipment and a medium, wherein the method comprises the following steps: sequentially carrying out static analysis and equivalence analysis on software codes of software to be tested; setting a software unit test specification according to a preset software design strategy; compiling a test case according to the preset software design strategy and the software unit test specification; carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases successively through preset tool software; and generating a test report of the software to be tested after passing through the coverage rate analysis and the code coverage rate analysis. The invention carries out static analysis and equivalence analysis on the software codes before generating the test cases, and carries out requirement coverage analysis and code coverage analysis after generating the test cases, thereby effectively improving the overall test efficiency and quality of the software test, reducing the data volume and cost of the software test, and further improving the accuracy and practicability of the software test.

Description

Software testing method, device, equipment and medium
Technical Field
The present invention relates to the field of software testing technologies, and in particular, to a software testing method, apparatus, device, and medium.
Background
In the field of software development, a software debugging operation, a software maintenance upgrading process or a bug modification process are accompanied by code change, and the code change usually generates side effects, for example, the contents in various aspects such as internal and external interfaces, functional characteristics and performance of software can be affected, and if the affected surface of the code change is not sufficiently analyzed and tested, the program operation may be abnormal or even crashed. How to guarantee the accurate prediction of the influence range of the code change on the product and guarantee the complete test coverage becomes an important research direction of software development.
However, in the process of research and practice of the prior art, the inventor of the present invention finds that the test data generation method of the existing test case generates test data by arranging and combining data of all test data items through an exhaustion method, so that a large number of pieces of test data are generated, although the test coverage is wide, the amount of data to be tested is relatively large, and the quality of most of the test data is not high, so that the overall test efficiency of the software test is relatively low. Therefore, a software testing method capable of improving testing efficiency and accuracy is needed.
Disclosure of Invention
The technical problem to be solved by the embodiments of the present invention is to provide a software testing method, device, apparatus, and medium, which can solve the problems of low testing efficiency and low accuracy caused by the need of generating a large amount of test data in the existing software testing technology.
In order to solve the above problem, a first aspect of an embodiment of the present application provides a software testing method, which at least includes the following steps:
sequentially carrying out static analysis and equivalence analysis on software codes of software to be tested;
setting a software unit test specification according to a preset software design strategy;
compiling a test case according to the preset software design strategy and the software unit test specification;
carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases successively through preset tool software;
and generating a test report of the software to be tested after passing through the coverage rate analysis and the code coverage rate analysis.
In a possible implementation manner of the first aspect, the sequentially performing static analysis and equivalence analysis on the software code of the software to be tested includes:
performing static analysis on the software code of the software to be tested through a static code inspection tool;
and after the static analysis is passed, performing equivalence analysis on the software code of the software to be tested by an in-loop test tool.
In a possible implementation manner of the first aspect, the statically analyzing the software code of the software to be tested by using a static code checking tool includes:
performing code inspection of MISRA C programming specification standard on the software code of the software to be tested;
and performing lexical analysis, syntactic analysis, control flow analysis and data flow analysis on the software code of the software to be tested respectively.
In a possible implementation manner of the first aspect, the performing, by a ring test tool, equivalence analysis on software code of the software to be tested includes:
calling the software code of the software to be tested through a system function, and packaging into a system function C language file;
compiling the system function C language file to generate a dynamic link library file with the same name as the system function C language file;
and performing equivalence analysis by comparing codes generated by the dynamic link library file in a normal mode and a ring test mode.
In a possible implementation manner of the first aspect, the successively performing requirement coverage analysis and code coverage analysis on the test cases by using preset tool software includes:
analyzing the requirement coverage rate of the test case through preset tool software to obtain the corresponding requirement coverage rate;
judging whether the required coverage rate reaches a preset first threshold value;
if so, analyzing the code coverage rate of the test case through the preset tool software to obtain the corresponding code coverage rate;
if not, rewriting the test case according to the preset software design strategy and the software unit test specification.
In a possible implementation manner of the first aspect, after the step of obtaining the corresponding code coverage rate, the method includes:
judging whether the code coverage rate meets a preset second threshold value or not;
if so, generating a test report of the software to be tested;
if not, rewriting the test case according to the preset software design strategy and the software unit test specification.
In a possible implementation manner of the first aspect, the writing of the test case according to the preset software design policy and the software unit test specification includes:
the functional requirements and the non-functional requirements of the test cases are regulated according to the preset software design strategy;
and specifying a test operation instruction of the test case according to the software unit test specification.
A second aspect of an embodiment of the present application provides a software testing apparatus, including:
the software code analysis module is used for carrying out static analysis and equivalence analysis on the software codes of the software to be tested in sequence;
the software test specification module is used for setting a software unit test specification according to a preset software design strategy;
the test case compiling module is used for compiling test cases according to the preset software design strategy and the software unit test specification;
the test case analysis module is used for carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases sequentially through preset tool software;
and the test report generating module is used for generating a test report of the software to be tested after the coverage rate analysis and the code coverage rate analysis are passed.
The third aspect of the embodiments of the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and the processor implements the steps of the software testing method described in any one of the above when executing the computer program.
The fourth aspect of the embodiments of the present application also provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the software testing method described in any one of the above.
The embodiment of the invention has the following beneficial effects:
according to the software testing method, the device, the equipment and the medium provided by the embodiment of the invention, static analysis and equivalence analysis are carried out on the software code of the software to be tested in sequence; setting a software unit test specification according to a preset software design strategy; compiling a test case according to the preset software design strategy and the software unit test specification; carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases successively through preset tool software; and generating a test report of the software to be tested after passing through the coverage rate analysis and the code coverage rate analysis. According to the embodiment of the invention, the static analysis and the equivalence analysis are carried out on the software codes before the test cases are generated, and the requirement coverage rate analysis and the code coverage rate analysis are carried out after the test cases are generated, so that the overall test efficiency and quality of the software test are effectively improved, the data volume and the cost of the software test are reduced, and the accuracy and the practicability of the software test are further improved.
Drawings
FIG. 1 is a schematic flow chart illustrating a software testing method according to an embodiment of the present application;
FIG. 2 is a block diagram illustrating a software testing apparatus according to an embodiment of the present application;
fig. 3 is a block diagram illustrating a structure of a computer device according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
In the description of the present application, it is to be understood that the terms "first", "second", and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first," "second," etc. may explicitly or implicitly include one or more of that feature. In the description of the present application, "a plurality" means two or more unless otherwise specified.
First, the application scenario that the present invention can provide, for example, a software testing method, device, apparatus, and medium are provided, which can reduce the testing data amount and testing cost in the software testing process, and improve the efficiency and accuracy of software testing.
The first embodiment of the present invention:
please refer to fig. 1.
As shown in fig. 1, the present embodiment provides a software testing method, which at least includes the following steps:
s1, sequentially performing static analysis and equivalence analysis on the software codes of the software to be tested;
s2, setting a software unit test specification according to a preset software design strategy;
s3, compiling a test case according to the preset software design strategy and the software unit test specification;
s4, analyzing the requirement coverage rate and the code coverage rate of the test cases successively through preset tool software;
and S5, generating a test report of the software to be tested after the coverage rate analysis and the code coverage rate analysis are carried out.
In the prior art, the test data generation method of the existing test case generates test data by arranging and combining data of all test data items through an exhaustion method, so that a large number of test data items are generated, although the test coverage is wide, the relative data quantity to be tested is large, the quality of most of the test data is not high, and the overall test efficiency of the software test is relatively low. In order to solve the above technical problems, in the embodiment, static analysis and equivalence analysis are performed on a software code before a test case is generated, and requirement coverage analysis and code coverage analysis are performed after the test case is generated, so that the overall test efficiency and quality of a software test are effectively improved, the data volume and cost of the software test are reduced, and the accuracy and the practicability of the software test are further improved.
For step S1, first, a source software code of the software to be tested is obtained, and static analysis and equivalence analysis are performed on the source software code in sequence, where the static code analysis stage mainly includes MISRA-C compliance detection, runtime error detection, and other code index detection of the code. In the implementation process, the operation can be performed by tool software, such as QAC and BTC. In the equivalence analysis stage, mainly in model-based development, code is automatically generated by a code generator. In order to confirm the consistency of the model to the code conversion, evaluate the difference between the floating point decimal point and the fixed point decimal point, and the like, the equivalence test needs to be completed to meet the functional safety requirement of the software, so that the bug of the code of the software to be tested is avoided.
For step S2, the software cell test specification is set according to a preset software design strategy, which specifies functional and non-functional requirements and provides good input for the subsequent software cell test specification. The software unit test specification is analyzed based on a test theory aiming at a software design strategy, and provides a basis for guiding to compile a clear and complete test case. The clear test operation instruction is determined through the software unit test specification, and the full coverage of the software test is realized by meeting various conditions (such as normal, abnormal, boundary values, equivalence classes, state transformation and the like) of the software requirement at a document level.
For step S3, a test case is written according to the preset software design strategy and the software unit test specification, which is mainly to convert the software unit test specification into data (such as input, parameters, expected values, etc.) executable by the test tool.
For step S4, performing requirement coverage analysis and code coverage analysis on the test cases sequentially through preset tool software, where the requirement coverage refers to the coverage degree of the test cases on requirements, and evaluating whether a requirement is covered by at least one test case through the tool software. And the code coverage rate test is a reason explanation when the functional safety requirement code reaches 100% of the MCDC coverage rate and judges and accepts dead code.
For step S5, after the coverage rate and the code coverage rate obtained by the analysis respectively pass through preset thresholds, a final test report of the software to be tested is generated, and whether the code of the software to be tested is qualified or not and meets the requirement is determined.
In a preferred embodiment, the step S1 of sequentially performing static analysis and equivalence analysis on the software code of the software to be tested includes:
performing static analysis on the software code of the software to be tested through a static code inspection tool;
and after the static analysis is passed, performing equivalence analysis on the software code of the software to be tested by an in-loop test tool.
In a specific embodiment, the static analysis and equivalence analysis in step S1 mainly includes performing static analysis on the software code of the software to be tested by a static code inspection tool (such as RIPS, DeepCode, Brakeman, Flawfinder, Fortify, and the like), and mainly includes compliance detection of the MISRA-C standard of the code, runtime error detection, and other code index detection in the static code analysis stage. After static analysis, performing equivalence analysis on the software code of the software to be tested by using an in-loop test tool, and in an equivalence analysis stage, mainly aiming at confirming the consistency of conversion from a model to a code, evaluating the difference between a floating point decimal point and a fixed point decimal point, and the like, evaluating whether the functional safety requirement of the software is met, and avoiding bug occurrence of the code of the software to be tested.
In a preferred embodiment, the static analysis of the software code of the software to be tested by the static code inspection tool includes:
performing code inspection of MISRA C programming specification standard on the software code of the software to be tested;
and performing lexical analysis, syntactic analysis, control flow analysis and data flow analysis on the software code of the software to be tested respectively.
In a particular embodiment, the static analysis of the software code includes: firstly, the Software code of the Software to be tested is subjected to code inspection of MISRA C programming specification standard, wherein the MISRA C programming specification standard is C language development standard provided by the Motor Industry Software Reliability Association, and the purpose of the MISRA C programming specification standard is to improve the safety and the portability of an embedded system. After the code inspection of the MISRA C programming specification standard is completed, the static code inspection tool is used for carrying out static analysis on the software code of the software to be tested, and the code analysis technology is used for scanning the program code through the technologies of lexical analysis, syntactic analysis, control flow, data flow analysis and the like and verifying whether the code meets the indexes of normalization, safety, reliability, maintainability and the like.
In a preferred embodiment, the performing equivalence analysis on the software code of the software to be tested by using an in-loop test tool includes:
calling the software code of the software to be tested through a system function, and packaging into a system function C language file;
compiling the system function C language file to generate a dynamic link library file with the same name as the system function C language file;
and performing equivalence analysis by comparing codes generated by the dynamic link library file in a normal mode and a ring test mode.
In a specific embodiment, taking automobile control software as an example, obtaining a fixed-point model source code of an automobile controller, and performing source code packaging on the fixed-point model source code by using an industry standard modeling tool MATLAB software to form an S-function C file; the floating point model is established by an automobile controller research and development algorithm, and the fixed point model is obtained by calibrating the floating point model; compiling the S-function C file by utilizing a mex command in an MATLAB environment to generate a dynamic link library file with the same name as the S-function C file; running an S-function module in an MATLAB environment, changing the name of the S-function module into the file name of the dynamic link library, associating the S-function module with the dynamic link library, updating a model, and generating the S-function module for encapsulating a source code; placing the S-function module for generating the packaging source code and the original floating point model in the same new model, adding a test case, and forming a test model; and the simulation test model obtains an S-function module code operation result and an original floating point model operation result, the two operation results are subjected to subtraction, and then the absolute value of the subtracted result is obtained to obtain the error of the S-function module code operation result relative to the original floating point model operation result, namely the software in-loop test result. By carrying out equivalence test on the code, the generated code and the model are verified to be equivalent, thereby avoiding bug of a code generation tool in code generation and improving the code qualification rate and the safety.
In a preferred embodiment, the step S4 of successively performing requirement coverage analysis and code coverage analysis on the test cases by using preset tool software includes:
analyzing the requirement coverage rate of the test case through preset tool software to obtain the corresponding requirement coverage rate;
judging whether the required coverage rate reaches a preset first threshold value;
if so, analyzing the code coverage rate of the test case through the preset tool software to obtain the corresponding code coverage rate;
if not, rewriting the test case according to the preset software design strategy and the software unit test specification.
In a specific embodiment, step S4 further includes: obtaining the requirement coverage rate corresponding to the current test case after analyzing the requirement coverage rate of the test case; judging whether the required coverage rate reaches a preset first threshold value; if so, analyzing the code coverage rate of the current test case to obtain the corresponding code coverage rate; if not, rewriting the test case according to the preset software design strategy and the software unit test specification until the required coverage rate of the test case reaches a preset first threshold value.
In a preferred embodiment, the step of obtaining the corresponding code coverage rate includes:
judging whether the code coverage rate meets a preset second threshold value or not;
if so, generating a test report of the software to be tested;
if not, rewriting the test case according to the preset software design strategy and the software unit test specification.
In a specific embodiment, after code coverage rate analysis is performed on the current test case to obtain a corresponding code coverage rate, whether the code coverage rate meets a preset second threshold value is judged; if so, generating a test report of the software to be tested, and completing the software test of the software to be tested. If not, rewriting the test case according to the preset software design strategy and the software unit test specification until the code coverage rate of the test case reaches a preset second threshold value.
In a preferred embodiment, the step S3 of writing test cases according to the preset software design strategy and the software unit test specification includes:
the functional requirements and the non-functional requirements of the test cases are regulated according to the preset software design strategy;
and specifying a test operation instruction of the test case according to the software unit test specification.
In a specific embodiment, step S3 mainly includes setting the software cell test specification according to the software design strategy preset in step S2, where the preset software design strategy specifies functional and non-functional requirements, and provides good input for the subsequent software cell test specification. The software unit test specification is analyzed based on a test theory aiming at a software design strategy, and provides a basis for guiding to compile a clear and complete test case. The clear test operation instruction is determined through the software unit test specification, and the full coverage of the software test is realized by meeting various conditions (such as normal, abnormal, boundary values, equivalence classes, state transformation and the like) of the software requirement at a document level. And compiling a test case according to a preset software design strategy and a software unit test specification, and converting the software unit test specification into data (such as input, parameters, expected values and the like) which can be executed by a test tool.
The software testing method provided by the embodiment comprises the following steps: sequentially carrying out static analysis and equivalence analysis on software codes of software to be tested; setting a software unit test specification according to a preset software design strategy; compiling a test case according to the preset software design strategy and the software unit test specification; carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases successively through preset tool software; and generating a test report of the software to be tested after passing through the coverage rate analysis and the code coverage rate analysis. According to the embodiment, the static analysis and the equivalence analysis are carried out on the software codes before the test cases are generated, and the requirement coverage rate analysis and the code coverage rate analysis are carried out after the test cases are generated, so that the overall test efficiency and quality of the software test are effectively improved, the data volume and the cost of the software test are reduced, and the accuracy and the practicability of the software test are further improved.
Second embodiment of the invention:
please refer to fig. 2.
As shown in fig. 2, the present embodiment provides a software testing apparatus, including:
the software code analysis module 100 is used for sequentially performing static analysis and equivalence analysis on the software codes of the software to be tested;
for the software code analysis module 100, firstly, a source software code of software to be tested is obtained, static analysis and equivalence analysis are performed on the source software code in sequence, and MISRA-C compliance detection, runtime error detection and other code index detection of the code are mainly included in the static code analysis stage. In the implementation process, the operation can be performed by tool software, such as QAC and BTC. In the equivalence analysis stage, mainly in model-based development, code is automatically generated by a code generator. In order to confirm the consistency of the model to the code conversion, evaluate the difference between the floating point decimal point and the fixed point decimal point, and the like, the equivalence test needs to be completed to meet the functional safety requirement of the software, so that the bug of the code of the software to be tested is avoided.
A software test specification module 200, configured to set a software unit test specification according to a preset software design strategy;
for the software test specification module 200, the software unit test specification is mainly set according to a preset software design strategy, and the preset software design strategy specifies the requirements of functions and non-functions and provides good input for the subsequent software unit test specification. The software unit test specification is analyzed based on a test theory aiming at a software design strategy, and provides a basis for guiding to compile a clear and complete test case. The clear test operation instruction is determined through the software unit test specification, and the full coverage of the software test is realized by meeting various conditions (such as normal, abnormal, boundary values, equivalence classes, state transformation and the like) of the software requirement at a document level.
The test case compiling module 300 is used for compiling test cases according to the preset software design strategy and the software unit test specification;
for the test case compiling module 300, the test case is compiled according to the preset software design strategy and the software unit test specification, which is mainly to convert the software unit test specification into data (such as input, parameters, expected values, etc.) executable by the test tool.
The test case analysis module 400 is used for analyzing the requirement coverage rate and the code coverage rate of the test cases sequentially through preset tool software;
for the test case analysis module 400, the preset tool software is used for carrying out requirement coverage analysis and code coverage analysis on the test cases in sequence, wherein the requirement coverage refers to the coverage degree of the test cases on the requirements, and whether one requirement is covered by at least one test case is evaluated through the tool software. And the code coverage rate test is a reason explanation when the functional safety requirement code reaches 100% of the MCDC coverage rate and judges and accepts dead code.
And the test report generating module 500 is configured to generate a test report of the software to be tested after passing through the coverage analysis and the code coverage analysis.
For the test report generating module 500, after the coverage rate and the code coverage rate obtained by the analysis respectively pass through the preset threshold values, a final test report of the software to be tested is generated, and whether the code of the software to be tested is qualified or not and whether the code of the software to be tested meets the requirement or not is judged.
The embodiment carries out static analysis and equivalence analysis on the software codes of the software to be tested in sequence; setting a software unit test specification according to a preset software design strategy; compiling a test case according to the preset software design strategy and the software unit test specification; carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases successively through preset tool software; and generating a test report of the software to be tested after passing through the coverage rate analysis and the code coverage rate analysis. According to the embodiment, the static analysis and the equivalence analysis are carried out on the software codes before the test cases are generated, and the requirement coverage rate analysis and the code coverage rate analysis are carried out after the test cases are generated, so that the overall test efficiency and quality of the software test are effectively improved, the data volume and the cost of the software test are reduced, and the accuracy and the practicability of the software test are further improved.
Referring to fig. 3, a computer device, which may be a server and whose internal structure may be as shown in fig. 3, is also provided in the embodiment of the present application. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer designed processor is used to provide computational and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used for storing data such as software testing methods and the like. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a software testing method. The software testing method comprises the following steps: sequentially carrying out static analysis and equivalence analysis on software codes of software to be tested; setting a software unit test specification according to a preset software design strategy; compiling a test case according to the preset software design strategy and the software unit test specification; carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases successively through preset tool software; and generating a test report of the software to be tested after passing through the coverage rate analysis and the code coverage rate analysis.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, the computer program, when executed by a processor, implementing a software testing method, including the steps of: sequentially carrying out static analysis and equivalence analysis on software codes of software to be tested; setting a software unit test specification according to a preset software design strategy; compiling a test case according to the preset software design strategy and the software unit test specification; carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases successively through preset tool software; and generating a test report of the software to be tested after passing through the coverage rate analysis and the code coverage rate analysis.
According to the software testing method, the static analysis and the equivalence analysis are carried out on the software codes before the test cases are generated, and the requirement coverage rate analysis and the code coverage rate analysis are carried out after the test cases are generated, so that the overall testing efficiency and quality of the software testing are effectively improved, the data volume and the cost of the software testing are reduced, and the accuracy and the practicability of the software testing are further improved.
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 modules may be a logical division, and in actual implementation, there may be another division, for example, multiple modules 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 modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The foregoing is directed to the preferred embodiment of the present invention, and it is understood that various changes and modifications may be made by one skilled in the art without departing from the spirit of the invention, and it is intended that such changes and modifications be considered as within the scope of the invention.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided herein and used in the examples may include non-volatile and/or volatile memory. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double-rate SDRAM (SSRSDRAM), Enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and bus dynamic RAM (RDRAM).

Claims (10)

1. A software testing method is characterized by at least comprising the following steps:
sequentially carrying out static analysis and equivalence analysis on software codes of software to be tested;
setting a software unit test specification according to a preset software design strategy;
compiling a test case according to the preset software design strategy and the software unit test specification;
carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases successively through preset tool software;
and generating a test report of the software to be tested after passing through the coverage rate analysis and the code coverage rate analysis.
2. The software testing method of claim 1, wherein the performing the static analysis and the equivalence analysis on the software code of the software to be tested in sequence comprises:
performing static analysis on the software code of the software to be tested through a static code inspection tool;
and after the static analysis is passed, performing equivalence analysis on the software code of the software to be tested by an in-loop test tool.
3. The software testing method of claim 2, wherein the static analysis of the software code of the software to be tested by the static code inspection tool comprises:
performing code inspection of MISRA C programming specification standard on the software code of the software to be tested;
and performing lexical analysis, syntactic analysis, control flow analysis and data flow analysis on the software code of the software to be tested respectively.
4. The software testing method of claim 2, wherein the performing equivalence analysis on the software code of the software to be tested by an in-loop testing tool comprises:
calling the software code of the software to be tested through a system function, and packaging into a system function C language file;
compiling the system function C language file to generate a dynamic link library file with the same name as the system function C language file;
and performing equivalence analysis by comparing codes generated by the dynamic link library file in a normal mode and a ring test mode.
5. The software testing method according to claim 1, wherein the successively performing the demand coverage analysis and the code coverage analysis on the test cases through preset tool software comprises:
analyzing the requirement coverage rate of the test case through preset tool software to obtain the corresponding requirement coverage rate;
judging whether the required coverage rate reaches a preset first threshold value;
if so, analyzing the code coverage rate of the test case through the preset tool software to obtain the corresponding code coverage rate;
if not, rewriting the test case according to the preset software design strategy and the software unit test specification.
6. The software testing method of claim 5, wherein said step of obtaining a corresponding code coverage rate is followed by the steps of:
judging whether the code coverage rate meets a preset second threshold value or not;
if so, generating a test report of the software to be tested;
if not, rewriting the test case according to the preset software design strategy and the software unit test specification.
7. The software testing method according to claim 1, wherein writing test cases according to the preset software design strategy and software unit test specification comprises:
the functional requirements and the non-functional requirements of the test cases are regulated according to the preset software design strategy;
and specifying a test operation instruction of the test case according to the software unit test specification.
8. A software testing apparatus, comprising:
the software code analysis module is used for carrying out static analysis and equivalence analysis on the software codes of the software to be tested in sequence;
the software test specification module is used for setting a software unit test specification according to a preset software design strategy;
the test case compiling module is used for compiling test cases according to the preset software design strategy and the software unit test specification;
the test case analysis module is used for carrying out requirement coverage rate analysis and code coverage rate analysis on the test cases sequentially through preset tool software;
and the test report generating module is used for generating a test report of the software to be tested after the coverage rate analysis and the code coverage rate analysis are passed.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the software testing method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the software testing method of any one of claims 1 to 7.
CN202111318196.5A 2021-11-08 2021-11-08 Software testing method, device, equipment and medium Pending CN114077544A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111318196.5A CN114077544A (en) 2021-11-08 2021-11-08 Software testing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111318196.5A CN114077544A (en) 2021-11-08 2021-11-08 Software testing method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN114077544A true CN114077544A (en) 2022-02-22

Family

ID=80283877

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111318196.5A Pending CN114077544A (en) 2021-11-08 2021-11-08 Software testing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114077544A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116431135A (en) * 2023-06-12 2023-07-14 江西五十铃汽车有限公司 Method, system, computer and readable storage medium for writing automobile code
CN116450517A (en) * 2023-04-19 2023-07-18 中物院成都科学技术发展中心 Assessment method of HDL vulnerability analysis tool based on side channel information

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116450517A (en) * 2023-04-19 2023-07-18 中物院成都科学技术发展中心 Assessment method of HDL vulnerability analysis tool based on side channel information
CN116450517B (en) * 2023-04-19 2024-03-22 中物院成都科学技术发展中心 Assessment method of HDL vulnerability analysis tool based on side channel information
CN116431135A (en) * 2023-06-12 2023-07-14 江西五十铃汽车有限公司 Method, system, computer and readable storage medium for writing automobile code
CN116431135B (en) * 2023-06-12 2023-09-22 江西五十铃汽车有限公司 Method, system, computer and readable storage medium for writing automobile code

Similar Documents

Publication Publication Date Title
CN109063477B (en) Automatic intelligent contract code defect detection system and method
CN114077544A (en) Software testing method, device, equipment and medium
Liggesmeyer et al. Improving system reliability with automatic fault tree generation
EP2827253A1 (en) Metaphor based language fuzzing of computer code
CN112286828B (en) Testing method and system for intelligent contracts of block chains
CN113282513B (en) Interface test case generation method and device, computer equipment and storage medium
CN110347588B (en) Software verification method, device, computer equipment and storage medium
CN115237418A (en) Network mode configuration system and method for multi-mode network element equipment
CN112379913B (en) Software optimization method, device, equipment and storage medium based on risk identification
CN111078444B (en) System and method for security analysis of fault behavior
Chaari et al. A model-based and simulation-assisted FMEDA approach for safety-relevant E/E systems
da Silva et al. On the automatic generation of timed automata models from function block diagrams for safety instrumented systems
CN114996160A (en) Test method, system and storage medium
Gleirscher et al. Qualification of proof assistants, checkers, and generators: Where are we and what next?
Park et al. Test methods of the AUTOSAR application software components
CN113051582B (en) Computer software technology development and debugging system
Czerny et al. Effective application of software safety techniques for automotive embedded control systems
CN115858335A (en) Regression testing method and device for PLC program and computer equipment
CN115576810A (en) Automatic testing method, system, medium and computing device for real-time alarm
Fey et al. Quality assurance methods for model-based development: A survey and assessment
CN110865939A (en) Application program quality monitoring method and device, computer equipment and storage medium
CN116911406B (en) Wind control model deployment method and device, computer equipment and storage medium
CN115237814B (en) Method and system for automatically generating interface test case, storage medium and equipment
Asmundo et al. Consistent integration for sequential abstract state machines
Anandapadmanabhan Improved Run Time Error Analysis Using Formal Methods for Automotive Software-Improvement of Quality, Cost Effectiveness and Efforts to Proactive Defects Check

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