Running Tests (old): Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
This article describes how to run your testunit tests
==Overview==
==Overview==
Target-based tests are controlled by a host Windows PC, connected to the target via a configurable communication channel.
Target-based [[Test Units]] are controlled by a Windows PC host, physically connected to the target via a configurable communication channel.
 
 
STRIDE provides two Transport DLLs by default. One is for serial communication. The other creates a TCP/IP client connection to the target device. In the case of serial communication, the host and target must be physically connected using a standard serial communication cable. Both the target and host must be configured with compatible settings (baud rate, data bits, etc). For the TCP/IP transport, the target device must have an accessible network interface and be accepting connections on a configurable port number (8000 by default in most PALs).


If you need a Transport DLL that implements a different communication protocol, see the STRIDE Host Runtime Transport Specification for information about implementing your own library -- or contact us for assistance.
== Prerequisites ==
In order to run target-based [[Test Units]], the following prerequisites are required.


==Prerequisites==
=== Host ===
=== Host ===
* STRIDE Studio and its prerequisites installed on the host pc
* [[Desktop Installation|STRIDE Studio and its prerequisites]] installed on the host pc
* Host transport configured
* Host transport configured (see below)


=== Target ===
=== Target ===
* Target transport configured
* Target transport configured
** TCP/IP over port 8000 is the default target transport. To apply other configurations, see [[Category:SDKs|SDKs]]  
** TCP/IP over port 8000 is the default target transport. To apply other configurations, see [[:Category:SDKs|SDKs]]  
* Target built with STRIDE library built in and one or more test cases
* Target built with STRIDE library built in and one or more test cases
* Target app running (or if target is multi-process, start target and STRIDE i/o daemon process)
* Target app running <ref>If target is multi-process, both the target and the STRIDE I/O daemon process must be started.</ref>
 


== Host Transport Configuration ==
== Host Transport Configuration ==
Line 58: Line 50:


=== Specifying Tests to Run ===
=== Specifying Tests to Run ===
By default all tests are run in the order in which their corresponding SCL pragmas were seen by the [[s2scompile|STRIDE compiler]]. This is typically what you want, but you may also specify which test suites to run and in what order they are to be run.<ref> (A test suite is the grouping of tests by SCL pragma; this corresponds to eithera test class , a set of free functions, or a C-based class).</ref>
By default all tests are run in the order in which their corresponding SCL pragmas were seen by the [[s2scompile|STRIDE compiler]]. This is typically what you want, but you may also specify which test suites to run and in what order they are to be run.<ref> A ''test suite'' here is the grouping of tests by SCL pragma; this corresponds to either:
* a test class
** '''#pragma scl_test_class()'''
* a set of free functions, or  
** '''#pragma scl_test_flist()'''
* a C-based class)
** '''#pragma scl_test_cclass()'''
</ref>


* Specify test(s) to run and their order on the [[TestUnitRun.pl]] command line (using -r)
* Specify test(s) to run and their order on the [[TestUnitRun.pl]] command line (using -r)
* Specify test(s) to run and their order by means of an ''order file''
* Specify test(s) to run and their order by means of an [[order file]]




[[Test Spaces Configuration File]]
=== Notes ===
<references/>

Revision as of 21:49, 6 April 2009

Overview

Target-based Test Units are controlled by a Windows PC host, physically connected to the target via a configurable communication channel.

Prerequisites

In order to run target-based Test Units, the following prerequisites are required.

Host

Target

  • Target transport configured
    • TCP/IP over port 8000 is the default target transport. To apply other configurations, see SDKs
  • Target built with STRIDE library built in and one or more test cases
  • Target app running [1]

Host Transport Configuration

Host transport configuration is a one-time setup the comprises editing the transport.cfg file to reflect your target communication setup.

If you are using TCP/IP as your communcation channel, this configuration is typically only a matter of specifying your tareget's IP address (or DNS name) as the sockets DeviceAddress.

For configuration details, see Transport Configuration File.

Verifying Transport Settings

You can quickly verify your transport settings by running the Connect.pl script. (Installed to C:\STRIDE\Scripts\Connect.pl) (Your target must be running in order for the connection to succeed.)

Running Your Tests

Tests are executed on the target by running the script TestUnitRun.pl on the host computer.

Command line options allow you to tailor the the script's operation, but at a minimum:

  • The script must be able to read the STRIDE database (.sidb) file that corresponds to the target build
  • The script uses the transport configuration settings in transport.cfg to establish communication with the target

By default, tests are run in the order in which their corresponding SCL pragmas were seen by the STRIDE compiler (This can be overridden; see below.)

Examples

Commonly useful flags for TestUnitRun.pl include -v and -u. (See the link for complete information). For example:

Pre-Flight Testing

Useful for 'pre-flight' desktop testing, the following command line runs the target tests then automatically launches the local HTML report in your browser.

TestUnitRun.pl -d stride.db -v

Publication to Test Space

This example will run the target tests and then publish the results to STRIDE Test Space according to the configuration specified in your Test Spaces Configuration File.

TestUnitRun.pl -d stride.db -u -n="My Test Run"


Specifying Tests to Run

By default all tests are run in the order in which their corresponding SCL pragmas were seen by the STRIDE compiler. This is typically what you want, but you may also specify which test suites to run and in what order they are to be run.[2]

  • Specify test(s) to run and their order on the TestUnitRun.pl command line (using -r)
  • Specify test(s) to run and their order by means of an order file


Notes

  1. If target is multi-process, both the target and the STRIDE I/O daemon process must be started.
  2. A test suite here is the grouping of tests by SCL pragma; this corresponds to either:
    • a test class
      • #pragma scl_test_class()
    • a set of free functions, or
      • #pragma scl_test_flist()
    • a C-based class)
      • #pragma scl_test_cclass()