Running Tests (old): Difference between revisions

From STRIDE Wiki
Jump to navigation Jump to search
Line 34: Line 34:


A couple of things to note:
A couple of things to note:
* If others may be running tests using referenced database, you should specify a unique output file location (via the -o option) to prevent overwriting the output file at the default location.
* If you are running tests of a shared location and others may be running tests using the same referenced database, you should specify a unique output file location (via the -o option) to prevent overwriting the output file.
* If you will be running many tests against a specific database and/or device, consider setting [[Stride_Executable#Environment_Variables|environment variables]] to the corresponding values, or put command line options into an options file (via the -O option).
* If you will be running many tests against a specific database and/or device, consider setting [[Stride_Executable#Environment_Variables|environment variables]] to the corresponding values, or put command line options into an options file (via the -O option).
* You can refer to the device address using a DNS name if desired (e.g. TCP:testcomputer:8000)
* You can refer to the device address using a DNS name if desired (e.g. TCP:testcomputer:8000)

Revision as of 19:10, 22 September 2009

Target-based Test Units are controlled by a host computer, physically connected to the target via a configurable communication channel (TCP/IP or serial port). This article describes some common usage patterns and presents several examples.

Prerequisites

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

Host

Target

  • Target transport configured
  • Target built with STRIDE library built in and one or more test cases
  • Target app running [1]

Preparing to Run Your Tests

Tests are executed on the target by running the program stride on the host computer. See the linked article for reference information.

In order for stride to run your tests, the STRIDE database (.sidb) file that was produced as part of the target build must be accessible to the program via the host filesystem. This is trivial to accomplish when the target is built on the host computer (as when building and running tests off-target) or when the host and target computers are running the same operating system and are connected via LAN. But for dissimilar operating systems, you will need to mount the target filesystem on the host computer. (Many of our customers use Samba to accomplish this.)

By default, all tests present in the database are executed in ascending alpha-numeric order (by name) (This can be overridden; see below.)


Desktop Test Development

Useful for 'pre-flight' desktop testing as well as target debugging, the following command line runs the target tests without publishing results to STRIDE Test Space.

We assume the following:

  • We are testing against a target build that contains Test Units that I don't want to run. (Perhaps they test code that I am not responsible for.)
  • The target device is running, and is available on the LAN via TCP/IP at 192.168.0.53
  • I want to run only Test Units named myTest1, myTest2, and myTest3

The command line to run the desired tests would be:

stride -r "myTest1;myTest2;myTest3" --database="/my/path/targetApp.sidb" --device=TCP:192.168.0.53:8000

A couple of things to note:

  • If you are running tests of a shared location and others may be running tests using the same referenced database, you should specify a unique output file location (via the -o option) to prevent overwriting the output file.
  • If you will be running many tests against a specific database and/or device, consider setting environment variables to the corresponding values, or put command line options into an options file (via the -O option).
  • You can refer to the device address using a DNS name if desired (e.g. TCP:testcomputer:8000)
  • For more information and examples, see Listing Test Units and Running A Subset of Tests.

Publishing Test Results

Saving Results to the Local Disk

When stride is executed to run tests, the following files are written to the local disk. By default, they are written to the directory in which the database is specified. You can specify a different location by using the -o option when you run stride. If these files already exist, they are overwritten.

[database_name].xml
Raw xml test output.
[database_name].xsl
Stylesheet to format the xml file for viewing in a web browser. (This file is automatically downloaded only if you are connected to the Internet.)

Displaying Local Results Data

If you open the xml file in a browser, the xsl stylesheet (if present) will be automatically applied to the xml so that the data is rendered in html within the browser.

Publishing Results to STRIDE Test Space

stride can also be instructed to upload test results to STRIDE Test Space.

Example: Desktop Testing with Publication to Test Space

This example demonstrates the running of specified target tests followed by publication of the results to STRIDE Test Space.

Here, we create an options file since the command line is getting very long. (We could put several of these option values in environment variables instead if desired.)

The option file is named myOptions.txt, is located in the current directory and contains the following text:

--database "/my/path/targetApp.sidb"
--device TCP:192.168.0.53:8000
-r /{myTest1;myTest2; myTest3}
-u
--testspace https://username:password@mycompany.stridetestspace.com
--project "Super Repeater"
--space "Input Processor"
-o myoutputfile.xml

The command line is then:

stride -O "myOptions.txt"

Note: In order for publishing to succeed, the username/password must be correct and the project and space must already exist. If you are using TestSpace for the first time, you should check with your administrator about how to create projects and spaces.


Notes

  1. If target is multi-process, both the target and the STRIDE I/O daemon process must be started.