Training Getting Started

From STRIDE Wiki
Revision as of 18:34, 28 November 2011 by Ivailop (talk | contribs) (Test Space Access)
Jump to: navigation, search

Overview

Our training approach is based on a self-guided tour of the STRIDE Testing Features using reference examples and assigned exercises. The set of examples and the implemented exercises will be built and executed using a standard desktop computer.

The software under test, reference examples, and exercises have been designed to be as simple as possible while sufficiently demonstrating the topic at hand. In particular, the software under test is very light on core application logic -- the focus instead is on the test code that leverages STRIDE to define and execute tests.

The user is expected to work through each of the training modules covering a specific testing feature. Once the exercises are completed (actual test cases implemented), the results are published to Test Space (and validated against a pre-created baseline).

The training collateral consists of the following:

  1. The STRIDE Framework used to implement and execute tests
  2. A set of specific Training Modules that will guide you through the exercises
  3. Wiki articles that will provide background material and other technical information
  4. Reference Samples
  5. The Off-Target Environment
  6. and STRIDE Test Space


For more details concerning STRIDE refer to the following:


For questions and support email us

Before Starting

Before you can start setting up your environment you need the following 3 items:

  • STRIDE Desktop Installation Package (one of the following)
STRIDE_framework-windows_4.3.yy.zip (Windows desktop)

or

STRIDE_framework-linux_4.3.yy.tgz (Linux desktop)
  • Training Source files
STRIDE_training_source.zip
  • Test Space User Account URL and Logon Credentials
    • Test Space URL (https://YourCompany.stridetestspace.com)
    • User-name
    • User-password

Desktop Setup

The training requires that you install the Desktop Framework and that the Off-Target Environment is setup correctly and verified.

For an overview of the installation steps please refer to this article.

The following steps are required:

  1. Install your desktop Framework package
  2. Read about the Off-Target Environment
  3. Install host compiler for your desktop
  4. Use the Off-Target SDK to build a Test App
  5. Run STRIDE diagnostics with the Test App built

Training Source Setup

The following source code can be found in the STRIDE_training_source.zip file:

  software_under_test.c | h
  TestBasic.cpp | h
  TestParam.cpp | h
  TestFixture.cpp | h
  TestExpect.cpp | h   
  TestRuntime.cpp | h
  TestFile.cpp | h
  TestDouble.cpp | h

The software under test is contained in the file software_under_test.c | h. All of the public functions use sut_ as a prefix. All training modules test against this file. Although the test examples are contained in C++ files, most of the test logic is written in standard C.

Once the files are obtained the next step is to rebuild the TestApp using the training source code. Move all of the files into the directory %STRIDE_DIR%\SDK\Windows\sample_src (or $STRIDE_DIR/SDK/Posix/sample_src for Linux) and follow the instructions for Building a TestApp.

Once built, list all Test Units within the generated database file using the following command:

Windows

> stride --database="%STRIDE_DIR%\SDK\Windows\out\TestApp.sidb" --list

Linux

> stride --database="$STRIDE_DIR/SDK/Posix/out/TestApp.sidb" --list

The following remoted Functions and Test Units should be displayed:

  Functions
    sut_strcpy(char const * input, char * output) : void
    strlen(char const * _Str) : size_t
  Test Units
    TestBasic_FList()
    TestBasic_Class()
    TestBasic_CClass()
    TestDouble_Reference()
    TestDouble_Definition()
    TestExpect_Seq()
    TestExpect_Data()
    TestExpect_Misc()
    TestFile()
    TestFixture()
    TestParam(int data1, int data2, char * szString)
    TestRuntime_Static()
    TestRuntime_Dynamic(int NumberOfTestCases)

Test Space Access

As part of the training users implement exercises (test cases). As each exercise is completed, the results are expected to be uploaded to Test Space. Accessing Test Space (uploading, viewing, etc.) requires an user-name and password. Before working on a training module please confirm that your user account has been set up by logging in.

Test Space will have expected results using baselines. This is used to automatically verify if the exercises have been implemented correctly (at least to some degree). For capturing test results a Training project has been created with the following Spaces:

  TestBasic   - Basics training results: TestBasic.cpp | h
  TestParam   - Parameters training results: TestParam.cpp | h
  TestFixture - Fixturing training results: TestFixture.cpp | h
  TestExpect  - Expectations training results: TestExpect.cpp | h   
  TestRuntime - Runtime API training results: TestRuntime.cpp | h
  TestFile    - File IO training results: TestFile.cpp | h
  TestDouble  - Doubling training results: TestDouble.cpp | h


To publish your results using the STRIDE Runner the following command-line options should be used:

 --testspace https://username:password@yourcompany.stridetestspace.com
 --project Training
 --space MODULENAME 
 --name YOURNAME

Notes:

  • Concerning the MODULENAME option: use the name that corresponds to the training module currently underway (e.g. TestBasic, TestParam, etc.)
  • YOURNAME should be set to your name (i.e. JohnD); omit spaces from this string
  • If you access the Internet via an HTTP proxy please read this article

Confirming Training Exercise Results

As you run and upload each test unit containing your worked training exercises, you should confirm the correctness of your work.

The correctly worked training test units will end up with a mix of passes and failures, so we use a Test Space baseline to get an aggregate comparison between expected and actual results

To validate your work:

  1. Navigate to your result set in Test Space and look under the column labeled COMPARISON WITH
  2. Confirm that none is indicated for each of the sub-column.
Test Space baseline example

Recommend Order

At this point you should be ready to start the actual training. The are 7 separate training modules and we recommend the following order:

  1. Basics - Covers basics of implementing and executing test cases
  2. Parameters - How to pass parameters to a test
  3. Fixturing - Leveraging setup and teardown featuring
  4. Expectations - Validating code sequencing along with state data
  5. Runtime API - Using the runtime services to dynamically create test suits / cases
  6. File IO - Reading and writing files existing on the host
  7. Doubling - Replacing a dependency with a stub, fake, or mock