Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Advanced UFT 12 for Test Engineers Cookbook
  • Table Of Contents Toc
Advanced UFT 12 for Test Engineers Cookbook

Advanced UFT 12 for Test Engineers Cookbook

4 (3)
close
close
Advanced UFT 12 for Test Engineers Cookbook

Advanced UFT 12 for Test Engineers Cookbook

4 (3)

Overview of this book

This advanced cookbook is designed for software testers and engineers with previous automation experience and teaches UFT (QTP) developers advanced programming approaches. Knowledge of software testing and basic coding (with VBScript in particular) and familiarity with programming concepts are prerequisites.
Table of Contents (13 chapters)
close
close
12
Index

Exporting a DataTable

We may need to save data that is collected during a run session. For example, a comparison of the current result with previous results might be required. Alternatively, we might wish to update the expected results. In such scenarios, we can save the data to an external Excel sheet for later use.

How to do it...

To save the DataTable in its current state before the run session ends, we will use the DataTable.Export method, which takes the path and name of an Excel file as an argument. There are two options to save the data table:

  • Using a hardcoded filename:
    DataTable.Export(Environment("TestDir") & "\MyDynamicallySavedExcel.xls")
  • Using a variable filename:
    DataTable.Export(Environment("TestDir") & "\" & strFileName & ".xls")

How it works...

The preceding statement saves the current contents of the DataTable (all worksheets) to a new Excel file (if not existent, otherwise it is overwritten). The statement Environment("TestDir") returns a string with the path of the current test to which a string with the name of the file we wish to create is concatenated (TestDir is one of the built-in Environment variables covered in detail later in this chapter).

There's more...

To export just a single worksheet (in our example, the global sheet) for an action, use the DataTable.ExportSheet method, as follows:

call DataTable.ExportSheet(Environment("TestDir") & "\MyDynamicallySavedSheet1.xls", "Global")

Here, the first parameter is the Excel filename and the second is the source datasheet. The target datasheet will take the same name as the source.

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Advanced UFT 12 for Test Engineers Cookbook
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon