Operators and Functions

The example results in the list of operators and functions below refer to the TestCases shown in the image below. The starting point of the search is the TestCases folder. Further TQL query examples can be found in chapter "Example TQL solutions".

Examples - current situation

Arrow operators

->

Examines the level beneath the starting point,

->SUBPARTS returns the TestCase folder Automobile and the TestCases Automobile 1, 1 Automobile, Truck, and Motorcycle

=>

Examines all levels beneath the starting point,

=>SUBPARTS returns all TestCase folders, TestCases, TestSteps, and TestStepValues

Relational operators

==

Equal,

=>SUBPARTS:TestCase[Name=="Automobile"] returns the TestCase Automobile

=i=

Equal, case insensitive,

=>SUBPARTS:TestCase[Name=i="automobile"] returns the TestCase Automobile

!=

Unequal,

=>SUBPARTS:TestCase[NAME!="Automobile"] returns the TestCases Automobile 1, 1 Automobile, Truck, and Motorcycle

!i=

Unequal, case insensitive

<

Less than,

=>SUBPARTS:XTestStepValue[(Name=="DateOfBirth")AND(Value<"01/01/1980")] returns the TestStepValue DateOfBirth

>

Greater than,

=>SUBPARTS:XTestStepValue[(Name=="DateOfBirth")AND(Value>"12/12/1970")] returns no result

<=

Less than or equal,

=>SUBPARTS:XTestStepValue[(Name=="DateOfBirth")AND(Value<="01/01/1980")] returns the TestStepValue DateOfBirth

>=

Greater than or equal,

=>SUBPARTS:XTestStepValue[(Name=="DateOfBirth")AND(Value>="12/12/1970")] returns the TestStepValue DateOfBirth

=~

an expression consisting of regular expressions follows,

=>SUBPARTS:TestCase[Name=~"^Automobile"] returns the TestCases Automobile and Automobile 1, ^ marks the beginning of a word

=i~

an expression consisting of regular expressions follows, case insensitive

=?

is the right part contained in the left,

=>SUBPARTS:TestCase[Name=?"Automobile"] returns the TestCases Automobile, Automobile 1, and 1 Automobile

=i?

is the right part contained in the left, case insensitive

!?

is the right part not contained in the left,

=>SUBPARTS:TestCase[Name!?"Automobile"] returns Truck and Motorcycle

!i?

is the right part not contained in the left, case insensitive

Logical operators

AND

And-link of two elements,

=>SUBPARTS:TestCase[(Name=="Automobile")AND(Name=="Truck")] returns no result

OR

Or-link of two elements,

=>SUBPARTS:TestCase[(Name=="Automobile")OR(Name=="Truck")] returns the TestCases Automobile and Truck

Mathematical operators

+ , - , * , :

Addition, subtraction, multiplication and division

Other terminal symbols

DIGITS

Any integer series of numbers

TEXT

Any series of letters, mostly element names, type descriptions and the like

SUBPARTS

All child elements of the current element

SUPERPART

All parent elements of the current element

AllReferences

Child elements and their links of the current elements,

->AllReferences

RETURN

The search function returns the elements of the level, which is preceded by RETURN

NOT

Negation,

=>SUBPARTS:TestCase[NOT(Name=="Automobile")AND(Name=="Truck")] returns all TestCases

Functions

Count("assocname")

provides the number of associated elements of the given type,

=>SUBPARTS:TestCase[Count("Items")==0] returns all TestCases which are not linked to any TestSteps and TestCase folders: Automobile 1, 1 Automobile, Truck, and Motorcycle

SELF

returns itself as the object

EVALCP("tcp")

returns the value of a test configuration parameter.

=>SUBPARTS:TestCase[EVALCP("Browser") == "InternetExplorer"] returns all TestCases containing the test configuration parameter Browser with the value InternetExplorer.

OBJECTS(„id“{,“id“})

objects are determined by their UniqueID and/or NodePathName,

->OBJECTS("-84917") returns the object with the specified UniqueID

PROJECT

this function returns the project object independent from the starting point of the query,

->PROJECT returns the project root element

UNION(query{,query})

determines the set union

INTERSECTION(query{,
query})

determines the intersection

COMPLEMENT(query{,query})

determines the complementary sum

SORT(query, “condition“)

sorts the query according to criteria (see chapter "Save queries to virtual folders"),

->Sort(=>Subparts:TestCase, "Name") returns all TestCases in ascending alphabetical order (A-Z). Use "+ condition" or "- condition" to specify an ascending (+) or descending (-) sort order.

SUBSET

provides the range of amount specified in curly brackets. It is possible to either specify an index for a search up to a particular object, or to specify a certain area to be searched.

Syntax:<Arrow Operator>Subset(<query>, <Index>, <Range>)The range can optionally be specified.

->SUBSET(=>SUBPARTS:TestCase, 3) returns the first three TestCases in the TestCase folder TestCases: Automobile, Automobile 1 and 1 Automobile,

->SUBSET(=>SUBPARTS:TestCase, 3, 2) returns 1 Automobile and Truck

When date and time formats should be compared, they must be specified with quotation marks. If operators contain greater than or smaller than signs (<, >, <=, >=), only date, time or number formats can be compared. If strings are compared, and if both strings can be converted into floating-point numbers, a DOUBLE comparison will be performed and the above mentioned operators can be used.

Using floating-point numbers in the TQL search

Searches for properties with floating-point numbers, which use the data type DOUBLE, a dot has to be used instead of a comma (e.g. relative weighting in per cent - requirements). The value can only be found using the relational operators < or >.

Syntax:

<relational operator><number.number>