Send Hello, World! to a Result

Document created by Chris Sommerstad Employee on Jul 22, 2017Last modified by Dave Murphy on Sep 26, 2017
Version 3Show Document
  • View in full screen mode

The following line of code placed into a Script (and subsequently a Test Composition) provides a quick sense of the power of SOASTA CloudTest pre-defined variables, as well as of the special status of the Result object within the object model: 

 

 

$context.result.postMessage($context.result.LEVEL_INFO, "hello, world");

—Or—

$context.result.postMessage($context.result.LEVEL_INFO, "hello", "world");

The first line of code posts a text string to the result object for the current composition. The second line posts the same string as well as a detail message about the execution of that line as shown below.

Results are accessed via Central > Recently Played and include a variety of informational postings about played Test Compositions).

SOASTA CloudTest also includes the constants LEVEL_VERBOSE, LEVEL_STATISTICS, and LEVEL_ERROR. For example,

$context.result.postMessage($context.result.LEVEL_VERBOSE, "hello, world [as 'verbose']");$context.result.postMessage($context.result.LEVEL_STATISTICS, "hello, world [as 'statistics']");
$context.result.postMessage($context.result.LEVEL_ERROR, "hello, world [as 'error']");

Attachments

    Outcomes