Difference between revisions of "Test Units Overview"

From STRIDE Wiki
Jump to: navigation, search
(Unique STRIDE Test Unit Features)
 
(345 intermediate revisions by 11 users not shown)
Line 1: Line 1:
==Introduction==
+
== What are STRIDE Test Units? ==
  
STRIDE enables testing of C++ code through the use of xUnit style test classes. Test classes can be written by engineers, captured using an SCL pragma, and executed from the host. STRIDE facilitates the execution of some or all of the test classes by automatically creating entry points for the execution of test classes on the target.
+
'''STRIDE Test Units''' is a general term for [http://en.wikipedia.org/wiki/XUnit xUnit-style] test modules running within the STRIDE runtime framework. These tests--written in C and C++--are compiled and linked with your embedded software and run in-place on your target hardware. They are suitable for both developer unit testing as well as end-to-end integration testing.
  
==Using CPP Test Classes==
+
An external [[Stride Runner|Test Runner]] is provided which controls the execution of the tests and publishes test results to the local file system and optionally to S2's Internet [[STRIDE Test Space]].
  
===Prerequisites===
+
== Test Unit Features ==
 +
In all cases, STRIDE Test Units provide the following capabilities typical of all [http://en.wikipedia.org/wiki/XUnit xUnit-style] testing frameworks:
 +
* Specification of a test as a test method
 +
* Aggregation of individual tests into test suites which form execution and reporting units
 +
* Specification of expected results within test methods (typically by using one or more [[Test Code Macros]])
 +
* Test fixturing (optional setup and teardown)
 +
* Test parametrization (optional constructor/initialization parameters)
 +
* Automated execution
 +
* Automated results report generation
  
The CPP Test class support only works in the 2.0.0802 version of STRIDE or later.  The host PC must also have a recent distribution of ActiveState perl installed.
+
=== Unique STRIDE Test Unit Features ===
 +
In addition, STRIDE Test Units offer these unique features:
 +
; On-Target Execution
 +
: Tests execute on the target hardware in a true operational environment. Execution and reporting is controlled from a remote desktop (Windows, Linux or FreeBSD) host
 +
; Dynamic Test and Suite Generation
 +
: Test cases and suites can be created and manipulated at runtime
 +
; [[Using Test Doubles|Test Doubles]]
 +
: Dynamic runtime function substitution to implement on-the-fly mocks, stubs, and doubles
 +
; [[Test Point Testing in C/C++|Behavior Testing]] (Test Points)
 +
: Support for testing of asynchronous activities occurring in multiple threads
 +
; Multiprocess Testing Framework
 +
: Support for testing across multiple processes running simultaneously on the target
 +
; Automatic Timing Data Collection
 +
: Duration are automatically measured for each test case.
 +
; Automatic Results Publishing to Local Disk and Internet
 +
: Automatic publishing of test results to [[STRIDE Test Space]]
  
===How to get started===
+
[[Category:Test Units]]
 
 
The following is an outline of the required steps to get started with writing C++ test classes.
 
 
 
# Create a new Studio workspace (or open an existing one).
 
# Set the workspace to cpp mode (for compilation).
 
# Add {STRIDE_DIR}\inc\srtest.h to the Source Files folder of your workspace.
 
# Add {STRIDE_DIR}\scripts\TestClasses\TestClass_Preprocess.pl (or .js) to your Script Files folder.  If you will be adding a script to compile the workspace (see next step), this script must always '''preceed''' the compilation step.
 
# Add a script to compile the workspace.  In it's simplest form, this script can simple be something like:
 
  #perl syntax
 
  Win32::OLE->Option(Warn => 3);
 
  $main::studio->Workspace->Compile();
 
or
 
  /* jscript syntax */
 
  studio.Workspace.Compile();
 
 
 
#
 

Latest revision as of 17:09, 25 September 2013

What are STRIDE Test Units?

STRIDE Test Units is a general term for xUnit-style test modules running within the STRIDE runtime framework. These tests--written in C and C++--are compiled and linked with your embedded software and run in-place on your target hardware. They are suitable for both developer unit testing as well as end-to-end integration testing.

An external Test Runner is provided which controls the execution of the tests and publishes test results to the local file system and optionally to S2's Internet STRIDE Test Space.

Test Unit Features

In all cases, STRIDE Test Units provide the following capabilities typical of all xUnit-style testing frameworks:

  • Specification of a test as a test method
  • Aggregation of individual tests into test suites which form execution and reporting units
  • Specification of expected results within test methods (typically by using one or more Test Code Macros)
  • Test fixturing (optional setup and teardown)
  • Test parametrization (optional constructor/initialization parameters)
  • Automated execution
  • Automated results report generation

Unique STRIDE Test Unit Features

In addition, STRIDE Test Units offer these unique features:

On-Target Execution
Tests execute on the target hardware in a true operational environment. Execution and reporting is controlled from a remote desktop (Windows, Linux or FreeBSD) host
Dynamic Test and Suite Generation
Test cases and suites can be created and manipulated at runtime
Test Doubles
Dynamic runtime function substitution to implement on-the-fly mocks, stubs, and doubles
Behavior Testing (Test Points)
Support for testing of asynchronous activities occurring in multiple threads
Multiprocess Testing Framework
Support for testing across multiple processes running simultaneously on the target
Automatic Timing Data Collection
Duration are automatically measured for each test case.
Automatic Results Publishing to Local Disk and Internet
Automatic publishing of test results to STRIDE Test Space