Working With Tosca TBox Windows Operations and Expression Evaluation Modules
August 22, 2018
Tricentis Tosca : Working With Tosca TBox Windows Operations And Expression Evaluation (TBox Take Screenshot,TBox Clipboard,TBox Send Keys,TBox Window Operation,TBox Expression Evaluation) Modules
Welcome to this Post – “Working with Tosca TBox Windows Operations And Expression Evaluation modules “. This post discusses about the Tosca TBox modules like TBox Take Screenshot, TBox Clipboard, TBox Send Keys, TBox Window Operation, TBox Expression Evaluation, their available modules attributes and their implementation.
This discussion will also focus on some frequently asked Tosca TBox Windows Operations And Expression Evaluation modules related interview questions. The complete post is divided into small sections, discussing the concepts first and then focusing on the implementation and later discuss about some frequently asked TBox interview questions. So, go ahead and enjoy reading…
Heads Up!
” Before we start discussing the usage and implementation of Tosca TBox Windows Operations And Expression Evaluation modules present in Tosca, I would recommend if you do not have in depth knowledge on TBox Architecture then please visit the link shared below so that you get an idea on how the TBox framework works when you use the inbuilt TBox modules in your test cases:
To Know more on Tosca TBox Architecture-Click Here
”
TBox Windows Operations And Expression Evaluation Modules
Abstract:
The post talks about the TBox modules which are supported by the TBox framework. These modules are mostly helpful in basic windows operations related to any application under test. These modules can help in taking screenshots, copying data or text using Clipboard, pushing or sending keyboard keys to application under test pages or UI, and doing several other operations like closing window, browser window and lastly passing expressions to be evaluated which can be dynamic in nature. All the windows operations and expression evaluation discussed can be done respectively using the following modules:
- TBox Take Screenshot
- TBox Clipboard
- TBox Send Keys
- TBox Window Operation
- TBox Expression Evaluation.
Discussion:
In this post, we will discuss two different TBox modules which are frequently used in our test cases. Now let’s focus on the concepts one by one:
Basic Windows Operations
– allows you to fulfill basic needs of your scenarios whether its copying data, taking screenshot for errors or failures, sending keys i.e. keyboard keys to the application, and closing the application.
The Basic Windows Operations folder has following four Modules:
- TBox Take Screenshot
- TBox Clipboard
- TBox Send Keys
- TBox Window Operation
TBox Take Screenshot
The module TBox take screenshot as the name suggests it takes the snaps and saves the screenshot of the currently active screen or page or window.
The module TBox Take Screenshot has following module attributes:
ModuleAttribute | Description |
Environment | The module attribute is about device in focus, i.e. which device is taking the screenshots. Specify here which device is being targeted. If no value is entered, the default is desktop.
Some possible values: empty, Desktop and Mobile |
Directory | Specify the screenshots save path, if no path is defined then default is the storage path defined in the Settings dialog. |
Filename | The module attribute defines the screenshot name without an extension. |
Example:
The below example1 shows that a new browser window was opened with url and later the screenshot is taken. The screenshot gets saved at the specified location. On the other hand, example2 shows that image is saved at the specified location in the scratchbook.
TBox Clipboard
The TBox Clipboard module enables testers to copy a text to the windows clipboard as well as verify or buffer.
The TBox Clipboard module has following module attribute:
ModuleAttribute | Description |
Value | Specify the data or text in the value attribute which needs to be verified, buffered or copied to the clipboard. |
Example:
The below example shows the data has been copied to clipboard and later is being verified using same module. Also check the results of scratchbook.
TBox Send Keys
The TBox Send Keys module sends the keyboard commands to any opened window or screen or web page.
Any texts, special characters or key combinations using Ctrl, Alt and Shift can be used as values.
The Module has only two module attributes:
ModuleAttribute | Description |
Caption | This is optional attribute. The caption of the window or page or screen to be steered is entered here. |
Keys | This module attribute specifies the value to be used for steering. |
Point to Note here:
Always put keyboard commands in curly brackets between inverted commas.
Below are the command codes corresponding to the keys shown in the below table.
Key | Code |
BACKSPACE | {BACKSPACE}, {BS}, or {BKSP} |
BREAK | {BREAK} |
CAPS LOCK | {CAPSLOCK} |
DEL or DELETE | {DELETE} or {DEL} |
DOWN ARROW | {DOWN} |
END | {END} |
ENTER | {ENTER}or ~ |
ESC | {ESC} |
HELP | {HELP} |
HOME | {HOME} |
INS or INSERT | {INSERT} or {INS} |
LEFT ARROW | {LEFT} |
NUM LOCK | {NUMLOCK} |
PAGE DOWN | {PGDN} |
PAGE UP | {PGUP} |
PRINT SCREEN | {PRTSC} (reserved for future use) |
RIGHT ARROW | {RIGHT} |
SCROLL LOCK | {SCROLLLOCK} |
TAB | {TAB} |
UP ARROW | {UP} |
F1 | {F1} |
F2 | {F2} |
F3 | {F3} |
F4 | {F4} |
F5 | {F5} |
F6 | {F6} |
F7 | {F7} |
F8 | {F8} |
F9 | {F9} |
F10 | {F10} |
F11 | {F11} |
F12 | {F12} |
F13 | {F13} |
F14 | {F14} |
F15 | {F15} |
F16 | {F16} |
Keypad add | {ADD} |
Keypad subtract | {SUBTRACT} |
Keypad multiply | {MULTIPLY} |
Keypad divide | {DIVIDE} |
To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes.
Key | Code |
SHIFT | + |
CTRL | ^ |
ALT | % |
For more on usage please follow https://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx
If you want to use the different combinations in Tosca TBox send keys module, then follow the below guide,
Key Combination | Value to be entered in Send keys as teststepvalue |
Ctrl + A | ^(a) |
Del | “{DEL}” |
Ctrl + S | ^(s) |
Alt + F4 | %”{F4}” |
Example:
The below example shows how we can close the IE browser window using send keys module.
TBox Window Operation
The TBox Window Operation Module can be used to send specific commands to a window relating to intended operation.
The Module TBox Window Operation has following module attributes:
ModuleAttribute | Description |
Caption | The caption of the window or page or screen to be steered is entered here. |
Operation | Specify the command to be used for steering the control. |
Below are the following commands which are supported:
Command | Description |
Bring To Front | This option puts the selected window to the foreground. |
Close | This option closes the selected window. |
Maximize | This option maximizes the selected window. |
Minimize | This option minimizes the selected window. |
Normal | This option restores to original size of the selected window. |
Verify Window Exists | This option invokes the system to verify if a specific window is open. |
Wait On Close | This option makes the system wait for a specific period until a window is closed. |
Wait On Open | This option makes the system wait for a specific period until a window is opened. |
Example:
The below example shows how the browser window having a caption of “demowebshop” is closed using the module TBox window operation and via selecting the option of “Close”.
Expression Evaluation
Now we will focus on simple but most crucial module of TBox which is TBox Expression evaluation. This module is used with various other modules like loops, while etc. to bring the iteration at halt post the condition is validated. This module can also be used with simple if-else structure within your test cases. Plus, dynamic expression can also be used here coupled with buffer values or x-buffer values which needs to be evaluated.
The Expression Evaluation folder has following Module:
TBox Evaluation Tool
This TBox Evaluation tool or Module compares or validates the conditions. And post comparison the output is always in boolean form which is either True or False.
The TBox Evaluation tool Module has the following module attribute:
ModuleAttribute | Description |
Expression | This module attribute is used to define dynamic expressions.
We can also specify more than one expression within a TestStep. |
Point to note here:
- We need to specify string in single quotes as for example ‘my text’.
- We can have more than one expression within the teststep to be evaluated.
Example:
In this example, there is a buffer named val2 holding value 56.
In expression 1 numeric comparison is done to check 100>200 or not.
In expression 2, the buffer value is compared with 100 as whether it is greater than 100 or not.
In expression 3, comparison of two strings is done whether they are unequal or not.
Conclusion:
Well! all these TBox Window Operations and expression evaluation modules are pretty decent in working and helps in achieving the goals pretty fast. Still if you feel some other functionality would have been provided and could have helped you in solving your problem, then I would recommend that you follow below post to create your own TBox XModule and extend the functionality the way you want,
Follow Here ==> How to create your own custom control in Tosca?
Before concluding let’s bring up some interview questions on them which have already been covered as an answer in the discussion:
- Can Tosca take screenshots during test execution via TestMandate lists?
- Is it possible for Tosca to work on multiple dynamic expression at once?
- Can Tosca TBox module validate whether window with some specified caption exists?
- If you have video player which requires you to click and play the video; without using manual click how will you solve it?
- Can TBox window operation module close many windows at once?
- What all operations can be done via TBox window operation module, can you name few?
Few more questions for you to cogitate on analyzing the problem statement and try arriving at the solution:
- Can tester use the TBox window operation module across the test suite?
- With the scope of test suite, can tester refer the Buffer value directly and use it in expression evaluation module?
- Does many combinations of keys work in TBox send keys module? For instance save and close one after the other.
- How frequent should tester use the TBox Windows Operations & Expression Evaluation modules?
- What is the performance impact of these module? How can you eradicate the issue?
- Can expression evaluation modules evaluate the dynamic expressions containing alphanumeric values?
Well, this brings me to the end of the discussion “Working with Tosca TBox Windows Operations & Expression Evaluation modules ” where we have discussed some concepts as well as some interview questions.
I really hope you enjoyed reading the post. If you have any doubt on this please feel free to add your comment below.
And if you like to read more on TOSCA Interview Questions please follow below links:
Tosca Interview Questions – Part 1
Tosca Interview Questions – Part 2
Tosca Interview Questions – Part 3
Tosca Interview Questions – Part 4
If you would like to keep track of further articles on TOSCA, I recommend you to SUBSCRIBE by Email and have new articles sent directly to your inbox.