Empfohlenes Webinar: KI-gestütztes API-Testing: Ein No-Code-Ansatz zum Testen | Zum Video
Unit Tests
Softwareverifizierung und -validierung is an inherent part of automotive software development and testing is a key way to demonstrate correct software behavior. Unit testing is the verification of module design. It ensures that each software unit does what it’s required to do.
Darüber hinaus können Sicherheitsanforderungen erfordern, dass sich Softwareeinheiten nicht unerwartet verhalten und nicht anfällig für Manipulationen durch unerwartete Dateneingaben sind.
ISO 26262 has specific guidelines for testing in accordance with safety integrity levels where requirements-based testing, interface testing, and resource usage evaluation are highly recommended for all levels. Fault injection is recommended at lower ASIL (Automotive Safety Integrity Levels) A and B and highly recommended at ASIL C and D. Similarly, the method of driving test cases is also specified with recommended practices.
Unit Test Methods
Requirement-Based Test
These tests directly test functionality as specified in each requirement. Testautomatisierungstools need to support bidirectional traceability of requirements to their tests and the requirements testing coverage reports to show compliance.
Schnittstellentest
These tests ensure programming interfaces behave and perform as specified. Test tools need to create function stubs and data sources to emulate behavior of external components for automatic unit test execution.
Fault Injection Test
These tests use unexpected inputs and introduce failures in the execution of code to examine failure handling or lack thereof. Test automation tools must support injection of fault conditions using function stubs and automatic unit test generation using a diverse set of preconditions, such as min, max, and heuristic values.
Resource Usage Evaluation
These tests evaluate the amount of memory, file space, CPU execution or other target hardware resources used by the application.
Testfalltreiber
Analyse der Anforderungen
Every requirement drives at minimum a single unit test case. Although test automation tools do not generate tests directly from requirements, they must support two-way traceability from requirements to code and requirements to tests and maintain requirements, tests, and code coverage information.
Generierung und Analyse von Äquivalenzklassen
Test cases must ensure that units behave in the same manner for a range of inputs, not just cherry-picked inputs for each unit. Test automation tools must support test case generation using data sources to efficiently use a wide range of input values. Parasoft C/C++test uses factory functions to prepare sets of input parameter values for automated unit test generation.
Analyse der Grenzwerte
Automatically generated test cases (such as heuristic values, boundary values) employ data sources to use a wide range of input values in tests.
Fehler beim Schätzen
Diese Methode verwendet den Funktionsstub-Mechanismus, um Fehlerbedingungen in die Ergebnisse der getesteten Codeflussanalyse einzufügen, und kann zum Schreiben zusätzlicher Tests verwendet werden.
Automated Test Execution and Test Case Generation
Test automation provides large benefits to embedded automotive software. Moving away from test suites that require a lot of manual intervention means that testing can be done quicker, easier, and more often.
Offloading this manual testing effort frees up time for better test coverage and other safety and quality objectives. An important requirement for automated test suite execution is being able to run these tests on both host and target environments.
Target-Based Testing for Automotive Systems
Automating testing for automotive software is more challenging due to the complexity of initiating and observing tests on embedded targets—not to mention the limited access to target hardware that software teams have.
Die Automatisierung von Softwaretests ist unerlässlich, um eingebettete Tests vom Host-Entwicklungssystem bis zum Zielsystem durchgängig durchführen zu können. Das Testen eingebetteter Software ist besonders zeitaufwändig. Die Automatisierung der Regressionstestsuite ermöglicht erhebliche Zeit- und Kosteneinsparungen. Darüber hinaus sind Testergebnisse und die Erfassung von Codeabdeckungsdaten vom Zielsystem für die Validierung und die Einhaltung von Standards unerlässlich.
Traceability between test cases, test results, source code, and requirements must be recorded and maintained. So data collection is critical in test execution.
Parasoft C/C++test is offered with its test harness optimized to take minimal additional overhead for the binary footprint and provides it in the form of source code, where it can be customized if platform-specific modifications are required.
Automatisierte Testfallgenerierung
Unit test automation tools universally support some sort of test framework, which provides the harness infrastructure to execute units in isolation while satisfying dependencies via stubs. Parasoft C/C++test is no exception. Part of its unit test capability is the automated generation of test harnesses and the executable components needed for host and target-based testing.
Test data generation and management is by far the biggest challenge in unit testing. Test cases are particularly important in safety-critical software development because they must ensure functional requirements and test for unpredictable behavior, security, and safety requirements. All while satisfying test coverage criteria.
Parasoft C/C++test automatically generates test cases like the popular CppUnit format. By default, C/C++test generates one test suite per source/header file. It can also be configured to generate one test suite per function or one test suite per source file.
Safe stub definitions are automatically generated to replace “dangerous” functions, which include system I/O routines such as rmdir(), remove(), rename(), and so on. In addition, stubs can be automatically generated for missing function and variable definitions. User-defined stubs can be added as needed.
Verbessern Sie Ihre Softwaretests mit Parasoft-Lösungen.
Entdecken Sie die Kapitel
- Einführung "
- 1. Übersicht »
- 2. Statische Analyse »
- 3. MISRA »
- 4. AUTOSAR C++ 14 »
- 5. SEI/CERT »
- 6. CWE »
- 7. Unit-Tests »
- 8. Regressionstests »
- 9. Software-Integrationstests »
- 10. Testen von Softwaresystemen »
- 11. Strukturelle Codeabdeckung »
- 12. Anforderungsrückverfolgbarkeitsmatrix »
- 13. Werkzeugqualifizierung »
- 14. Berichterstattung und Analyse »