Send Hello, World! to a Result

The following line of code placed into a Script (and subsequently a Test Composition) provides a quick sense of the power of 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).



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