Automation testing is no longer an option in this high paced software world. Businesses depend on rapid, accurate and repeatable testing for their software quality. Leading test automation tool Tricentis TOSCA changed the game for organizations and testing. Its most potent feature would probably be ability to generate dynamic data with TOSCA’s expressions.
Dynamic data provides flexible test scripts that can adjust to different input values without manual action. Testers who are getting ready to take Tricentis TOSCA AS1 Certification exam, they should master or have a good understanding of Dynamic Data Creation. It not only simplifies the design of test cases, but also cuts maintenance of code and improves the efficiency in testing.
In this post we will go deep into the subject of how to manipulate data dynamically in TOSCA with expressions; through a case that will give us an excellent guide on learning, as well as give us great tips for real cases.
Introduction to TOSCA and Dynamic Data
Tricentis TOSCA is an enterprise-level test automation tool that is used for small business and large corporations to manual, automated, end-to-end, user acceptance and regression testing. Its model-based technology enables testers to build reusable components, ensuring that automation is both effective and scalable.
Dynamic data with TOSCA means the creation of variables at runtime. By creating expressions which generate data automatically we eliminate the need for hard coding values from tests. This pattern is well suited in cases where you need simply arbitrary, or sequential, or context-specific values like that:
Creating different email addresses for user registration testing
Generate random numerical or alphanumeric codes
Date fields with a dynamic or calculated value
Using dynamic data, testers can cut down on manual effort, enhance coverage and reduce instances of test failures because of endless data conflicts.
What Are TOSCA Expressions?
TOSCA expressions are technically formulas or instructions on how to generate a value dynamically at runtime. You can use functions, arithmetic expressions and the built-in TOSCA modules to generate test data that satisfies certain requirements.
Key points about TOSCA expressions:
They are introduced in the TOSCA Commander via the Buffer or Test Case Design features.
Expressions can be elementary, such as a uniform number, or complex and involving multiple functions.
They can then refer to other buffers or to external sources, which makes them very versatile.
Some of the TOSCA expression functions employed are:
RandomString(n) : Generates n-letter random string.
RandomNumber(min,max):Output: Generates a random number in between min and max.
CurrentDate(): Returns today’s date
AddDays (bufferName, n): Increment date in buffer by n days.
These signs are an effective way for testers to mimic real world scenario’s.
Types of Dynamic Data in TOSCA
A grasp of the categories of dynamic data in TOSCA supports testers with selecting the most appropriate way to handle their test cases. The main types include:
Random Data
We use some random data to avoid duplicates and guarantee uniqueness when testing. Some examples would be random (long) email addresses, usernames or codes.
Sequential Data
Data serial in nature is arranged according to some scheme, order or sequence. It is widely used for IDs, invoice numbers, or account numbers. With TOSCA expressions, we can also autoincrement the numbers which prevents collisions.
Conditional Data
Conditional data mutates according to the specific conditions in your test case. For instance the expression can form a region-based phone number if a user chooses a country.
Calculated Data
Computed data is generated as a result of performing mathematical or logical operations. For instance, the discount is of 10% on the total value of the order via a TOSCA expression.
How to Create Dynamic Data Using TOSCA Expressions
Creating dynamic data in TOSCA requires understanding buffers, modules, and expressions. Let’s go step by step.
Step 1: Open TOSCA Commander
Launch TOSCA Commander and open your project or create a new one. Navigate to the TestCases section where you want to add dynamic data.
Step 2: Identify Fields for Dynamic Data
Determine which fields require dynamic values. Examples include:
- Email
- Username
- Phone Number
- Invoice Number
Step 3: Use Buffers to Store Dynamic Values
Buffers are temporary storage variables in TOSCA. They can store values generated by expressions and be reused across multiple test steps.
How to create a buffer:
- Right-click on Buffers in TOSCA Commander.
- Select Create Buffer.
- Name the buffer (e.g., RandomEmail).
- Enter the expression in the Value field.
Step 4: Define TOSCA Expressions
Here are some practical examples:
Example 1: Generating a Random Email
Buffer Name: RandomEmail
Value: “user_” + RandomString(5) + “@example.com”
This expression creates a unique email like [email protected].
Example 2: Generating a Random Number
Buffer Name: RandomAge
Value: RandomNumber(18,65)
This generates a random age between 18 and 65 for testing age-related validations.
Example 3: Generating a Date
Buffer Name: FutureDate
Value: AddDays(CurrentDate(), 10)
This sets a date 10 days in the future, useful for testing subscription expiration or appointment scheduling.
Step 5: Link Buffers to Test Steps
After creating buffers, you can use them in your test cases:
- Select the input field in the test step.
- Click on Buffer Input.
- Choose the buffer (e.g., RandomEmail).
At runtime, TOSCA will populate the field with the dynamic value generated by the buffer.
Step 6: Validate and Execute
Run the test case to verify that dynamic values are generated correctly. Check logs or reports to ensure that each iteration uses unique and correct data.
Examples of Common Dynamic Data Expressions
Here are some more advanced expressions to expand your TOSCA skills:
| Use Case | Expression | Description |
| Random Username | “user_” + RandomString(8) | Generates a unique username |
| Random Phone | RandomNumber(9000000000,9999999999) | Simulates Indian mobile numbers |
| Incremental ID | Buffer(“PreviousID”) + 1 | Creates sequential IDs |
| Random Password | RandomString(10) + RandomNumber(100,999) | Combines letters and numbers for a secure password |
| Custom Date | AddDays(CurrentDate(), RandomNumber(1,30)) | Picks a random date within the next month |
These expressions are commonly tested during Tricentis TOSCA AS1 Certification exams, so understanding them thoroughly is crucial.
Advanced Dynamic Data Techniques
For large-scale or complex testing, consider these advanced methods:
1. Combining Buffers
You can combine multiple buffers to create more complex data structures:
Buffer Name: FullName
Value: Buffer(“FirstName”) + ” ” + Buffer(“LastName”)
This ensures that test cases use realistic and coherent names.
2. Using Excel or Database Inputs
TOSCA can integrate with external data sources. Dynamic values can be read from Excel sheets or databases using TOSCA’s TestCase Design feature. This is useful for scenarios requiring multiple test datasets.
3. Conditional Expressions
You can define expressions that change values based on specific conditions:
Buffer Name: Discount
Value: If(Buffer(“UserType”)=”Premium”, 20, 10)
This calculates discounts dynamically depending on the user type.
Real-World Use Cases
Dynamic data is widely used in real-world scenarios, including:
- E-commerce Testing: Generating unique order IDs and customer information for checkout flows.
- Banking Applications: Creating dynamic account numbers, transaction IDs, and interest calculations.
- Healthcare Systems: Populating patient data dynamically for scheduling appointments or testing EMR systems.
- Subscription Platforms: Setting future dates for trial subscriptions or membership renewals.
These use cases illustrate why mastering TOSCA expressions is critical for testers and professionals aiming for Tricentis TOSCA AS1 Certification.
Tips for Effective Dynamic Data Management
- Plan Buffers Carefully: Avoid redundant buffers and maintain a clear naming convention.
- Reuse Buffers: Leverage buffers across multiple test cases to reduce maintenance.
- Validate Outputs: Always validate generated data for correctness before executing critical tests.
- Document Expressions: Maintain a TOSCA Training Manual or internal documentation for team knowledge sharing.
- Monitor Performance: Complex expressions can slightly slow test execution; optimize where possible.
Frequently Asked Questions
Q1: Can TOSCA generate data in multiple formats simultaneously?
Yes, you can combine expressions and buffers to produce strings, numbers, and dates dynamically in the same test case.
Q2: How does dynamic data affect test case maintenance?
Dynamic data reduces maintenance since it eliminates hardcoded values, making tests more robust and adaptable.
Q3: Is dynamic data useful for performance testing?
Absolutely. Generating large volumes of unique data ensures realistic load and stress testing scenarios.
Q4: Does TOSCA support integration with external tools for dynamic data?
Yes, TOSCA can read from Excel, CSV, and databases to fetch dynamic values during execution.
Conclusion
Creating dynamic data using TOSCA expressions is a fundamental skill for modern automation testing. It improves test efficiency, reduces manual effort, and enhances real-world scenario coverage. By mastering buffers, expressions, and integration with external data sources, testers can handle complex applications confidently.
For professionals preparing for Tricentis TOSCA AS1 Certification, understanding dynamic data and expressions is critical. It ensures readiness for both exam scenarios and practical industry applications.