How To Set Up A Keyword Driven Framework Designed by Real UFT Engineers



Today is an exciting day for QTP Tutorial and all of its members. We are going to release our advanced Keyword Driven Automation testing framework utilizing HP's UFT/QTP. You all have seen this framework several times as we taught you different aspects of test automation. This framework was developed over 10,000 hours by real Software Development Engineers in Test (SDETs). This framework easily cost the companies over $500,000 of development time from us. This is the exact framework that we take with us to different employers.

We come in to work, drop the framework on the file system and begin writing automated checks from day 1! Although, sometimes I may take a few extra days to add enhancements and modify it based on the new employers needs. Either way, the framework is here for you to enjoy and use at your place of work. The most amazing part of all is that there are at least 150 functions that can enhance your test automation code immediately. Just pick your desired actions and implement the function in your code.

Download Keyword Driven Framework


1. Download the file and extract it

2. Here is the extraction. The parent folder is MercuryTours.

3. Take a look at the contents of the MercuryTours folder. All of our automation testing projects will contain a similar folder architecture.

4. Open the Config.xml file in the 'TestControls' folder.

5. Edit the Config.xml to point to the location of your framework.

We are going to update the value element of the 'ApplicationParentFolder' variable. This is so that the UFT DriverScript knows where your framework is located. This is how it looked before the update.

6. This is the path to where I extracted my framework.

The '_Common' folder is what contains all of the folders. This is where we want to point our framework.

7. This is how the 'Value' element looks after updating the value of the string.

Notice the new path.

8. Open the Execute.vbs

Execute.vbs is the kick off file that will execute our framework. This file can be scheduled to run every hour and it will execute your automation testing framework. You can also double click on the file to execute the framework. Some of us have even made this executable through email so that it can be on demand for manual testers.

This file is also located in the 'TestControls' folder.

9. Configure the Execute.vbs

This file just requires for you to point it to the Driver Script that you want to execute. In our case, we will point it to MT_DriverScript located in the 'Scripts' folder. However, this 'Execute.vbs' file is so awesome that you can run as many frameworks as you desire. When you master VBscript, you can do such amazing things with your frameworks as well.

Take a look at the image before we modify it.

10. Update the path to the DriverScript

This is the new path of the 'MT_DriverScript' folder that contains our DriverScript.

11. Open UFT and open the MercuryTours solution

12. It should be located in the MercuryTours parent folder.

13. Your solution should contain the following items

You should be familiar with how to use UFT at this point. If this is completely new to you, you should get familiar with UFT.

  1. This is a 2 part video series to get you started with UFT
  2. This is an entire video course to help you learn everything about UFT

14. Update the path in MercuryTours function library

  1. In UFT, open the MercuryTours function library.
  2. We need to update 'strEnvironmentalVariablesFile' to the location of your Config.xml file. This is the one that we updated first to point to our parent folder.
  3. Take a look at the image below for how that path looks.

15. A summary of configuration updates

Just to recap. We udpated 3 files.

  1. xml - C:\Users\User\Desktop\KDFSample\MercuryTours\_Common\TestControls\Config.xml - so that it points to our parent project contents.
  2. vbs - C:\Users\User\Desktop\KDFSample\MercuryTours\_Common\TestControls\Execute.vbs - so that it points to our Driver Script folder for our project
  3. vbs - C:\Users\User\Desktop\KDFSample\MercuryTours\_Common\FunctionLibraries\MercuryTours.vbs - so that it points to our Config.xml file

16. The execution - method 1

We can now execute the Keyword Driven Framework designed over 10,000 hours from real Automation Engineers. The easiest way to execute this framework is to just run it through UFT by pressing the 'Run' button.

17. A 2nd way to execute the framework for real automation.

The second method of executing the framework is by running the Execute.vbs that we updated.

  1. You can double click it to execute your framework.
  2. Make sure that your UFT is closed.
  3. You can also schedule this kick off file so that your framework can be executed automatically throughout day and night.
  4. In the future, you can link this to your email system to be able to execute the framework on demand

18. Where to find the results

Every single execution run receives a unique folder that contains the 'printLog.txt', the 'Results.xml' and any other screenshots.


future enhancements
  • Facebook
  • Twitter
  • Google+
  • Buffer
  • Gmail
  • Delicious
  • reddit
  • StumbleUpon
  • Tumblr

Yes, this framework is one of the most amazing ones that we have ever built at QTP Tutorial. However, a good framework never stops improving. A good automation engineer can keep using the framework, increasing quality of the products and decreasing maintenance time of the automated tests. As a result, we will give you some awesome enhancements that we have made our selves or are going to make in the future to the framework. You will also get that version whenever it is finished. In the meantime, you can feel free to make these enhancements at your work place.

  1. Make DriverScript.vbs completely independent of any application. It should have the capability to be dropped on any file system and just run without any other modifications. Once this is established, the DriverScript should never be touched again.
  2. Be able to control all environmental variables through one configuration file. You can use the config.xml to configure your framework. This is the only place that modifications should be made. Go into 1 location, update some variable values and run your automation testing framework. Easiest set up ever!
  3. Add Reporter.ReportEvent to all of the functions. Another very cool enhancement would be to start utilizing the beautiful reporting capability of UFT's Reporter object. Use it to create beautiful test reports that have actionable solutions. This will help you to debug and find issues much faster.
  4. Follow a standard format for the logs. This logging functionality was created many years ago before we knew about standards. Now, it's common practice for logs to have a certain format. Google how to use logging in development and adopt a similar process. Again, this will really help you to debug and resolve issues faster.
  5. Before opening the TestSuite.xls and traversing the cells, be sure to create a unique copy of that workbook. Place it into the 'Data' folder and then use that as your import and export from UFT/QTP. We have been using this method with amazing success because now the TestSuite.xls will never be locked for anyone to edit. UFT will always run against a unique instance. Trust me, this is awesome!
  6. Do you have 100s of keywords like us? Sick of updating the DriverScript with those keywords? We came up with an amazing solution to dynamically invoke the keywords. Yes, it's possible! Now we never have to edit the DriverScript and never have to type another keyword into there. It's so efficient and it's crazy that people are still coding Keyword Driven Frameworks the old way. This will take you into a new amazing direction with your framework. Keep an eye out in the future for it as we teach you this advanced method.
  7. There are many other updates that can be made, have been made and will be made to this framework. Requirements and needs will change over time and so should your framework. And you will slowly move into the direction of what we call a Test Driven Framework. It is light years ahead of the Keyword Driven Framework. But until that is ready for us to reveal, you can enjoy this current masterpiece at your work or for fun!

Author: Nikolay Advolodkin, an Automation Engineer with a passion for excellence in automated software testing.

Pin It on Pinterest

Clef two-factor authentication