Send Hello, World! to a Result

Document created by Chris Sommerstad Employee on Jul 22, 2017Last modified by Sheril Joseph on Aug 14, 2017
Version 2Show 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");


$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).

Note:  Use the following links to download and import the XML for the entire Hello World Composition or just the Hello World Script Code. XML can be imported using the SOASTA CloudTest > Repository toolbar > Import icon. Refer to Script to learn how to add a script to a test clip and test composition.

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']");