In the development process of basic automotive software, the importance of testing has become increasingly obvious. Testing is used to detect whether the function is implemented as expected. Testing is a measure of software quality. Through early testing, bugs in the software can be discovered as soon as possible, thereby improving software quality and ensuring product quality.
The basic steps of the test chain are as follows:
Ø Static testing of code
Ø Unit testing for detailed design
Ø Integration testing for architecture
Ø Demand-based system testing
Static testing checks the correctness, readability, and maintainability of the source program by analyzing the syntax, structure, process, and interface of the source program. The static test provided by Zhicong mainly uses QAC to test static code according to the MISRA C specification, and provides corresponding detailed test reports.
Metrics that can be detected by QAC testing:
Ø STCYC Function cyclic complexity STCYC
Ø STPTH Path complexity STPTH
Ø STMIF Nested depth STMIF
Ø STELF IF ELSE Quantity STELF
Ø other metrics
Advantages of static testing:
Ø Found syntax errors in the program
Ø Check whether the software meets programming standards

Figure 1: QAC static analysis interface
A variety of metrics can be tested in QAC testing. By selecting the metrics to be tested, the measurement results of each function in the code can be displayed on the interface in a chart format.

Figure 2: Measurement of various functions in QAC
The source file reference nesting relationships shown can help reduce unnecessary nested calls and reduce the complexity of code calls.

Figure 3: The file nesting relationship
The QAC static analysis report provided by the test includes Metrics, a list of MISRA errors that violate programming specifications, and an error list-used to display QAC errors that appear in the file and recommendations for correction.

Figure 4: QAC static analysis report
Polyspace has significant core advantages, with accurate and efficient coverage statistics, automatically generating visual reports with multi-dimensional indicators; it has strong static defect detection capabilities, accurately identifying various potential issues without the need for executable code; it has good full-process traceability, integrating with multiple tools to achieve seamless testing links. Similar to QAC, Polyspace can perform specification detection on static code according to the MISRA C standard, check specific rules according to customer requirements, and provide corresponding detailed test reports.
Metrics that can be detected by Polyspace testing:
Ø STCYC Function cyclic complexity STCYC
Ø STPTH Path complexity STPTH
Ø STMIF Nested depth STMIF
Ø STELF IF ELSE Quantity STELF
Ø other metrics
By selecting test rules in the configuration, you can check code specification issues according to the selected rules, and all scan results will be displayed in the output summary window and a result project file will be generated.

Figure 5: Polyspace unit test interface
Check the output summary window to ensure there are no error messages and that all files have been fully analyzed.

Figure 6: Polyspace Unit Test Output Summary View
The output summary interface of Polyspace can observe all defect information in the code and Misra rule violations, so that developers can modify code specification issues.

Figure 7: Polyspace Results List
Unit testing-Learn from tessy testing services
单元测试是软件开发V模型中重要的一环(如图8),在完成编码工作后,测试工程师根据详细设计进行单元测试,用来验证函数的功能是否按照详细设计来实现,以及通过单元测试来发现潜在BUG。为此知从推出Tessy单元测试服务(C语言),包括PC端模拟测试和实际芯片环境的测试。
Unit testing is an important part of the software development V model (see Figure 5). After completing the coding work, the test engineer conducts unit testing according to the detailed design to verify whether the function of the function is implemented according to the detailed design, and through unit testing. Discover potential bugs. To this end, we launched Tessy unit test service (C language), which includes PC-side simulation testing and actual chip environment testing.

Figure 8: Software V model development part
Role of unit testing:
Ø Detection function error
Ø Missing detection function
Ø Detect parts that exceed requirements
Tessy's actual chip test environment is complex, and Zhicong also provides environment construction services.
ZC currently provides the environment for building:

Design corresponding test cases according to the provided design requirements to test whether the functions implemented by the code meet the requirements and ensure the traceability of functions and requirements.

Figure 9: Tessy unit test interface
Check whether the path coverage of the code can be satisfied to ensure that all paths in the code can operate normally.

Figure 10: Tessy unit test test case coverage view
Build a real-machine environment for the target chip under the corresponding compiler and debugger, and provide an xml environment configuration file.

Figure 11: Construction of Tessy's real-machine environment
The Tessy test can generate four types of reports, including Details Report, Overview Report, Planning Coverage Report, and Execution Coverage Report.

Figure 12: Tessy Overview report

Figure 13: Tessy test path coverage report
Click to download the product manual