Difference between revisions of "Training Fixturing"

From STRIDE Wiki
Jump to: navigation, search
(Implement Exercise)
Line 1: Line 1:
= Objectives =
+
== Objectives ==
  
 
This Training Module focuses on '''Fixturing''' in the context of the STRIDE Test System. For a high-level overview refer to the following wiki section on [[What_is_Unique_About_STRIDE#Fixturing | fixturing]]. This module covers the following topics:
 
This Training Module focuses on '''Fixturing''' in the context of the STRIDE Test System. For a high-level overview refer to the following wiki section on [[What_is_Unique_About_STRIDE#Fixturing | fixturing]]. This module covers the following topics:
Line 13: Line 13:
 
The Test Unit has one test case already implemented (used for reference) and has '''two test methods''' that you are required to implement (called '''Exercise1''' and '''Exercise2''').  Currently the ''Exercise1'' method is empty and returns a ''NOT IN USE'' status. The ''Exercise2'' method does not yet exist.  
 
The Test Unit has one test case already implemented (used for reference) and has '''two test methods''' that you are required to implement (called '''Exercise1''' and '''Exercise2''').  Currently the ''Exercise1'' method is empty and returns a ''NOT IN USE'' status. The ''Exercise2'' method does not yet exist.  
  
= Instructions =
+
== Instructions ==
  
== Build and Run TestApp ==
+
=== Build and Run TestApp ===
  
 
* Build TestApp using SDK makefile
 
* Build TestApp using SDK makefile
Line 44: Line 44:
 
* Review the details of the test results using a Browser. Open '''TestApp.xml''' which can be found in the ''sample_src'' directory (based on the ''output'' option). By opening the xml file in a web browser the xsl is automatically applied to create html.
 
* Review the details of the test results using a Browser. Open '''TestApp.xml''' which can be found in the ''sample_src'' directory (based on the ''output'' option). By opening the xml file in a web browser the xsl is automatically applied to create html.
  
== Implement Exercise ==
+
=== Implement Exercise ===
  
 
* '''TestFixture::Exercise1'''
 
* '''TestFixture::Exercise1'''
Line 72: Line 72:
 
   Saving result file...
 
   Saving result file...
  
== Run and Publish Results ==
+
=== Run and Publish Results ===
  
 
When you have completed the Exercise(s) publish your results to Test Space. To make it easier for now we recommend that you update your existing option file (myoptions.txt) with the following if not already done:  
 
When you have completed the Exercise(s) publish your results to Test Space. To make it easier for now we recommend that you update your existing option file (myoptions.txt) with the following if not already done:  
Line 86: Line 86:
 
Note: This space has been set up with a Baseline of [[Training_Getting_Started#Test_Space_Access | ''expected test results'']] that you can use to validate your results.
 
Note: This space has been set up with a Baseline of [[Training_Getting_Started#Test_Space_Access | ''expected test results'']] that you can use to validate your results.
  
= Reference =
+
== Reference ==
 
The following reference information is related to passing parameters to Test Units.
 
The following reference information is related to passing parameters to Test Units.
  
== Wiki ==
+
=== Wiki ===
  
 
* [[Test_Unit_Pragmas#Fixturing_Pragmas | Fixturing Pragmas]] -- important information for setting up and tearing down ''things'' between each executed test method within a Test Unit
 
* [[Test_Unit_Pragmas#Fixturing_Pragmas | Fixturing Pragmas]] -- important information for setting up and tearing down ''things'' between each executed test method within a Test Unit
 
** Review the types of Test Units these pragmas are applicable for  
 
** Review the types of Test Units these pragmas are applicable for  
  
== Samples ==
+
=== Samples ===
  
 
* [[Test_Class_Sample | Test Class Sample]] - Specifically the [[Test_Class_Sample#Basic::Fixtures | Basic Fixtures]] Test Unit
 
* [[Test_Class_Sample | Test Class Sample]] - Specifically the [[Test_Class_Sample#Basic::Fixtures | Basic Fixtures]] Test Unit

Revision as of 16:22, 31 August 2011

Objectives

This Training Module focuses on Fixturing in the context of the STRIDE Test System. For a high-level overview refer to the following wiki section on fixturing. This module covers the following topics:

  • Startup logic at the beginning of a Test Unit
  • Setup logic for each test method
  • Teardown logic for each test method


There are two test files used -- TestFixture.cpp & TestFixture.h. These implement one Test Unit:

  • TestFixture


The Test Unit has one test case already implemented (used for reference) and has two test methods that you are required to implement (called Exercise1 and Exercise2). Currently the Exercise1 method is empty and returns a NOT IN USE status. The Exercise2 method does not yet exist.

Instructions

Build and Run TestApp

  • Build TestApp using SDK makefile
  • Startup TestApp
  • If not already done, create an option file (myoptions.txt) using the following content (Windows example)
 ##### Command Line Options ######
 --device "TCP:localhost:8000"
 --database %STRIDE_DIR%\SDK\Windows\out\TestApp.sidb
 --output %STRIDE_DIR%\SDK\Windows\sample_src\TestApp.xml
 --log_level all
  • Execute Test Fixture Test Unit only
 > stride -O myoptions.txt --run TestFixture
 Loading database...
 Connecting to device...
 Executing...
   test unit "TestFixture"
     > 1 passed, 0 failed, 0 in progress, 1 not in use.
   --------------------------------------------------------------
   Summary: 1 passed, 0 failed, 0 in progress, 1 not in use.

 Disconnecting from device...
 Saving result file...
  • Review the details of the test results using a Browser. Open TestApp.xml which can be found in the sample_src directory (based on the output option). By opening the xml file in a web browser the xsl is automatically applied to create html.

Implement Exercise

  • TestFixture::Exercise1
    • Add a NOTE that will display the name of the test
    • Validate that Sequence2 is persisted when starting the Thread
  • TestFixture::Exercise2
    • Add new test method declaration called Exercise2 to TestFixture.h
    • Add new test method implementation of Exercise2 to TestFixture.cpp
    • Add a NOTE that will display the name of the test
    • Validate that Sequence3 is persisted when starting the Thread


  • Execute only TestFixture
 > stride -O myoptions.txt --run TestFixture
 Loading database...
 Connecting to device...
 Executing...
   test unit "TestFixture"
     > 3 passed, 0 failed, 0 in progress, 0 not in use.
   --------------------------------------------------------------
   Summary: 3 passed, 0 failed, 0 in progress, 0 not in use.
  
 Disconnecting from device...
 Saving result file...

Run and Publish Results

When you have completed the Exercise(s) publish your results to Test Space. To make it easier for now we recommend that you update your existing option file (myoptions.txt) with the following if not already done:

 #### Test Space options (partial) #####
 #### Note - make sure to change username, etc. ####
 --testspace https://username:password@yourcompany.stridetestspace.com
 --project Training
 --name YOURNAME
  > stride -O myoptions.txt --run TestFixture --space TestFixture --upload

Note: This space has been set up with a Baseline of expected test results that you can use to validate your results.

Reference

The following reference information is related to passing parameters to Test Units.

Wiki

  • Fixturing Pragmas -- important information for setting up and tearing down things between each executed test method within a Test Unit
    • Review the types of Test Units these pragmas are applicable for

Samples