How to Create and Reuse Modules in Tosca
How to Create and Reuse Modules in Tosca
Boost your automation with modular, reusable test components
Tosca by Tricentis is a powerful test automation tool that supports model-based testing. One of its core features is the use of Modules — the building blocks of automation. Learning how to create and reuse modules is key to efficient and scalable test automation.
💡 What is a Tosca Module?
A Module in Tosca represents a UI control or business component (like a text box, button, table, etc.). It stores the technical information (like XPaths or HTML attributes) that Tosca needs to interact with the application.
There are two types:
-
Technical Modules – for UI elements (created by scanning)
-
Business Modules – reusable logic/flows built using Technical Modules
✅ How to Create Modules in Tosca
🔹 Step 1: Open Tosca Commander
Launch your Tosca workspace and navigate to the Modules section.
🔹 Step 2: Scan the Application
Use Tosca’s Tosca XScan tool to identify UI elements:
-
Right-click the Modules folder → Select Scan
-
Choose your browser or application window
-
XScan opens and highlights the UI
-
Click on elements you want to automate (e.g., username, password fields, buttons)
-
Save and close the scan
Tosca will create Technical Modules for each scanned element.
🔹 Step 3: Name and Organize Modules
-
Rename modules meaningfully (e.g.,
Login_UsernameField
,Login_Button
) -
Group them by screen or function (like
Login Page
,Home Page
)
Organizing makes reuse easier and your project cleaner.
🔁 How to Reuse Modules in Test Cases
Once your modules are created:
-
Go to the TestCases section
-
Drag and drop a module into your test case
-
Fill in test data or actions (e.g., Enter username = "admin")
You can reuse the same module in multiple test cases — no need to rescan or rebuild.
🔄 Create Reusable Business Modules
Business Modules are reusable blocks made by combining multiple steps (like login flow).
Example:
-
Create a Folder under Modules → Right-click → Add Business Module
-
Inside the business module, add:
-
Enter username
-
Enter password
-
Click login button
-
-
Now drag this Business Module to any test case where login is needed.
🎯 Benefit: Update logic once → used everywhere.
🔧 Tips for Better Module Reuse
-
Always scan full screens rather than single controls when possible
-
Avoid duplicate modules by checking existing ones
-
Use Module Attributes wisely (e.g., Visible, Enabled)
-
Modularize complex flows into small, reusable chunks
-
Add Comments in Business Modules for clarity
✅ Summary
Step | Description |
---|---|
Scan UI | Use Tosca XScan to capture UI elements |
Create Modules | Technical Modules for UI, Business Modules for logic |
Reuse | Drag modules into test cases |
Maintain Easily | Update in one place, reflect everywhere |
Conclusion:
Using Modules the right way in Tosca helps you reduce duplication, maintain cleaner test structures, and save time during automation. Build once, reuse always — that’s the Tosca way!
Comments
Post a Comment