0% found this document useful (0 votes)
117 views26 pages

Tosca Framework

Tosca is a scriptless automation tool by Tricentis that supports various types of testing including UI, API, and performance testing, and integrates with CI/CD tools. The document provides a comprehensive guide on downloading, installing, and navigating Tosca, as well as creating workspaces, test cases, and utilizing features like data-driven testing and model-based test automation. It also covers advanced topics such as conditional execution, libraries, and business parameters for enhanced test automation efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views26 pages

Tosca Framework

Tosca is a scriptless automation tool by Tricentis that supports various types of testing including UI, API, and performance testing, and integrates with CI/CD tools. The document provides a comprehensive guide on downloading, installing, and navigating Tosca, as well as creating workspaces, test cases, and utilizing features like data-driven testing and model-based test automation. It also covers advanced topics such as conditional execution, libraries, and business parameters for enhanced test automation efficiency.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Tosca Framework

Introduction to Tosca Framework

1. Introduction

Tosca is a scriptless automation tool developed by Tricentis that supports:


✅ UI Testing (Web, Desktop, SAP)
✅ API Testing (REST, SOAP, GraphQL)
✅ Mobile Testing (Android & iOS)
✅ Performance Testing
✅ CI/CD Integration (Jenkins, Azure, GitHub)

2. Download and Install Tricentis Tosca 16.0

2.1 System Requirements

✅ Windows 10/11 (64-bit)


✅. NET Framework 4.8
✅ Minimum 8GB RAM (16GB recommended)
✅ SQL Server (for team collaboration)

2.2 Steps to Install

1. Download Tosca from the Tricentis website (Requires login).


2. Run the Tosca Installer and select components:

 Tosca Commander (Main interface for test automation)


 Tosca Execution (Test runner)
 Tosca License Server (For licensing)

3.Choose installation directory and complete the installation.


4. Launch Tosca Commander and activate the license.

3. Navigate Tosca 16.0 & Steer the Navigation

3.1 Tosca Commander Interface

After launching Tosca, you’ll see:


Project Tree – Manages test cases, modules, and test data.
TestCases Section – Where you create & organize test cases.
Modules Section – Stores UI objects scanned using XScan.
ExecutionList Section – View test execution results & logs.

3.2 How to Navigate

 Expand/Collapse Sections – Use the left navigation panel.


 Search Feature – Quickly find test cases or modules.
 Drag & Drop – Move elements between sections.

4. Create Workspace Using Tosca

A workspace is where all Tosca test cases, modules, and execution logs are stored.

4.1 Types of Workspaces

Local Workspace – Stored on your computer (for personal use).


Shared Workspace – Stored on an SQL Server/Oracle Database for team collaboration.

4.2 Steps to Create a Workspace

1.Open Tosca Commander


2.Click Create New Workspace
3.Choose Local or Shared Repository
4.Set a workspace name & path
5.Click Finish

5. Install Tosca Automation Extension for Browsers and Introduction to SUT

5.1 Why Install Browser Extensions?

Tosca needs a browser extension to identify & automate web elements in Chrome/Edge.

5.2 Steps to Install

1.Open Tosca Commander


2.Navigate to Options > Automation Extensions
3.Install Chrome/Edge Tosca Extension
4.Restart the browser

5.3 Introduction to System Under Test (SUT)

The System Under Test (SUT) is the application you want to automate.
 Examples: Web applications (e.g., Gmail, Amazon), Desktop apps, Mobile apps.
 Tosca interacts with the SUT using XScan to capture elements for automation.

🛠 Hands-on Tosca Automation - Web Application Example

🔹 Scenario: Automate Login Test for a Web Application

We will automate a Login Test Case for a demo website using Tosca.

✅ Open a web browser


✅ Enter username & password
✅ Click the login button
✅V erify the login is successful

1 Step 1: Open Tosca Commander & Create a Workspace

1.Open Tosca Commander


2.Click Create New Workspace
3.Select Local (or Shared if using a repository)
4.Name the workspace LoginAutomation
5.Click Finish

2️⃣ Step 2: Install Tosca Automation Extension for Browser

1️⃣ Open Chrome/Edge


2️⃣ Go to the Extensions Store
3️⃣ Search for Tosca Automation Extension
4️⃣ Click Install & Enable

3️⃣ Step 3: Scan the Web Page Using XScan

1.Open Tosca Commander


2.Navigate to Modules section
3.Click Scan Application → Select XScan
4.Open the login page of the demo site (e.g., https://example.com/login)
5.Scan the login form:

 Select Username Field


 Select Password Field
 Select Login Button

6️⃣ Save the scanned elements as a Module


4️⃣ Step 4: Create a Test Case

1️⃣ Go to TestCases Section


2️⃣ Click Create New Test Case
3️⃣ Drag & Drop the scanned Login Module
4️⃣ Enter Test Step Values:

 Username: testuser
 Password: Password@123
 Click Login Button

5️⃣ Step 5: Run the Test Case

1️⃣ Right-click the test case


2️⃣ Click Run
3️⃣ Tosca will open the browser, enter credentials, and click login
4️⃣ Verify the Login Successful message

1️⃣ Model-Based Test Automation & Standard Modules in Tosca

🔹 What is Model-Based Test Automation?

Model-Based Testing (MBT) is a scriptless approach where:


✅ Application UI is scanned into reusable Modules
✅ Test cases are built using drag-and-drop
✅ Maintenance is easy as changes in UI only require module updates

🔹 Standard Tosca Modules

Tosca provides built-in standard modules for:


✅ Web Testing – Click, Input Text, Select Dropdown
✅ Desktop Testing – Window Handling, Button Clicks
✅ SAP Testing – SAP GUI automation
✅ Database & API Testing – SQL Queries, API Calls

2️⃣ Introduction to XScan & Scanning SUT

XScan is Tosca’s object recognition engine that scans and identifies UI elements (like buttons, input
fields, etc.).

🔹 How to Use XScan?


1️⃣ Open Tosca Commander
2️⃣ Navigate to Modules Section
3️⃣ Click Scan Application → Select XScan
4️⃣ Open the System Under Test (SUT) (Web or Desktop App)
5️⃣ Hover over the elements to scan
6️⃣ Click Identify & Save elements into Modules

3️⃣ Identify Controls by Properties & Anchor

🔹 Property-Based Identification

 Tosca identifies controls by technical properties like:


✅ ID, Name, Class, Type, XPath, CSS Selector
 Used for static web elements that do not change frequently

🔹 Anchor-Based Identification

 Useful when elements do not have unique properties


 Uses relative positioning to find elements
 Example: If a checkbox does not have a unique ID, we can use a nearby label (anchor) to locate
it

4️⃣ Create Control Groups

Control Groups allow us to organize UI elements inside a module for better management.

🔹 Steps to Create a Control Group:

1️⃣ Go to the Module Section


2️⃣ Right-click on a scanned module
3️⃣ Select New Control Group
4️⃣ Drag & Drop similar controls under this group (e.g., Login Fields, Buttons)

💡 Example:
A login form can have a control group for:
✔ Text Fields (Username, Password)
✔ Buttons (Login, Forgot Password)

5️⃣ Test Case Automation & Structure

🛠 Creating a Test Case in Tosca


🔹 Test Case Structure

Tosca follows a 4-layer structure for test cases:


1️⃣ Business Layer – Defines the high-level functionality (e.g., Login, Checkout)
2️⃣ Test Case Layer – Includes steps that execute the test
3️⃣ Test Data Layer – Stores test data in TestSheets
4️⃣ Execution Layer – Defines test execution sequences

🔹 Steps to Create a Test Case

1️⃣ Go to TestCases Section


2️⃣ Click Create New Test Case
3️⃣ Drag & Drop the scanned Modules
4️⃣ Enter Test Step Values
5️⃣ Execute the test

🎯 Next Steps

✅ Do you want to create data-driven tests?


✅ Need help with dynamic objects in Tosca?

📌 Data-Driven Testing in Tosca

🔹 What is Data-Driven Testing (DDT)?

Data-Driven Testing (DDT) allows running the same test case multiple times with different test data
without modifying the test case structure.

✅ Reduces redundancy – No need to create multiple test cases


✅I mproves scalability – Easily add new test data
✅ Supports multiple data sources – Excel, Databases, TestSheets

1️⃣ Creating a Data-Driven Test in Tosca

Step 1: Create a Test Case

1️⃣ Open Tosca Commander


2️⃣ Go to the TestCases section
3️⃣ Click Create New Test Case
4️⃣ Drag & Drop a Module (e.g., Login Module)
Step 2: Create Test Data with TestSheets

🔹 Using TestSheets for Data Storage

1️⃣ Navigate to TestCases


2️⃣ Right-click Test Case → Click Create TestSheet
3️⃣ Add Columns (e.g., Username, Password)
4️⃣ Add Multiple Rows for different datasets

💡 Example TestSheet:

Username Password Expected Result

user1 pass123 Success

user2 pass456 Success

user3 wrongPwd Failure

Step 3: Link Test Data to Test Steps

1️⃣ Open Test Case


2️⃣ Right-click on the Test Step Values
3️⃣ Select Bind to TestSheet Column
4️⃣ Choose the corresponding column (e.g., Username → Username Column)
5️⃣ Repeat for Password and Expected Result

Step 4: Run Data-Driven Test Case

1️⃣ Right-click the Test Case


2️⃣ Click Run
3️⃣ Tosca will execute the test multiple times using the provided data

2️⃣ Using Excel as a Data Source

🔹 Steps to Integrate Excel with Tosca

1️⃣ Open Tosca Commander


2️⃣ Navigate to Modules → Standard Modules
3️⃣ Locate TBox Excel Modules
4️⃣ Use TBox Open Excel Workbook → Provide the Excel file path
5️⃣ Use TBox Read from Excel to retrieve values
6️⃣ Map Excel data to test case steps
🎯 Next Steps

✅ Would you like to include database-driven testing?


✅ Need help with conditional execution (IF-ELSE logic)?

📌 Database-Driven Testing in Tosca

🔹 What is Database-Driven Testing?

Database-Driven Testing (DBDT) allows test cases to fetch dynamic test data from a database (SQL,
Oracle, etc.) instead of static spreadsheets.

✅ Automates data retrieval – No need to manually update test data


✅ Ensures real-time validation – Test against live databases
✅ Supports multiple databases – MySQL, SQL Server, Oracle, PostgreSQL

1️⃣ Setting Up Database Connection in Tosca

Step 1: Install Database Engine (If Required)

1️⃣ Ensure you have SQL Server, Oracle, or MySQL installed


2️⃣ Create a Test Database & Table with sample login credentials

💡 Sample SQL Table (LoginDetails):

sql
CopyEdit
CREATE TABLE LoginDetails (
Username VARCHAR(50),
Password VARCHAR(50),
ExpectedResult VARCHAR(20)
);

💡 Insert Sample Data:

sql
CopyEdit
INSERT INTO LoginDetails VALUES ('user1', 'pass123', 'Success');
INSERT INTO LoginDetails VALUES ('user2', 'pass456', 'Success');
INSERT INTO LoginDetails VALUES ('user3', 'wrongPwd', 'Failure');

2️⃣ Create a Database Connection in Tosca


1️⃣ Open Tosca Commander
2️⃣ Navigate to Modules Section → Standard Modules
3️⃣ Find TBox Database Modules
4️⃣ Drag TBox DB Open Connection into a Test Case
5️⃣ Enter Connection String (Example for SQL Server):

sql
CopyEdit
Driver={SQL Server};Server=YourServerName;Database=YourDBName;Trusted_Connection=yes;

6️⃣ Click Verify Connection

3️⃣ Fetch Data from Database in Tosca

1️⃣ Drag TBox DB Query into the Test Case


2️⃣ Write an SQL Query to fetch login details:

sql
CopyEdit
SELECT Username, Password, ExpectedResult FROM LoginDetails;

3️⃣ Bind the retrieved data to Test Case steps


4️⃣ Use TBox DB Close Connection after execution

4️⃣ Conditional Execution in Tosca (IF-ELSE Logic)

Conditional execution helps automate decision-making in tests.

✅I F Condition: Run a test step only if a condition is met


✅ ELSE Condition: Perform an alternative step if condition fails

Example: Execute different steps based on login result

1️⃣ Drag TBox If Condition into the Test Case


2️⃣ Set the condition:

text
CopyEdit
If ExpectedResult = 'Success', proceed to Dashboard validation
Else, verify error message

3️⃣ Drag TBox Else Condition and define alternate actions


1️⃣ Create Test Steps Using Modules

🔹 What Are Modules in Tosca?

 Modules represent the building blocks of test automation.


 They contain controls (UI elements like text fields, buttons, checkboxes) captured using XScan.
 These modules are used to create test cases.

🔹 Steps to Create Test Steps Using Modules

1️⃣ Go to the TestCases section in Tosca.


2️⃣ Click Create New Test Case.
3️⃣ Drag & drop the Login Module (or any module) into the Test Case.
4️⃣ It will create Test Steps (e.g., Enter Username, Enter Password, Click Login).
5️⃣ Click on Test Step Values and modify them as needed.

2️⃣ Populate Test Step Values for Test Cases

🔹 What Are Test Step Values?

Test Step Values define the input data for each test step.

🔹 Example: Populate Login Test Case Values

Test Step Module Control Action Mode Test Step Value


Step 1 Username Field InputText testuser
Step 2 Password Field InputText Password@123
Step 3 Login Button Click -

Steps:
1️⃣ Select a Test Step → Click on Test Step Value field.
2️⃣ Enter values for each step (e.g., Username = testuser).
3️⃣ Save the Test Case.

3️⃣ Run Your First Automated Test

1 Right-click the Test Case.


2 Click Run.
3 Tosca will launch the application, enter credentials, and click Login.
4 View execution results in the ExecutionList.

4️⃣ Action Modes & Their Types

🔹 What Are Action Modes?


Action Modes define how Tosca interacts with an element.

🔹 Common Action Modes in Tosca

Action Mode Purpose Example


Input Enter a value in a field Username = testuser
Select Select an option from a dropdown Country = India
Verify Check if a value matches expected Page Title = "Welcome"
WaitOn Wait for an element to appear Wait for Login Button
Buffer Store a value for later use Capture Order Number

5️⃣ Action Mode: Buffer

🔹 What is Buffer in Tosca?

 Buffer stores temporary values during test execution.


 These stored values can be used in later test steps.

🔹 Example: Capturing Order Number

1️⃣ Run a test that generates an Order Number.


2️⃣ Use Action Mode = Buffer to store the order number.
3️⃣ Reuse the Order Number in a later test step.

Example in Tosca:

Test Step Module Control Action Mode Test Step Value


Step 1 Order Number Buffer OrderID
Step 2 Search Box Input {B[OrderID]}

🚀 Result: The captured order number is used in a search later!

6️⃣ Math Functions and Dynamic Expressions

🔹 What Are Math Functions?

Tosca allows basic math operations in test step values:


✅ Addition: {= 10 + 5 } → Returns 15
✅ Subtraction: {= 20 - 8 } → Returns 12
✅ Multiplication: {= 5 * 4 } → Returns 20
✅ Division: {= 100 / 5 } → Returns 20

🔹 Example: Generate a Dynamic Value


1️⃣ Create a field where the user age is calculated dynamically.
2️⃣ Use {= 2025 - 1995 } to get 30 years.
3️⃣ Store it in a buffer {B[UserAge]}.

7️⃣ Libraries & Reusable TestStep Blocks

🔹 What Are Libraries in Tosca?

Libraries allow reusing common test steps across multiple test cases.

✅ Example: A Library for Login Test


1️⃣ Create a test case LoginLibrary.
2️⃣ Add test steps for username, password, login click.
3️⃣ Save it as a Reusable TestStep Block.

🔹 How to Reuse a Library?

1.Drag & drop LoginLibrary into other test cases.


2.No need to recreate login steps every time!

8️⃣ Apply Value Range, Rescan & Module Merge

🔹 Apply Value Range

 Used for randomized testing by providing a range of values.


 Example: Generate random numbers for a field {RND[1000,9999]}.

🔹 Rescan Modules

 If the application UI changes, use Rescan to update controls.


 No need to create a new module!

🔹 Module Merge:Merges similar modules to avoid duplicates.

 Example: Merging two login modules with the same fields.

TRICENTIS Tosca Automation Advanced Full Course

1.Business Parameters in Tosca

🔹 What Are Business Parameters?

 Business Parameters externalize test data, making test cases data-driven and reusable.
 Instead of hardcoding values, Tosca allows parameterization.
 Business Parameters pass values dynamically when test cases are executed.

🔹 Example: Using Business Parameters in a Login Test


1.Go to TestCases → Create a Test Case.
2.Select the Login Module and drag it into the test case.
3.Right-click on TestCase → Create Business Parameter.
4.Name it Username and Password.
5.In the test steps, replace static values with {BP[Username]} and {BP[Password]}.
6.When executing, Tosca will prompt you to enter the values dynamically.

✅ Result: The same test case can be executed multiple times with different credentials.

2.Create and Execute Execution Lists

🔹 What Is an Execution List?

 Execution Lists group test cases for batch execution.


 Used in test planning, scheduling, and CI/CD pipelines.

🔹 Steps to Create an Execution List

1.Open Execution Section in Tosca.


2.Right-click → Create New Execution List.
3.Drag and drop Test Cases into the Execution List.
4.Click Run to execute all test cases sequentially.
5.View Results and analyze logs.

✅ Example Use Case: Run Login Tests, Checkout Tests, API Tests in a sequence.

3.Link Automated Test Cases to Requirements

🔹 Why Link Test Cases to Requirements?

 Ensures that all business requirements are tested.


 Helps in traceability and coverage analysis.

🔹 Steps to Link Test Cases to Requirements

1.Go to Requirements in Tosca.


2.Create a New Requirement (e.g., Login Functionality).
3.Drag and drop Automated Test Cases under this requirement.
4.Execute test cases and monitor requirement coverage.

✅ Result: Helps in reporting gaps where requirements are not fully tested.
4.While, If, and Do Statements in Tosca

🔹 While Loop in Tosca

 Repeats a test step until a condition is met.

✅ Example: Click “Next” until the last page is reached

text
CopyEdit
While PageTitle ≠ "Last Page"
Click Next Button

🔹 If-Else Statement

 Executes a test step based on a condition.

✅ Example: Verify login result

text
CopyEdit
If LoginMessage = "Success"
Verify Dashboard
Else
Capture Error Message

🔹 Do-While Statement

 Executes at least once and then checks a condition.

✅ Example: Retry clicking a button until it becomes enabled

text
CopyEdit
Do Click Submit
While Button ≠ "Enabled"

5️⃣ Implementing Recovery Scenarios in Tosca

🔹 What Is a Recovery Scenario?

 Handles unexpected failures (e.g., popups, application crashes).


 Ensures the test case continues execution.

🔹 Steps to Implement a Recovery Scenario


1.Open TestCases → Create a Recovery Scenario Folder.
2.Define steps to handle unexpected pop-ups or application errors.
3.Link the Recovery Scenario to Test Cases.
4.Run the test and Tosca will handle failures automatically.

✅ Example: If an unexpected popup appears, Tosca closes it and continues.

6.Implementing Cleanup Scenarios in Tosca

🔹 Why Use Cleanup Scenarios?

 Ensures consistent test execution by resetting the application state.


 Used after test failures to clean the environment.

🔹 Example Cleanup Steps

✅ For Web Applications: Close all browser sessions before starting a test.
✅ For Database Testing: Reset test data before running another test.

7.Dynamic Comparison (XBuffer)

🔹 What Is XBuffer?

 XBuffer compares dynamic values at runtime.


 Used when a value changes in each execution (e.g., Order Number).

✅ Example: Capture Order Number dynamically

text
CopyEdit
Set Buffer → {XB[OrderNumber]} = UI Value
Compare {XB[OrderNumber]} with Database Order Number

✅ Result: The test case dynamically compares values without hardcoding them.

8.Dynamic ID and Explicit Name

🔹 What Is a Dynamic ID?

 Some web elements change their ID dynamically on refresh.


 Tosca can identify elements dynamically using XPath, Attributes, and Indexing.
✅ Example: Identify dynamic login button

text
CopyEdit
//button[contains(text(), "Login")]

🔹 Explicit Name in Tosca

 Allows assigning a fixed name to elements with changing attributes.

✅ Example: Assign Explicit Name to a dynamic input field

text
CopyEdit
ExplicitName = "UserInputField"

Result: Tosca finds the element even if its ID changes.

9.Set Repetition on Folder Level & Explicit Name

🔹 What Is Folder-Level Repetition?

 Allows running all test cases in a folder multiple times.

🔹 Example: Run All Login Tests 5 Times

1.Right-click a folder → Set Repetition → Enter 5.


2.All tests in the folder will execute 5 times with different data.

✅ Use Case: Run tests for multiple users automatically.

🔟 ActionMode Constraint

🔹 What Is ActionMode Constraint?

 Used to filter, check, or ignore specific values.


 Helps in data validation and partial matching.

🔹 Example: Ignore Case While Verifying Text

text
CopyEdit
Verify PageTitle = "WELCOME"
ActionMode = Constraint (Ignores case differences)
✅ Result: Passes even if UI shows "Welcome" or "welcome".

1.1 Self-Healing Mode & Self-Heal Test Cases

🔹 What Is Self-Healing Mode?

 Tosca automatically fixes broken test cases when UI changes.


 Uses AI to detect and repair elements.

🔹 Steps to Enable Self-Healing Mode

1.Go to Options → Execution → Enable Self-Healing Mode.


2.If an element is missing, Tosca finds the closest match.
3.Tosca updates the module without manual intervention.

✅ Example: If the "Submit" button is renamed to "Send", Tosca automatically detects & fixes it.

API Testing in Tosca – Detailed Guide & Examples

This guide will cover:


✅ Introduction to API Testing in Tosca
✅ Creating and Configuring API TestCases
✅ Sending GET, POST, PUT, DELETE Requests
✅ Handling JSON and XML Responses
✅ Dynamic Data Handling (Buffers & Business Parameters)
✅ Validating API Responses
✅ Chaining API Requests
✅ Error Handling and Advanced Scenarios
1.Introduction to API Testing in Tosca

🔹 What is API Testing?

API Testing ensures that the backend services and integrations work as expected. It verifies:
✔️Functionality – API requests return correct data.
✔️Performance – API response times are acceptable.
✔️Security – API is protected against unauthorized access.

Tosca’s API Engine supports REST, SOAP, and GraphQL APIs.

🔹 Benefits of Tosca for API Testing

✔️No scripting required (Model-Based Testing).


✔️Integrates with UI Tests to enable end-to-end testing.
✔️Supports data-driven and chained API tests.

2.Creating and Configuring API Test Cases

🔹 Steps to Create an API TestCase

1.Open API Testing in Tosca.


2.Right-click API TestCases → Create a New API TestCase.
3.Import the API definition (Swagger, WSDL, OpenAPI) OR manually create requests.
4.Configure Request Headers, Body, and Authentication.
5.Add Assertions to validate responses.
6.Execute the API Test.

3.Sending GET, POST, PUT, DELETE Requests

🔹 GET Request Example (Fetch user details)

✅ URL: https://reqres.in/api/users/2
✅ Steps in Tosca:
1.Add a new GET Request in the TestCase.
2.Enter URL in the request section.
3.Click Run to fetch user details.
4.Validate the response body using Verifications.

🔹 POST Request Example (Create a new user)


✅ URL: https://reqres.in/api/users
✅ JSON Payload:

json
CopyEdit
{
"name": "John",
"job": "QA Engineer"
}

✅ Steps in Tosca:
1.Add a POST Request module.
2.Enter the API URL.
3.Set Request Headers (e.g., Content-Type: application/json).
4.Enter Request Body using JSON.
5.Execute and verify the Response Code = 201 (Created).

✅ Example of Verification

 Verify Response.StatusCode = 201


 Verify Response.Body.name = "John"

🔹 PUT Request Example (Update user details)

✅ URL: https://reqres.in/api/users/2
✅ JSON Payload:

json
CopyEdit
{
"name": "John Updated",
"job": "Senior QA Engineer"
}

✅ Steps in Tosca:
1.Create a PUT Request.
2.Enter URL and Request Body.
3.Verify the Response Code = 200 (OK).

🔹 DELETE Request Example (Delete a user)

✅ URL: https://reqres.in/api/users/2
✅ Steps in Tosca:
1.Add a DELETE Request.
2.Enter the API Endpoint.
3.Execute and verify the Response Code = 204 (No Content).
4.Handling JSON and XML Responses

🔹 JSON Response Example (For GET Request)

✅ API Response Example:

json
CopyEdit
{
"data": {
"id": 2,
"first_name": "Janet",
"last_name": "Weaver"
}
}

✅ How to Validate JSON in Tosca:

 Response.Body.data.first_name = "Janet"
 Response.Body.data.id = 2

🔹 XML Response Example

✅ API Response Example:

xml
CopyEdit
<user>
<id>2</id>
<first_name>Janet</first_name>
<last_name>Weaver</last_name>
</user>

✅ How to Validate XML in Tosca:

 Response.Body.user.first_name = "Janet"
 Response.Body.user.id = 2

5.Dynamic Data Handling (Buffers & Business Parameters)

🔹 Store API Response Data Using Buffer


1.Capture the API response data dynamically.
2.Use the Buffer feature to store it.
3.Use stored data in another test step.

✅ Example: Store User ID and Use It in Another Request


1.GET https://reqres.in/api/users/2
2.Store ID in a Buffer: {B[UserID]}
3.Use {B[UserID]} in a DELETE Request (https://reqres.in/api/users/{B[UserID]}).

🚀 Result: The DELETE Request dynamically deletes the correct user!

6.Validating API Responses

✅ Common API Validation Checks:


✔️Status Code Verification – Response.StatusCode = 200
✔️Response Time Validation – Response.Time < 1000ms
✔️Header Validation – Response.Headers.Content-Type = application/json
✔️Body Field Validation – Response.Body.name = "John"

7.Chaining API Requests

✅ Example: Creating a user → Fetching the user → Deleting the user


1.POST Create User → Store User ID
2.GET Fetch User → Verify details
3.DELETE Delete User using {B[UserID]}

🚀 Result: The test automatically creates, verifies, and deletes a user in one execution!

8.Error Handling and Advanced Scenarios

🔹 Handling API Failures

✅ If an API request fails, Tosca allows:


✔️Retrying the request (looping until success)
✔️Logging detailed failure reports
✔️Triggering alternative workflows

🔹 Advanced Scenarios
✅ API Authentication Testing (OAuth, Bearer Tokens)
✅ Load Testing APIs (By running execution lists in parallel)
✅ Validating API Security (Unauthorized requests should fail)

Tosca Reporting & Logs – Detailed Guide & Examples

This guide covers:


✅ Introduction to Tosca Reporting
✅ Tosca Commander Reports
✅ Execution Logs in Tosca
✅ Tosca TestCase Logging (Execution Reports)
✅ Tosca Reporting Integration with Jenkins & Azure DevOps
✅ Customizing Tosca Reports
✅ Best Practices for Report Analysis
1.Introduction to Tosca Reporting

🔹 Why is Reporting Important in Tosca?

✔️Helps track test execution results.


✔️Identifies failures & root causes.
✔️Generates detailed logs for debugging.
✔️Supports CI/CD integration for automatic reporting.

🔹 Types of Reports in Tosca

1.Tosca Execution Reports – Standard logs generated after test runs.


2.HTML & PDF Reports – Readable reports for stakeholders.
3.Custom Reports – Created using Tosca BI or custom scripts.
4.CI/CD Integrated Reports – Results pushed to Jenkins, Azure DevOps, etc.

2.Tosca Commander Reports

🔹 Where to Find Execution Reports?

📍 Tosca Commander → ExecutionLists → Execution Logs

✅ Types of Execution Logs:


✔️Passed Tests – ✅ Green color
✔️Failed Tests – ❌ Red color
✔️Warning/Error Tests – ⚠️Yellow color

✅ Steps to Export Reports:


1.Open Execution List.
2.Right-click on Execution Entry → Create Report.
3.Choose format: HTML, XML, JSON, or PDF.
4.Save & Share the report.

3.Execution Logs in Tosca

🔹 How to View Execution Logs?

📍 ExecutionLists → Right-click on TestCase → View Logs

✅ What’s Included in Logs?


✔️Step-by-step execution details.
✔️Input data & expected results.
✔️Error messages (if any step fails).

🔹 Debugging Failures Using Logs

1.Check the failed step in execution logs.


2.Expand the log entry to see detailed error messages.
3.Identify incorrect values, missing elements, or system failures.
4.Fix issues & re-run the test.

🚀 Result: Faster debugging & issue resolution!

4.Tosca TestCase Logging (Execution Reports)

🔹 Generating Execution Reports

1.Open Execution List.


2.Right-click on the TestCase → Create Execution Report.
3.Save the report in HTML or PDF format.

✅ Example of Execution Report Structure:

yaml
CopyEdit
TestCase Name: Login Functionality
Execution Time: 10:45 AM
Status: ❌ Failed
Error Message: "Element Not Found"
Step 1: Open Browser - ✅ Passed
Step 2: Enter Username - ✅ Passed
Step 3: Enter Password - ✅ Passed
Step 4: Click Login - ❌ Failed

🚀 Result: Clear visibility into test execution status!

5️⃣ Tosca Reporting Integration with Jenkins & Azure DevOps

🔹 Jenkins Integration for Reports

Step 1: Enable Tosca Execution in Jenkins

1.Open Jenkins → Configure Project.


2.Add a Post-Build Action → Publish HTML Report.
Step 2: Store Reports in a Directory

Modify Tosca execution command to store reports in Jenkins workspace:

batch
CopyEdit
"%TRICENTIS_HOME%\ToscaCommander.exe" /Execute /Workspace="%WORKSPACE_PATH%"
/ReportPath="C:\JenkinsReports"

Step 3: Configure Jenkins to Read Reports

1.In Jenkins Post-Build Actions, select "Publish HTML Reports".


2.Set Report Directory = C:\JenkinsReports.
3.Save & Run the Jenkins job.

🚀 Result: Test reports automatically appear in Jenkins Dashboard!

🔹 Azure DevOps Integration for Reports

Step 1: Modify Pipeline to Store Reports

Modify Azure DevOps Pipeline to store Tosca reports:

yaml
CopyEdit
steps:
- task: CmdLine@2
inputs:
script: 'C:\Program Files (x86)\Tricentis\ToscaCommander.exe /Execute /Workspace="C:\Tosca\
Workspace" /ReportPath="$(Build.ArtifactStagingDirectory)/Reports"'

Step 2: Publish Reports in Azure DevOps

Add a task to publish the generated reports:

yaml
CopyEdit
steps:
- task: PublishBuildArtifacts@1
inputs:
pathToPublish: '$(Build.ArtifactStagingDirectory)/Reports'
artifactName: 'ToscaReports'

🚀 Result: Tosca reports are stored in Azure DevOps Artifacts!


6.Customizing Tosca Reports

🔹 How to Create Custom Reports?

1.Use BI & Reporting in Tosca to design custom test execution dashboards.


2.Use Tosca Query Language (TQL) to extract specific data.
3.Export reports to Excel, Power BI, or JIRA for better tracking.

✅ Example TQL Query for Failed TestCases:

tql
CopyEdit
SELECT * FROM ExecutionLogs WHERE Status = "Failed"

🚀 Result: Get a filtered view of failed tests for quick analysis!

7.Best Practices for Report Analysis

✅ Use HTML/PDF Reports for sharing with stakeholders.


✅ Enable Detailed Logging to capture all execution steps.
✅ Integrate with CI/CD for automated test reporting.
✅ Use TQL Queries to filter reports based on test status.
✅ Schedule Reports in Jenkins/Azure DevOps for periodic insights.

You might also like