TestPlan Context
Document

Context

by Group Public on Tuesday April 14 2009 @ 16:54:32 (1/1 Points)

Language ↪Reference ✑ Reply ✓ Stick It ✗ Ditch It ⚐ Tag It

The Context is the name given to the mechanism which stores configuration parameters, variables, and parameters within the TestPlan framework.

Global Memory

For the most basic uses it functions similar to how global memory works in traditional programming, or scripting languages. That is, if in any of your scripts you set a value, it will be available to all other scripts in the same context.

For example

--Main.test--
call Setup.test
call Show.test

--Setup.test--
set %Value% test

--Show.test--
Notice %Value%

This will print test.

Segmented Memory

The context is at the same time the mechanism by which the variables from multiple scripts are separated from each other. When you call exec you will actually be executed your script in a sub-context (which also gets its own LogicalRoot). That is, to use the example from above.

--Main.test--
exec Setup.test
exec Show.test

--Setup.test--
set %Value% test

--Show.test--
Notice %Value%

This will produce an error as %Value% is not yet defined.

Hierarchical Memory

The sub-contexts inherit from their parent context. This is what allows configuration options to be available to all child contexts. To continue with the above example:

--Main.test--
set %Value% first
exec Setup.test
exec Show.test

--Setup.test--
set %Value% test
notice %Value%

--Show.test--
Notice %Value%

Will output:

test
first

Setup.test used its own value, which it is said to have overridden, and Show.test will use its parent value set in Main.test.

© 2008-2010 edA-qa mort-ora-y
Using Persephone and TestPlan
Tag: