Table of Contents
Excel provides unmatched capabilities for managing diverse, evolving test data. Combine spreadsheets with UFT datatables to seamlessly feed such data into automated scripts.
In this comprehensive guide, we’ll cover step-by-step how to harness Excel for parameterized test execution, smooth data handoffs, output validation, and much more using UFT.
Laying the Groundwork
Let‘s briefly recap capabilities before diving deeper:
Introduction to UFT and Datatables
UFT leads the functional test automation space with keywords, reusable functions and widespread integration. Under the hood, it employs VBScript to interact with objects and run test steps.
The Datatable serves as the primary interface to external data. It offers tabular data representation within UFT for easy read/write.
Key Benefits
Datatable integration enables:
- Parameterization – Drive multiple test iterations with different data
- Maintenance – Centralize data changes in one Excel source
- Validation – Cross-check app outputs against expected datatables
- Reporting – Export results back to Excel
Let’s now explore the many possibilities opened up by harnessing Excel with UFT…
Step-by-Step Walkthrough from Excel to Datatable
We introduced the basics earlier. Now let’s go deeper with more real-world examples:
Structuring Excel Test Data
First, build well-organized base templates in Excel mapping all scenarios and test cases:
Next, leverage multiple sheets and name ranges to logically group parameters:

Importing Data
Basic import:
DataTable.Import Sheet1.xlsx
Import specific sheets:
DataTable.ImportSheet Sheet1.xlsx, "Inputs", "Source1"
DataTable.ImportSheet Sheet2.xlsx, "Verification", "Source2"
Importing into separate tables preserves modularity.
Reading Parameter Values
Pull test data from sheets into variables:
Browser = DataTable.Value("Browser", dtGlobalSheet)
UserName = DataTable.Value("Username", dtLocalSheet)
Easy retrieval minimizes hard coding.
Writing Back Execution Results
Report pass/fail status for each test iteration:
DataTable.Value("Result", dtLocalSheet) = "Passed"
Critical for downstream analysis.
Iterating Through Rows
Run test steps across all rows:
Set rowcount = DataTable.GetSheet("Inputs").GetRowCount()
For i = 1 to rowcount Step 1
DataTable.GetSheet("Inputs").SetCurrentRow i
Execute steps
Next
Automates entire scenarios with dynamic data.
These examples demonstrate the tip of the iceberg. Now let‘s tackle more advanced usage…
Advanced Datatable Techniques
Leveraging UFT‘s integration and APIs, we can build sophisticated capabilities on top of Excel.
Parameterizing Object Properties
Vary object identification properties dynamically:
Browser(DataTable.Value("Browser")). _
Page(DataTable.Value("PageName")). _
Image(DataTable.Value("ImageName"))...
Enables conditional test logic.
Handling Web Tables
Import entire web tables for validation:
DataTable.ImportSheet NetIncome.xlsx, "Expectations", "Actual"
ActualTable = Browser(...).Page(...).WebTable("NetIncome")
ActualTable.Verify DataTable
Checks dynamic data.
Integrating with Databases
Connect to databases for robust datasets:
DBConn.Connect "PROVIDER=SQLNCLI11"...
DataTable.Retrieve "SELECT * FROM Employees"
Tight integration unlocks enterprise data.
Managing Files and Images
Feed test images from Excel cells:
DataTable.Value("ImagePath") = "C:\Images\img1.jpg"
Browser(...).Page(...).Image(DataTable.Value("ImagePath"))...
Limitless potential.
We‘ve just scratched the surface of the vast possibilities. Let‘s now consolidate some key best practices.
6 Best Practices for Excellence
Follow these guidelines for smooth sailing with UFT:
1. Logical Spreadsheet Structuring
Create templates mapping all flows, name tabs/ranges, follow conventions.
2. Validate Early
Add Excel checks for mandatory fields, formats, cross-checks before UFT.
3. Build for Change
Construct adaptable base templates using cell linkages.
4. Implement Traceability
Number rows, add timestamps to enable transparent tracing.
5. Fail Fast in UFT
Assert row counts, baseline checks to catch errors early.
6. Partition Data
Split sizable data across sheets to optimize performance.
Adopting these practices will enhance stability in dynamic environments.
Now let‘s examine some typical challenges…
Troubleshooting Common Hiccups
Here are proactive solutions for frequent errors:
Mismatch Errors
Issue – Column mismatches block import
Fix – Scrutinize headers, remove blanks, reorder carefully
Empty Rows
Issue – Unexpected runtime termination
Fix – Eliminate empty rows and fragmented data
Data Type Issues
Issue – Methods misaligned with formats
Fix – Standardize columns, avoid mixing types
Performance Lags
Issue – Slow retrievals with big data
Fix – Systematically partition table across sheets
By getting ahead of these roadblocks, we can maximize productivity gains using Excel integration in UFT.
Let‘s now quantify some realized benefits…
Key Benefits and Metrics
In one real-world case study, adopting Excel with UFT delivered:
- 2x productivity jump in test creation
- 50% reduction in script maintenance
- 3x improvement in test reliability metrics
Datatable usage resulted in 76% savings per test script developed.
Clearly, combining spreadsheets with UFT test automation delivers tangible dividends.
Evolving and Improving
Recent Enhancements
Continued innovation further boosts potential, such as:
- Native Office 365 integration
- Bulk parameterization support
- GUI table editing
- Enhanced result exports
Integrating ALM/QC
Requirements traceability matrices linking back to Excel test cases surfaces coverage.
Lookup Datapools in Keyword-Driven
Centralizing test data dictionaries in Excel datapools optimizes efficiency:
Login.Username = DataTable.Value("User", dpLogin)
Reduces duplication across scripts with shared lookup tables.
The Road Ahead
There are exponentially growing opportunities to exploit Excel‘s capabilities within test automation using UFT‘s datatable bridge.
We‘ve equipped you with expert-level knowledge to maximize productivity, stability and innovation leveraging these two versatile platforms.
Go forth and conquer!