oTest.$newselection()

Function group Execute on client Platform(s)
oTest NO All

Syntax

oTest.$newselection([cLibraries, cFolders, bSubfolders=kTrue, cClasses, cTags, bMatchAll, cExclude])

Description

Returns a selection of test classes, as a row, for $runsuite and $opentestsuite: the libraries, folders and classes, narrowed by tags, minus any exclusions.

$newselection() returns a selection: a row that describes a set of Test Case classes. Pass it to oTest.$runsuite() to run those classes, or to oTest.$opentestsuite() to open the Test Suites window with them ticked. A selection holds only simple values, so it can be stored and used again later.

Every parameter is optional. cLibraries says which libraries to choose from, or every open library if it is empty. Any folders and classes narrow the choice to themselves; with neither, every test class in those libraries is chosen. The tags then narrow the choice further, and the exclusions are taken out last. Only test classes that have at least one test (a method whose name starts with $test) are ever chosen. Names are compared without regard to case.

The parameters are as follows:

Parameter Description
cLibraries Comma-separated libraries to choose test classes from. If empty, every open library is used.
cFolders Comma-separated folders. A folder name is looked for in each library of cLibraries, or can be written library.folder to name the folder in one library. Every test class in each folder is chosen, and, unless bSubfolders is kFalse, every test class in the folders below it.
bSubfolders kTrue, the default, for each folder to take the test classes in the folders below it as well. kFalse for each folder to take only the classes directly in it. It applies to cFolders only.
cClasses Comma-separated test classes. A class name is looked for in each library of cLibraries, or can be written library.class to name the class in one library.
cTags Comma-separated tags. Only the chosen classes that have any of these tags are kept. A class's tags are its $tags property.
bMatchAll kTrue to keep only the classes that have all of the tags, rather than any of them. The default is kFalse.
cExclude Comma-separated test classes to leave out, named as for cClasses.

For example:

# Every test class in myLib, except oTest_Slow
Calculate lSelection as oTest.$newselection("myLib","",kTrue,"","",kFalse,"oTest_Slow")

# Only the Billing folder of myLib, not its subfolders
Calculate lSelection as oTest.$newselection("myLib","Billing",kFalse)

# Two classes in myLib
Calculate lSelection as oTest.$newselection("myLib","",kTrue,"oTest_A,oTest_B")

# The Tests folder of every open library that has one
Calculate lSelection as oTest.$newselection("","Tests")

The selection stores each class name with its library. If cLibraries is empty, the libraries searched are the ones open when you call $newselection(), not when the selection is later run or opened.