Introduction to Tosca Query Language (TQL)
As test automation becomes increasingly complex in enterprise environments, having a powerful and intuitive way to search and interact with test artifacts is crucial. Tosca Query Language (TQL), developed by Tricentis, is a specialized query language that allows testers to efficiently navigate, locate, and manipulate objects within the Tosca workspace. TQL is an invaluable tool for managing large-scale test repositories, improving productivity, and enabling intelligent test case design.
In this blog post, we’ll provide a beginner-friendly introduction to TQL—what it is, how it works, and why it matters.
What is Tosca Query Language (TQL)?
TQL is a domain-specific query language similar in concept to SQL but designed for Tosca’s test management environment. It enables users to search, filter, and reference Tosca objects such as TestCases, TestSteps, Modules, Requirements, and ExecutionLists. TQL is especially useful in large projects where manually locating items can be time-consuming and error-prone.
Why Use TQL?
- Here are a few reasons TQL is essential for Tosca users:
- Efficiency: Quickly find specific items in large test repositories.
- Dynamic referencing: Create dynamic object relationships (e.g., link requirements to TestCases).
- Automation: Integrate TQL queries into automated processes and workflows.
- Better test management: Identify redundant or unused test artifacts.
Basic Syntax and Structure
A TQL statement typically consists of the following structure:
text
<ArtifactType> WHERE <Condition>
For example, to find all TestCases with the name “Login Test”:
tql
Copy
Edit
TestCase WHERE Name = "Login Test"
Or to find all TestCases assigned to a specific folder:
tql
Copy
Edit
TestCase WHERE Path = "Tests/Authentication"
Common Query Examples
Here are several common TQL queries and what they do:
Find all TestCases:
tql
Copy
Edit
TestCase
Find all TestCases containing the word “Checkout” in their name:
tql
Copy
Edit
TestCase WHERE Name CONTAINS "Checkout"
Find all Modules used in a specific TestCase:
tql
Copy
Edit
Module WHERE usedby.TestCase = "Login Test"
Find TestCases linked to a Requirement with a certain status:
tql
Copy
Edit
TestCase WHERE linkedRequirement.Status = "Failed"
Find all unlinked Requirements:
tql
Copy
Edit
Requirement WHERE NOT linkedTestCase EXISTS
These examples illustrate how TQL enables users to navigate through Tosca's complex object relationships with ease.
Best Practices for Using TQL
- Use meaningful names: TQL relies on object names and paths. Clear naming conventions improve query accuracy.
- Be specific: Use exact matches (=) for known values and CONTAINS or LIKE for partial matches.
- Use relations wisely: TQL supports object relationships like usedby, linkedRequirement, linkedTestCase, which can be leveraged for powerful cross-object queries.
- Save and reuse queries: In Tosca, frequently used TQL queries can be saved for quick access.
Conclusion
Tosca Query Language (TQL) empowers testers to work smarter, not harder. By mastering TQL, you can streamline test design, improve traceability, and gain better control over your test automation assets. Whether you’re managing hundreds or thousands of test cases, TQL is the key to unlocking efficient, scalable test automation in Tosca.
If you’re new to TQL, start small—experiment with simple queries and gradually explore more advanced conditions and relationships. With time, TQL will become one of your most valuable tools in the Tosca ecosystem.
Learn TOSCA Training Course
Read More: Best Practices for Tosca Test Case Design
Visit Quality Thought Training Institute in Hyderabad
Get Direction
Comments
Post a Comment