Inputs, Assessments, Stubs and Mocks
Specify test inputs and assessments, stub undefined function callees, override function callees
You can author graphical tests interactively in the Polyspace Platform user interface. A graphical test consists of one or more steps. In each step, select the function to test and specify test inputs and assessments. For both inputs and assessments, the test case editor supports variables with fundamental data types as well as complex data types such as aggregates (structures, enumerations, etc.) and pointers.
In each test, you must replace any callee that is undefined with a function stub. You can also optionally override a callee definition with a mock function.
Topics
Inputs
- Specify Test Inputs in Polyspace Platform User Interface
Specify test inputs of fundamental, structure, enum, array or pointer data types. - Specify Pointer Targets for C/C++ Test Authoring in Polyspace Platform User Interface
Specify arrays as targets for pointer inputs and assessments. - Set Global and Static Variables in Polyspace Platform User Interface
Set and reset global variables inside steps, or define setup and teardown functions and call them from distinct steps. - Run Same Test with Different Inputs in Polyspace Platform User Interface
Iterate test inputs through test data arrays keeping function call sequence fixed.
Assessments
- Specify Test Assessments in Polyspace Platform User Interface
See which types of assessments can be directly entered in the Polyspace® Platform user interface.
Stubs and Mocks
- Test Functions with Undefined Callees in Polyspace Platform User Interface
Test partially written code, see which symbols are undefined, use predefined stubs to emulate undefined functions. - Override Callee Definitions When Testing Functions in Polyspace Platform User Interface
Create and save mocks for function callees that access hardware, reuse overrides across tests. - Change Mock or Stub Implementation Based on Test
Define a single mock or stub that has different implementations in different tests. - Differences Between Stubs and Mocks When Testing C/C++ Functions
Stubs provide definitions for undefined functions, mocks override already defined functions.
AUTOSAR-Aware Stubs
- Create Project and Write Tests for AUTOSAR Software Component Implementations
Create project from AUTOSAR specifications and code implementation, generate smart stubs, author tests, and review test results. - Anatomy of Run-Time Environment Function Stubs Generated from AUTOSAR Design Specifications
See how function stubs for RTE functions are generated from AUTOSAR design specifications.
Tests Authored in C/C++ (xUnit Tests)
- Add C/C++ xUnit Tests to Projects in Polyspace Platform User Interface
Write tests using Polyspace Test™ xUnit API and execute them from Polyspace Platform user interface.
Limitations
- Functions and Data Types Not Supported for Graphical Test Authoring in Polyspace Platform User Interface
See a partial list of limitations of test authoring in the Polyspace Platform user interface and how to work around them. - Test C/C++ Functions by Using Scripts in Graphical Tests
Enter scripted steps to invoke unsupported functions but add step inputs and assessments graphically.