Extract Dynamic Text in TOSCA

How to Extract Dynamic Text in TOSCA Using XB {XB[ParameterName]}

Table of Contents

Introduction

Dynamic content is one of the biggest challenges when it comes to automated testing. When you’re working with tools like Tricentis TOSCA, which emphasize model-based testing, handling dynamic text values that change across sessions becomes crucial. A frequent use case arises where a confirmation message or receipt text includes variable data like transaction amounts, timestamps, or user-specific messages.

This blog post will walk you through exactly how to extract dynamic text in TOSCA using XB {XB[ParameterName]}, and configure your modules so TOSCA reliably recognizes and verifies ever-changing screen content.

Whether you’re preparing for a TOSCA Certification Course, just starting out with TOSCA Online Training for Beginners, or looking to master practical automation strategies from a TOSCA Tutorial, this guide covers everything you need.

What is Dynamic Text in TOSCA?

Dynamic text refers to screen content that changes between executions. For example, a success message might say:

“Purchase completed! We charged the total amount of $1284.1 to your credit card!”

Here, the dollar amount is a dynamic value. This poses a problem because if you scan this as a static text field and use the InnerText property, TOSCA may not be able to identify it during the next run. The amount may change, making the previously scanned value obsolete.

Thus, to Extract Dynamic Text in TOSCA, we use dynamic placeholders like XB[ParameterName] to capture and reuse variable values.

Understanding the Use of InnerText and Why to Uncheck It

When scanning elements using TOSCA’s module wizard, the property InnerText is often selected by default. This works fine for static messages. But in scenarios with dynamic text, such as financial confirmations, the content keeps changing.

Example from Tricentis Obstacle Course

In the page at Obstacle Course – ID 81012, the confirmation reads:

Purchase completed! We charged the total amount of $1284.1 to your credit card!”

If InnerText is selected, TOSCA expects this exact sentence in every test run, which leads to failure when the amount changes.

Solution:

  • Uncheck the InnerText property after scanning the text field.
  • Instead, use the InterText property to validate and extract the changing portion.

This small change is key to Extract Dynamic Text in TOSCA reliably.

How to Extract Dynamic Text in TOSCA: Step-by-Step

Step 1: Scan the Success Message Element

Use the TOSCA Scan feature to capture the success message after a simulated purchase.

Step 2: Modify Properties

In the module view:

  • Uncheck the property InnerText.
  • Check the InterText property if available or add it manually.

This allows TOSCA to read the text content without enforcing exact static values.

Step 3: Parameterize with XB

Now, in your test case:

.InnerText == *We charged the total amount of {XB[Amount]} to your credit card!*

Here’s what happens:

  • TOSCA captures the amount dynamically into the {XB[Amount]} variable.
  • This allows you to Extract Dynamic Text in TOSCA and use it for further steps (e.g., logging or comparing with expected values).
Extract Dynamic Text in TOSCA
Extract Dynamic Text in TOSCA

Step 4: Use Captured Value

You can now reuse {XB[Amount]} in later steps:

  • For validation
  • For log comparison
  • For conditional decisions in your test flow

Visual Reference from Test Setup

From the screenshot, we can observe:

  1. Success Message node configured with XB[Amount]

A value verification step for:

…total amount of {XB[Amount]} to your credit card!

This setup allows testers to Extract Dynamic Text in TOSCA and ensure the test case remains stable across changing values.

Logging Dynamic Values Using the Log Viewer

Tricentis provides extensive support for logging during execution, as documented here.

When you Extract Dynamic Text in TOSCA using XB parameters, the log captures those values clearly. This is helpful for:

  • Debugging
  • Auditing automation results
  • Verifying captured dynamic data

Key Features of the TOSCA Log Viewer:

  • View test step outcomes
  • See XB parameter values (like {XB[Amount]})
  • Trace dynamic data flow throughout execution
  • Identify failures caused by missing or mismatched dynamic text

You can even export logs for team review or compliance records.

Why Not Use Static Verification?

Let’s explore a scenario:

Hardcoded Approach (Incorrect):

.InnerText == Purchase completed! We charged the total amount of $1284.1 to your credit card!

This will work only once and fail when the amount changes.

Dynamic Approach (Correct):

.InnerText == *We charged the total amount of {XB[Amount]} to your credit card!*

The asterisk * is used for pattern matching, and {XB[Amount]} dynamically captures the number.

This dynamic strategy ensures that TOSCA can handle live, changing data on real-world applications.

Common Use Cases for Extracting Dynamic Text

  1. E-Commerce Platforms
    • Capture transaction amounts
    • Extract dynamic order numbers
    • Log shipping confirmation messages
  2. Banking Applications
    • Capture balances or transfer confirmations
    • Validate dynamic interest rates or values
  3. Healthcare Systems
    • Capture dynamically generated patient IDs
    • Extract appointment confirmation details

By using the XB parameter model, you ensure reusability and stability in your test automation.

How to Reuse Extracted Values

Once you Extract Dynamic Text in TOSCA, you can reuse it:

As input in later steps

Input field = {XB[Amount]}
In conditional checks

If {XB[Amount]} > 1000 → Apply discount logic
For logging or reporting

Log: Transaction amount captured: {XB[Amount]}

This is a key benefit of mastering how to Extract Dynamic Text in TOSCA.

Troubleshooting Dynamic Text Extraction

IssueCauseSolution
Text not capturedInnerText selectedUncheck InnerText, use InterText
Value not reusableVariable not definedDefine XB[ParameterName] properly
Pattern mismatchNo wildcards usedAdd * for pattern flexibility

Ensure your module and test case are both configured with dynamic intent, not hard-coded assumptions.

Best Practices for Extracting Dynamic Text in TOSCA

  • Always check for dynamically generated values during scan.
  • Use * for wildcard pattern matching.
  • Parameterize everything using XB[].
  • Document what each parameter captures.
  • Use Log Viewer to confirm your dynamic values are stored correctly.
  • Avoid overreliance on InnerText.

Mastering these practices to Extract Dynamic Text in TOSCA will elevate your TOSCA test design from brittle to robust.

Real-World Example Recap

Let’s revisit the example:

Success Message: 

.InnerText == *We charged the total amount of {XB[Amount]} to your credit card!*

This approach ensures:

  • Stability across test runs
  • Dynamic value capture
  • Reusability in other test steps

This is how you Extract Dynamic Text in TOSCA effectively and professionally.

Summary

Dynamic content is common in real-world applications. TOSCA gives testers the power to capture and work with these changing values if configured correctly. By disabling the InnerText property and enabling parameterized InterText matching with XB[], your test cases become smarter, more flexible, and future-proof. These skills are foundational in any TOSCA Certification Course, especially when mastering advanced scenarios in a TOSCA Online Training For Beginners or hands-on TOSCA Tutorial.

This guide demonstrated:

  • Why dynamic text extraction matters
  • How to configure your TOSCA modules correctly
  • The role of XB[ParameterName] for reusable values
  • How logging with the TOSCA Log Viewer provides transparency
  • Practical examples and best practices

You now have a full toolkit to Extract Dynamic Text in TOSCA confidently and effectively in your automation projects.

Start applying the XB dynamic extraction model in your next TOSCA project and transform the way you handle dynamic content.

Leave a Reply

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

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

Share this article
Enroll Free demo class
Enroll IT Courses

Need a Free Demo Class?
Join H2K Infosys IT Online Training
Subscribe
By pressing the Subscribe button, you confirm that you have read our Privacy Policy.

Join Free Demo Class

Let's have a chat