https://www.qatechies.com

Working With Tosca TBox File and Numeric Operations Modules

Concept

Tricentis Tosca : Working With Tosca TBox File and Numeric Operations Modules (TBox Image Compare, TBox File Existence, TBox File Compare, TBox Copy File, TBox Delete File, TBox Read/Create File, TBox  Numeric Operation)


Welcome to this Post – “Working with Tosca TBox File and Numeric Operations Modules “. This post discusses about the Tosca TBox modules like TBox Image Compare, TBox File Existence, TBox File Compare, TBox Copy File, TBox Delete File, TBox Read/Create File, TBox  Numeric Operation, their available modules attributes and their implementation.

This discussion will also focus on some frequently asked Tosca TBox File and Numeric Operations Modules related interview questions on these modules. The complete post is divided into small sections, discussing the concepts first and then focusing on the implementation . So, go ahead and enjoy reading…

Heads Up!

”      Before we start discussing the usage and implementation of Tosca TBox File and Numeric Operations 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 File and Numeric Operations Modules

Abstract:

The post discusses the file operations and numeric operations modules which form the crucial part of the test suite. Whether there is a requirement of fetching data from external file, or saving the data that can be used for later test cases to refer and work with other modules of the application, file operations can solve most of your problem. And the numeric operation modules support the numeric operation which can have decimal places included. This support is provided so that wherever the calculation is required for say in terms of currency, tester can easily work with it.

 

Discussion:

Usually test automation architect try to make data driven or keyword driven framework but in Tosca Data driven framework or keyword driven frameworks are implemented in a completely different fashion. Since a tester cannot code or made changes directly to the provided module in Tosca, the dependency on available modules increases and hence the framework might not look like framework itself, instead it looks more like a single line of modules included in test cases.

Well! testers can, for sure, use these modules which can help them in solving part of their framework creation, which is working with the local files and images.

Let’s see one by one and understand their module attributes and their usage.

 

File Operations

The usual file creation, modification, deletion, existence check, and comparison are supported by the modules of this TBox File Operations folder.

A tester can check the availability of these modules in the standard subset.

The File Operations folder has the following 6 Modules:

  1. TBox Image Compare
  2. TBox File Existence
  3. TBox File Compare
  4. TBox Copy File
  5. TBox Delete File
  6. TBox Read/Create File

TBox Image Compare

The TBox Image Compare module enables tester to verify pixel-accurate images. These image files can be of following formats: BMP, JPG, and GIF.

 

tosca-tbox-image-compare-module
tosca-tbox-image-compare-module

The TBox Image Compare have following module attributes:

Module Attribute Description
FirstImageFilePath Specify the Path and file name of the first image file.
SecondImageFile Specify the Path and file name of the second image file.

 

 

Point to Note here:

Always the second file is used for comparison with the first one and not vice-versa. Hence choose the file wisely.

 

Example: shows how to compare 2 different images of same file format using Image Compare module.

tosca-tbox-image-compare-example1
tosca-tbox-image-compare-example1

 


TBox File Existence

The TBox File Existence Module enables testers to verify whether a file exists in a specific directory location or not.

tosca-tbox-file-existence-operation-module
tosca-tbox-file-existence-operation-module

The TBox File Existence Module has following module attributes:

ModuleAttribute Description
Directory Specify the Path to the file to be verified.
File  

Specify the name of the file to be checked for existence.

 

Point to Note here:

Always remember in case you want o go for negation i.e. file does not exists then use exclamation mark in front of the file name.

 

Example 1: show How to verify the file’s existence in the directory using the File Existence module.

This example verifies whether the file file.jpg exists in the directory C:\.

 

tosca-tbox-file-existence-operation-example1
tosca-tbox-file-existence-operation-example1

 

 

 


TBox File Compare

This TBox File Compare module allows you to compare the content of two files. The test result is shown in the details view of the ExecutionEntry, in the Loginfo column.

 

tosca-tbox-file-compare-operation-module
tosca-tbox-file-compare-operation-module

The Module TBox File Compare contains the following ModuleAttributes:

ModuleAttribute Description
FirstFilePath Specify the Path and file name of the first file.
SecondFilePath Specify the Path and file name of the second file.

 

 

Example- shows How to compare to files using the TBox File Compare module.

The example below compares the files file.txt and file2.txt with each other.

tosca-tbox-file-compare-operation-example1
tosca-tbox-file-compare-operation-example1

 


TBox Copy File

If the automation framework copies the results to new folder for future analysis, then in that case use this TBox Copy File Module to copy files to new destination folder.

 

tosca-tbox-copy-file-operation-module
tosca-tbox-copy-file-operation-module

 

The TBox Copy File Module has the following module attributes:

ModuleAttribute Description
Source Specify the Path and file name of the file to be copied.
Target Directory Specify the directory to which the file should be copied.
Target Filename Specify the new file name if rename is required.
Overwrite Set this value to True if target file needs to be overwritten.

 

Point to Note here:

The destination folder must exist.

By default, destination files are not overwritten.

 

Example 1- shows How to copy any file to desired location with same name.

Example 2 shows How to copy any file to desired location with different name.

tosca-tbox-copy-file-operation-example1_2
tosca-tbox-copy-file-operation-example1_2

 


TBox Delete File

Usually post execution cleanup modules are called to clear up the spaces utilized by the framework during run or execution. These locations or folders can be local or network.

Depending on the framework requirements, these folders can be deleted using the TBox Delete File Module which removes a file from a specific directory.

 

tosca-tbox-delete-file-operation-module
tosca-tbox-delete-file-operation-module

 

The TBox Delete File Module has the following module attributes:

ModuleAttribute Description
Directory Specify the Path to the directory which includes the file to be deleted.
File Specify the Name of the file to be deleted.

 

Example- shows How to delete any file from the directory using TBox Delete module 

tosca-tbox-delete-file-operation-example1
tosca-tbox-delete-file-operation-example1

 

 


TBox Read/Create File

The most important and frequently used module is TBox Read/Create File. This module enables testers to either read or create text files.

 

tosca-tbox-read-create-operation-module
tosca-tbox-read-create-operation-module

The TBox Read/Create File Module contains the following module attributes:

 

ModuleAttribute Description
Directory Specify the Path of the file to be read or created.
File Specify the Name of the file, including the file extension.
Text Specify the Text to be verified, buffered or written to the file or waited on.
Encoding This is optional attribute. Specify the .NET character encoding of the file to be created for example: UTF-8
Overwrite Specify the value to be True for the target file should be overwritten else vice-versa.

 

Point to Note here:

ActionMode Verify, Buffer, Input or WaitOn can be used with Text module attribute.

 

Example 1– How to create file using TBox Create File module

Example 2– How to read file contents and store into the buffer using TBox Create File module

Example 3– How to verify the contents or text in the file using TBox Create File module

 

tosca-tbox-read-create-operation-example1_2_3
tosca-tbox-read-create-operation-example1_2_3

 


Numeric Operations

The numeric operation’s is primarily focused on converting the decimal values from one for culture to another. This is useful in case there is a requirement for converting the values for currency which uses comma as a separator to the currency which uses only dots to specify the same.

The another scenario can be with respect to formats defined by tosca for instance converting from ToscaFormat to mathematical format i.e. MathFormat.

 

The folder Numeric Operations contains the TBox Convert Decimal module.

 

TBox Convert Decimal module

The TBox Convert Decimal module can be used to convert decimals of a specific format into another format or culture.

tosca-tbox-numeric-operations-module
tosca-tbox-numeric-operations-module

The TBox Convert Decimal Module has the following module attributes:

ModuleAttribute Description
InputValue Specify the structural attribute.
Value Specify the input value to be converted.
DecimalFormat Specify the format of the input value
ConvertedValue Specify the structural attribute.
Value Specify the output value to be converted.
DecimalFormat Specify the format of the output value.

 

Point to Note here:

This applies to culture names supported by Microsoft such as de, en, the Tosca numerical format ToscaFormat, the format of the test object TargetFormat and the calculations format MathFormat.

Please note that thousands separators are ignored upon conversion.

 

Example 1– Shows How to convert the French decimal value to English decimal value format using Convert decimal module.

The example below illustrates how the French decimals format is converted into the English format.

 

Example 2- Shows How to convert the Tosca decimal value to Math decimal value format using Convert decimal module.

The Tosca format specified in the Settings dialog is converted into the Math format.

tosca-tbox-numeric-operations-example1_2
tosca-tbox-numeric-operations-example1_2

** You can also do vice-versa in case you want to show value in the log as currency in the form of ‘de’,’fr’ etc.

 


Conclusion:

Well! all these TBox File and numeric Operations 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 xmodule in Tosca?

 

Few questions for you to cogitate on analyzing the problem statement and try arriving at the solution:

  1. Can tester use the TBox create file module across the test suite?
  2. Can tester refer the created file reference value directly across the full test suite?If yes then How?
  3. Can TBox Convert Decimal be used for 16 digits currency values?
  4. How frequent should a tester use the TBox File Compare module?
  5. Can you build your own custom xmodule on top of the default functionality given by TBox delete or copy file module?  If yes then how?

 

Well, this brings me to the end of the discussion “Working with Tosca TBox File and Numeric operations modules ” where we have discussed some concepts as well as their implementation.

 

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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

advanced-floating-content-close-btn
https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5034726663464946 (adsbygoogle = window.adsbygoogle || []).push({});
advanced-floating-content-close-btn 
*************************** Do you want to learn TOSCA? Do you want to excel in Career? Try my New Courses: 1. Tricentis Tosca and Working with Excel   2. Tricentis Tosca and UI Automation Great News!!   Price has been slashed down for limited period of time.So Hurry!!! Click The Shown Links and Enjoy Learning. ***************************
 
error: Content is protected !!