Create Tosca Test Cases with Parameters – An Excellent Learning Guide for Tosca 13.x

Tosca Test Cases - Feature Image

Tosca Tutorial – Table of Content

We have combined the entire Tosca tutorial with the below articles. You can read each of the articles by clicking on the link.

Tosca Tutorial #1: Tosca Overview

Tosca Tutorial #2: Tricentis Tosca Setup – Install, Uninstall and License Configuration

Tosca Tutorial #3: Tosca Workspace Creation

Tosca Tutorial #4: Understanding of TOSCA Commander and Tosca User Management

Tosca Tutorial #5: Tosca Scanning – An Introduction to Modules

Tosca Tutorial #6: Tosca Test Case Creation

Tosca Tutorial #7: Tosca Parameters and Library– Buffer, Business Parameter, TCP

Tosca Tutorial #8:Tosca Test Execution, Reports, and Bug management

Tosca Tutorial #9: Test Case Design – An approach to test data management 

Tosca Tutorial #10: Tosca Test Data Management.

Tosca Tutorial #11: API Testing in Tosca

Tosca Tutorial #12: Tosca Interview Questions and Answers

In this “Create Tosca Test Cases..” article, we have explained the step by step approach to develop Tosca Test cases in simple words which will help the new comers to understand easily. Also, we are going to learn about Tosca Parameters and Reusable TestStepBlock. To get the flavors of Tosca interview questions, please click here.

Create Tosca Test Cases

What is Test Case in software testing?

Test case is a set of instructions to ensure the quality of the software product. In other word, it is a combination of steps to walk-through the application with defined checkpoints. The test cases are written based on the requirements. Test cases can be designed for manual or automated testing. In this Tosca Test Case Creation article, we are going to discuss about Test Cases that are automated by Tosca. The Tosca Test Cases are created by using the both standard and user defined modules with required test data and verification points.

Tosca Test Case Classification: Two types of test cases are available in Tosca. Those are –

  • Technical Test Cases
  • Business Test Case

Technical Test Cases

Technical Test Case:

This are the actual test cases in Tosca which keeps all the technical information to steer the controls during execution. The technical test cases can be created by right-clicking on any folder which are available in TestCase section and selecting the blue colored circular arrow icon. The short cut key for new test case creation are “Ctrl+N” and “Ctrl+T.”  

Test Step: Test steps are created by adding the modules (standard or user defined) into the test case by drag-drop or insert method. For each of the modules in test cases are treated as test step. In the left panel of any testcases is showing the test steps and in the right side, the details about step actions are shown.

In this test step details section, we need to choose/enter appropriate attribute values for ActionMode and Value to complete the Test Cases. The different ActionModes are –

Input – Mostly used while entering data, perform click operations.

Insert – It’s used for insert purpose.

Verify – Need to select this option during verification. In the value field, we need to provide the condition.

Buffer – It’s used to set the value to buffer.

Walton – It’s used for synchronization purposes to wait(predefined time) until the condition is satisfied.

Select – Used while hierarchy levels are available and need to work on child items.

Constraint – Used for checking for a particular value, mostly used in the table’s column.

Also, there is another attribute WorkState, is optionally used for displaying the status of Tosca Test Case development. Different states are –

  • PLANNING – When the Test Case development is in the planning and analysis phase.
  • IN_WORK – It shows the development is in progress.
  • COMPLETED – It shows that development is completed.

Different Operation Supported by Tosca:

  • If-Else condition – Tosca allows us to add “if-else” condition by right-clicking on Test Case and selecting the option “Create If statements…”. Under the condition section of the “If-Else” section, we need to write the verification step for the condition.
tosca test cases - ifelse statement
tosca test cases – ifelse statement (Create Tosca Test Cases)
  • Looping Statement – Tosca supports While and Do-While looping structure. Create a loop; we need to right-click on Test Case, click on the ‘…’ icon, and after that, select the required looping type.
tosca test cases - loops
tosca test cases – loops

Also, we can convert a test case folder into a loop by defining the Repetition property with a looping counter.

  • Tosca Condition – We can add a condition in the Test Case, folder, test step, reusable test step block, step attribute level by updating the condition property. The condition can be implemented based on the business parameter, TCD Parameter, constant value, etc.
tosca test cases - conditions
Conditions (Create Tosca Test Cases)

                Step-by-step Guide to Create Tosca Test Cases

Sample functional scenario: We are going to automate below test scenario with the help of Tosca –

Step1: Open sample application provided by Tricentis for learning purpose with URL http://sampleapp.tricentis.com/101/

Step2: Click on Automobile Tab to open the “Enter Vehicle Data” section.

Step3: Enter mandatory fields and click on Next and verify that the “Enter Insurant Data” section appears.

Step4: Click on the Prev button.

Step5:  Verify that the “Enter Vehicle Data” section is displayed with previously entered data.

Technical Test Case creation steps:

Step1: Open the URL manually to scan Modules for Home page, “Enter Vehicle Data” section, and “Enter Insurant Data” section with required controls. You can refer to the last article about Tosca Modules while creating modules. The modules will look like –

Create Tosca Test Cases - Step1
Create Tosca Test Cases – Step1

Step2: Create a folder structure and a new Test Case in the Test Cases section. Also, create three folders in Test Case as the best practices –

PreCondition – Open application, initial dataset related test steps are kept here.

Workflow – Application navigation, data entry, verification steps are kept here.

PostCondition – Closing of applications are kept here.

Step3: Drag & Drop the standard modules “Open Url” and provide URL in the value attribute. We can change the module names after adding it in Test Case based on the test steps.

Create Tosca Test Cases - Step3
Create Tosca Test Cases – Step3

Step4: Drag and drop the module “Tricentis Vehicle Insurance | Home” into the Test Case (Workflow folder) to click on the Automobile tab.   

Create Tosca Test Cases - Step4
Create Tosca Test Cases – Step4

Step5: Drag and drop the module “Enter Vehicle Data” into the Test Case. Enter input data and click on Next.

Create Tosca Test Cases - Step5
Create Tosca Test Cases – Step5

Step6: Drag and drop the module “Enter Insurant Data” into the Test Case to verify the availability of “First Name” and “Last Name.” After verification, you need to perform click operation on “Prev” button control.   

Create Tosca Test Cases - Step6
Create Tosca Test Cases – Step6

Step7: Again, using the module “Enter Vehicle Data,” verify that previously selected data are stored here.  

Create Tosca Test Cases - Step7
Create Tosca Test Cases – Step7

Step8: Add module to close the browser and rename all the test step modules based on the functional step.

Create Tosca Test Cases - Step8
Create Tosca Test Cases – Step8

Step9: Now execute the Test Case in the scratch book (Right-click on Test Case and click on Run in Scratch book) to check the correctness of the Test Case. By default, execution will start in browser Internet Explorer. The log will be generated. If we want to execute from Chrome, we need to add TCP Browser with value as “Chrome.”

Business Test Case

The business test cases are the logical groups of technical test cases. Each of the business test case represents the functionality coverage which is designed based on the requirements. The business test cases are not executable. Only, we can monitor the testing coverage through this.

Steps to create business Test Cases –

Step1: Create a folder structure and a new Test Case in the Test Cases section.

Step2: The business test cases can be created by right-clicking on any folder, available in TestCase section and choosing the orange colored circular arrow icon. Also, business test case can be created by clicking on short cut keys “Ctrl+N” and “Ctrl+B.”  

Step3: Drag and drop selected technical Test Cases into this business Test Case.

Business Test Case
Business Test Case(Create Tosca Test Cases)

Tosca Parameters and Library

In the last example, we have provided the test data directly in the Test Cases as a hardcoded value. The main disadvantage of this approach is whenever we need to change the data; we need to update the Test Case. Also, the common test step block, such as log in with different credential, can not be reused. So, to bypass this, we need to go for parameterization.

Parameterization is a methodology to avoid use of hard coded data to make the test case dynamic and test data driven. Tosca allows many ways to perform parameterization. The important approaches are Buffer, Test Configuration Parameter (TCP), Business Parameter, TCD, TCP, etc. We will explain the buffer and test configuration parameter (TCP) in this article.

Buffer – We can say the buffer is a special kind of variable in Tosca to store run time values. Only difference is that the buffer keeps the value after the execution over. The scope of buffer is restricted to the local workspace only as the buffere value can not be updated to shared repository. There is different standard modules are available in Tosca to work with buffers. The important modules are –

  • TBox Set Buffer – This module is used to create the buffer as per the name provided in the attribute section. The value provided in the attribute’s value section will be stored in the buffer. We can create more than one bufferers using this module.
  • TBox Name To Buffer – This module is used to store the Test Case name into the buffer for which name is provided in the attribute value field. We need to execute the Test Case from the execution list to store the Test Case name. Otherwise, it will store as “Scratch book.”
  • TBox Delete Buffer – It’s used to delete the existing buffers. The buffer name should be mentioned in the attribute’s value section.
  • TBox Partial Buffer – This module is used to extract or verify the partial text of a buffer. 
Tosca Parameters - Buffer
Modules to Handle Buffers (Tosca Parameters)

The syntax of buffer to read the value is  {B[Buffer_Name]}

Buffer can be created by using ActionMode as Buffer for any test step (buffer name should be the test step value) instead of using Set Buffer module. Also, using {XB[Buffer_Name]}, buffer can be created from a verification test step dynamically.

For more details on a buffer, please refer Tricentis support portal.

Test Configuration Parameters – This is the another way to parameterize the test data. The Test Configuration Parameters(TCP) can be created in test case, folder or execution list level. If the test configuration parameters are defined in parent folder level, same parameter values can be retrieved from sub folder and all the test cases available under that parent folder. To create TCP, we need to select the “Create Test Configuration Parameter” option after right-clicking on test case or folder level. The syntax to read TCP parameter is {CP[TCP Name]}. The TCPs are visible in the Test Configuration section of every Test Case, folder, or execution list.

Ideally, we should use the test configuration parameters for the common or configuration related data which are applicable for through out the test suites. The examples of the TCP are Application path or URL, credential, environment details, reporting path, etc.

Tosca provides basic test configuration parameters that are used for test settings in the Tosca workspace. Like if we want to execute the Test Case in the Chrome browser, we need to add TCP as Browser with value Chrome.

To add TCP, right-click on Test Case and click on a small square shape with violet color (Create test configuration parameter…). Also, it can be created by pressing on “Ctrl+N, Ctrl+.”. Click here to learn more.

In the below screenshot, we have changed the previously created Test Case with TCP as a part of parameterization.

Step1: Create Test Configuration Parameters to store the test data.

Tosca Parameters - Create TCP
Tosca Parameters – Create TCP

Step2: Create buffers to store the values of TCP. This is an optional step; through this step, we try to show the usage of buffers as data parameterization.

Tosca Parameters - Set Buffers from TCP
Tosca Parameters – Set Buffers from TCP

Step3: Replacing the hardcoded test data from the test case with buffers.

Tosca Parameters - Buffer To Test Cases
Tosca Parameters – Buffer To Test Cases

Note: In this section, we have learned about the basics of parameterization. In the advanced level of Tosca, we will learn advanced parameterization techniques such as TCD, TDM, TDS, etc.

Tosca Library

The Tosca library, available in TestCase section, is a place to store the reusable components of the test cases. The each element with in the Library is known as Reusable Test Step Block.

Test Step Block – It is a grouping of test steps/ modules to perform some specific task such as login, logout, create record, etc. The test step block can be created using the Test case level folder. It helps to increase the readability and reduces the efforts for maintenance.

For an example, application launch functionality is involved with steps – invoke exe, enter user credential, and verify login. Here, we need to define a folder in a test case with a logical name as Launch Application and write three steps there.

Test Step Library – This is the place, where we can create the reusable test step block. The Library can be created with in any folder available in TestCase section. But, there is a restriction that only one library can be created with in single folder. To create the Library, we need to right-click on any folder and select the folder icon(Create TestStep Library) which have the symbol “L”. Also, we can create the library using the shortcut keys Ctrl+N, Ctrl+L.

Reusable Test Step Block – When we defined a Test Step Block within the Test Step Library section, it’s acted as Reusable Test Step Block. We can create it in two ways –

  1. New Reusable Test Step Block – Right-click on the Library folder and click on Create Reusable TestStepBlock icon(folder icon with a reusability symbol). Shortcut key for this – Ctrl+N, Ctrl+R. After the creation of the reusable block, we need to write the test steps here.
  2. Convert Existing Test Step Block – By the drag-drop method, we can convert any existing TestStepBlock into Reusable TestStepBlock.

After the creation of Reusable TestStepBlock, we can drag and drop it into any Test Case to use. In the test cases, it’s only referred to as a link instead of physical steps. It can only be modified from the Library section.

Business Parameter – It’s an approach to pass test data into the Reusable Test Step Block through the parameters. The parameters of the Reusable Test Step Block is called a Business Parameter. So, with the help of this, we can use the Reusable Test Step Block for a different set of test data. Steps to create Business Parameters –

  • Right-click on Reusable Test Step Block and click on icon [P] to create Business Parameter Container.
  • Right-click on this container, click on the blue-colored square icon to create each of the parameters.
  • Rename the Parameters based on data type and implement it in the test steps by removing the existing data.
  • Pass the data from the Test Cases through this business parameters.

Reusable Test Step Block structure with business parameters:

Tosca Parameters - Create Reusable TestStepBlock
Tosca Parameters – Create Reusable TestStepBlock

Test Case after calling the Reusable Test Step Block:

Tosca Parameters - Use of Reusable TestStepBlock
Tosca Parameters – Use of Reusable TestStepBlock

Conclusion:

In this “Create Tosca Test Cases” article of Tricentis Tosca Tutorial, we have learned about how to create Tosca Test Cases and parameters.  Please click to read the next article of TOSCA Tutorial – Understanding of Tosca Execution List and Reports.

About K Mondal

Hi, I am K. Mondal, I am associated with a leading organization. I am having 12+ years of working experience across domains e.g., application development, automation testing, IT Consultant. I am very much interested in learning different technologies. I am here to fulfill my aspiration and currently contributing as an Author and Website Developer both in LambdaGeeks.
Connect to LinkedIn- https://www.linkedin.com/in/kumaresh-mondal/

Leave a Comment

Your email address will not be published. Required fields are marked *