VariableSet - class representing sets of session variables
Steven J. McDowall <firstname.lastname@example.org>
Copyright 2002-2011 Applied Testing and Technology, Inc. All Rights Reserved.
use VariableSet; # create a new VariableSet object my $variables = new VariableSet; # read the set from a file $variables->fromFile( Config::SITE::VariableFile);
The VariableSet object is a handy container object used to track/read/manipulate a suite's variable definitions into a memory data structure.
The format of a variable definition file is a whitespace separated collection of fields, one record per row, with the first row of the file being a definition of the field names. In this case, the fields in the file are:
the name of the variable
the type of the variable: one of text, textbox, single, multiple, derived, or separator
a comma separated list of options for this variable. Flags vary by type, and are documented in the ApTest Manager User's Guide.
the size of the input field when presenting to the user
the prompt to use when asking for a value from the user
a comma separated list of potential values for this variable (if it is a single or multiple), and a default value to use for text or textbox. If it is a comma separated list, items starting with an asterisk are "defaults" for the item.
$set = new VariableSet( suite [, template [, path [, noLocalVars ] ] ] ) ;
Creates a new VariableSet object, optionally reading in the base definition from a file.
suite is the name of the test suite to operate on. If not defined, then operate on a template.
template is the name of the template to operate upon.
path is an optional path to the suite / template. Used for testing.
noLocalVars is a boolean. If defined and true, then do not load and variable definitions from the file VARIABLES.local. Defaults to false (do load the local variables).
returns a reference to the VariableSet object.
$set->toFile( filename ) ;
$set->loadAccountDefaults( vendor ) ;
Adds a new header entry into the set and marks it as the current header for future variable adds.
$set->addHeader( $id, $title) ;
$id - the title identifer
$title - the text to display
Adds a new variable to the set.
$set->addVariable( $varRef );
$varRef - a reference to a Variable object.
my $header = $set->currentHeader();
my $var = $set->getVarByName( $id ) ;
my $count = $set->countVars();
my $count = $set->countHeaders();
my $count = $set->countSessionVars();
my $hash = $set->getVarHash();
my $headers = $set->getHeaderArray();
my $list = $set->sessionVarList();
my $dir = $set->suiteDir(); $set->suiteDir( $suite );
Gets/sets the path to the test suite data root.
@vlist = $vars->visibleList( [$includeSpecials [, sortIt] ] ) ;
includeSpecials is a boolean that defaults to false. If true, then the reserved atm special session variables are also included.
sortit is a boolean that indicates whether the results should be alphabetically sorted or not. The default is to NOT sort the results.
showMandatory is a boolean indicating whether to show which fields are mandatory or not. Defaults to true.
VariableSet::Header - class representing section headers
my $header = VariableSet::Header->new( $id, $title );
my $id = $header->id();
my $title = $header->title();
my $list = $header->variableList();
Copyright © 2000-2013 Applied Testing and Technology, Inc. All rights reserved.