Difference between revisions of "Studio:Reporting Sample"

From STRIDE Wiki
Jump to: navigation, search
(Prerequisites)
 
Line 3: Line 3:
  
 
==Prerequisites==
 
==Prerequisites==
Before starting, some prerequisites must be satisfied. For details and instructions, see [[Desktop Installation]].
+
Before starting, some prerequisites must be satisfied. For details and instructions, see [[Studio:Desktop Installation]].
  
 
Specifically:
 
Specifically:
 
* STRIDE must be installed on the Windows PC to be used in the training, and any required licenses must be present.
 
* STRIDE must be installed on the Windows PC to be used in the training, and any required licenses must be present.
* Active State Perl must be installed, and [[Desktop Installation#Perl|additional perl packages]] must be downloaded and installed. '''Note:''' when the sample workspace is executed, a script runs that verifies that the required Perl packages have been installed correctly.
+
* Active State Perl must be installed, and [[Studio:Desktop Installation#Perl|additional perl packages]] must be downloaded and installed. '''Note:''' when the sample workspace is executed, a script runs that verifies that the required Perl packages have been installed correctly.
  
 
==Overview==
 
==Overview==

Latest revision as of 23:01, 6 May 2010

Introduction

The following content relates to the sample files and workspaces installed in %STRIDE_DIR%\Samples\TestScripts\Reporting. This sample consists of test scripts and a STRIDE workspace for sample code execution.

Prerequisites

Before starting, some prerequisites must be satisfied. For details and instructions, see Studio:Desktop Installation.

Specifically:

  • STRIDE must be installed on the Windows PC to be used in the training, and any required licenses must be present.
  • Active State Perl must be installed, and additional perl packages must be downloaded and installed. Note: when the sample workspace is executed, a script runs that verifies that the required Perl packages have been installed correctly.

Overview

Getting Started

The sample is executed by opening the workspace and executing the scripts by pressing the RunAll.png button. When execution is complete, the results are summarized to the Studio output window and a link to the results file is provided. You can now peruse the output report and the scripts that generated the results.

Reporter Basics

The STRIDE Reporter object provides a means to organize and collect test results data, then publish results in a format of your choosing. The STRIDE Studio application integrates a reporter object with its collection of test scripts, and this sample's Studio workspace defines the hierarchy of the test scripts that will be the resulting hierarchy of the test suites and test cases in the generated report. The following describes the contents of the test report in more detail.

Report Organization

As stated earlier, the Reporter stores test results hierarchically. At the top level, it holds a collection of one or more child Suites. These Suites--in turn--hold a collection of zero or more child Tests, a second collection of zero or more Suites, and a third collection of zero or more Annotations.

Each Test has a collection of zero or more Comments, and each Annotation has a collection of zero or more Comments.

The diagram at the right shows an example hierarchy.

Reporter Object Hierarchy

The Suite Object

The Suite object is used to group related Tests (and Annotations--if present) so that their results can be summarized on an output report.

The Suite object exposes a set of properties, the most important are listed below.

  • Name
  • Description

The Test Object

The Test object represents a specific test that is run. The result of a test is reflected in its Status property ("PASS"/"FAIL").

The most important properties of the Test object are listed below.

  • Name
  • Description
  • Status

The Comment Object

The Comment object allows you to attach a text comment to a Test or Annotation. Comments are useful for logging test script flow and other test information.

The Comment object exposes two properties listed below.

  • Comment
  • Label

The Annotation Object

The Annotation object is used when you want to associate a file or a URI with a Suite. (e.g. a screen shot or other data file).

The Annotation object is designed for use with STRIDE Portal, and will not be covered further here. For more information, see the Annotation item section of the Reporter reference article.

Sample Scripts

We provide a range of examples in JScript and perl that demonstrate how to use the reporter object model. The scripts in both languages are functionally identical, differing only in syntax. The following sections briefly describe each broad category. We encourage you to read and understand the provided examples.

Suites

add

Creates new Suite objects in a Suites collection.

remove

Removes Suite objects from a collection by name and index. Also demonstrates use of RemoveAll.

find

Gets instances of existing Suite objects in a collection using the Item and Find methods. Also shows how the Parent property can be used to navigate upwards in the Suite hierarchy.

output

Persists results for a Suite as HTML and XML. The XML output is also used to reload the results.

custom data

Creates Custom Data fields for a Suite.

annotations

Creates Annotations for a Suite.

Tests

status

Creates several Tests and shows various means of settings status.

remove

Removes Test objects from a collection by name and index. Also demonstrates use of RemoveAll.

find

Gets instances of existing Test objects in a collection using the Item method. Also shows how the Parent property can be used to navigate upwards in the Test/Suite hierarchy.

comments

Creates Comments for a Test.

metrics

Demonstrates the use of implicit and explicit duration data. Also shows how to add optional Test Metric data.

Dual Mode

We provide one script in each language that is written so as to be runnable both within and outside of stride studio (standalone). These scripts are executed as part of the normal workspace execution. In order to run the scripts outside studio, follow these steps:

  • Exit STRIDE Studio
  • Open a DOS command prompt and change to the %STRIDE_DIR%\Samples\Scripting\Reporting directory
  • To execute the perl standalone script:
      perl Scripts\perl\DualMode\standalone.pl
    

    To execute the JScript version:

      cscript Scripts\jscript\DualMode\standalone.js
    

    Each script will produce a corresponding report file in the current directory.