org.scalatest

class SpecReport

[source: org/scalatest/SpecReport.scala]

@scala.serializable

class SpecReport(val override name : java.lang.String, val override message : java.lang.String, val plainSpecText : java.lang.String, val formattedSpecText : java.lang.String, val includeInSpecOutput : Boolean, val override throwable : scala.Option[java.lang.Throwable], val override rerunnable : scala.Option[Rerunnable], val override threadName : java.lang.String, val override date : java.util.Date)
extends Report

Class used to send specification-style reports to a Reporter.

The primary constructor instantiates a new Report with specified name, message, specification text, formatted specification text, flag indicating whether to include the report in a specification-style output, optional throwable, optional rerunnable, thread name, and date. This class can be subclassed to send more information to a reporter.

The difference between message, plainSpecText, and formattedSpecText is that message is formatted as a "normal" test report, plainSpecText is formatted for specification-style output, and formattedSpecText is formatted for specification-style output to the console. For example, if the message looks like this:

StackSpec - A Stack (with one item less than capacity) should not be full

The plainSpecText might look like:

A Stack (with one item less than capacity) should not be full

And the formattedSpecText might look like:

- A Stack (with one item less than capacity) should not be full

The includeInSpecOutput Boolean flag is used to omit reports that would detract from the readability of the specification-style output. For example, trait Spec sets includeInSpecOutput to false for testStarting reports, but to true for testSucceeded and testFailed reports. This produces reports that read more like specifications, for example:

 A Stack (when not empty)
 - should allow me to pop
 - should be invoked
 A Stack (when not full)
 - should allow me to push
 

Extensibility

SpecReport, like its superclass Report, can be subclassed so that custom information can be passed to the subclass's constructor. This information can be passed in when the SpecReport subclass is instantiated, from within test methods, overridden Suite methods, or other code. Instances of SpecReport subclasses can be passed to any Reporter, but any custom information they contain will not be presented to the user except by Reporters written with knowledge of the SpecReport subclass and its custom information. Thus, when you define a SpecReport subclass that embeds custom information, you would typically also define one or more Reporter classes that present the custom information to the user.

Parameters
name - the name of the entity about which this report was generated.
message - a String message.
plainSpecText - the plain specification text String, with no formatting.
formattedSpecText - the specification text String formatted for printing to the console.
includeInSpecOutput - a Boolean flag that indicates whether this SpecReport should be included in a specification-style output.
throwable - the Throwable that indicated the problem, or a Throwable created to capture stack trace information about the problem, or None. If None is passed, the problem is reported without describing a Throwable.
rerunnable - a Rerunnable that can be used to rerun a test or other entity (such as a suite), or None. If None is passed, the test or other entity can not be rerun.
threadName - a name for the Thread about whose activity this report was generated.
date - a relevant Date. For example, the a Date indicating the time this Report was generated, or a Date indicating the time the event reported by this Report occurred.
Throws
NullPointerException - if any of the specified name, message, plainSpecText, formattedSpecText, throwable, rerunnable, threadName, or date references are null.
Author
Bill Venners
Additional Constructor Summary
def this (name : java.lang.String, message : java.lang.String, plainSpecText : java.lang.String, formattedSpecText : java.lang.String, includeInSpecOutput : Boolean) : SpecReport
Constructs a new Report with specified name and message.
def this (name : java.lang.String, message : java.lang.String, plainSpecText : java.lang.String, formattedSpecText : java.lang.String, includeInSpecOutput : Boolean, throwable : scala.Option[java.lang.Throwable], rerunnable : scala.Option[Rerunnable]) : SpecReport
Constructs a new Report with specified name, message, optional throwable, and optional rerunnable.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Additional Constructor Details
def this(name : java.lang.String, message : java.lang.String, plainSpecText : java.lang.String, formattedSpecText : java.lang.String, includeInSpecOutput : Boolean) : SpecReport
Constructs a new Report with specified name and message.
Parameters
name - the name of the entity about which this report was generated.
message - a String message.
Throws
NullPointerException - if any of the specified name, message, plainSpecText, or formattedSpecText parameters are null.

def this(name : java.lang.String, message : java.lang.String, plainSpecText : java.lang.String, formattedSpecText : java.lang.String, includeInSpecOutput : Boolean, throwable : scala.Option[java.lang.Throwable], rerunnable : scala.Option[Rerunnable]) : SpecReport
Constructs a new Report with specified name, message, optional throwable, and optional rerunnable.
Parameters
name - the name of the entity about which this report was generated.
message - a String message.
throwable - a relevant Throwable, or None. For example, this Throwable may have indicated a problem being reported by this Report, or it may have been created to provide stack trace information in the Report.
rerunnable - a Rerunnable that can be used to rerun a test or other entity, or None.
Throws
NullPointerException - if any of the specified name, message, , plainSpecText, formattedSpecText, throwable, or rerunnable parameters are null.


Copyright (C) 2001-2009 Artima, Inc. All rights reserved.