Training Instrumentation

From STRIDE Wiki
Revision as of 18:11, 11 May 2010 by Mikee (talk | contribs) (Created page with '== Background == Source instrumentation is the means by which application domain experts strategically instrument the source under test to as to be able to the write tests again…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Background

Source instrumentation is the means by which application domain experts strategically instrument the source under test to as to be able to the write tests against the expected behavior of the code when it's running. Source instrumentation is one of the first steps toward enabling expectation testing of your application.

Source instrumentation is accomplished by a set of simple yet powerful macros provided by the STRIDE Runtime library. The macros are easily activated/deactivated for any build through the use of a single preprocessor macro value. When activated, they provide a means to validate the behavior of your application as it is running.

Where Should I Instrument ?

When thinking about where to instrument your source under test, consider these high-value locations:

  • Function entry and exit points. Include call parameters as data if appropriate.
  • State transitions
  • Data transitions (any point where key data changes value)
  • Error conditions

What About Data ?

Including data with your test points adds another level of complexity and power to the validation of your source. Here are some general recommendations for using data effectively:

  • Try to use string data payloads wherever possible. String payloads are considerably more human-friendly when viewing test results and they allow for relatively simple string comparison validation.
  • i

Sample Code: s2_expectations_source

For this