Automation testing scripts are indispensable. Not only it can help you run your tests with greater speed and productivity, but also it will help you in your career as a software tester.

Step 1: Assess the Application

Before all great automation efforts comes planning.  As an Automation Specialist, you should consider yourself as a developer for the QA team.  You are provided a set of requirements and you must develop automated scripts based on these requirements. To comprehend these requirements, you will be using your knowledge of the application to construct feasible solutions to burdensome tasks.

Therefore, you absolutely must begin with analyzing the application.  The knowledge and understanding that you gain here will determine your outcome of the automation scripts.  We have seen countless hours lost to automation efforts because the Automation Engineer did not initially understand the application.

Don’t be one of these burdens for your company.   Consider the following information when assessing the application:

1. How is the application divided?

  • Are there separate areas for certain activities?
  • What are these activities?
  • What are the expected outcomes of these activities?
  • How do you validate these activities?

2. What screens need to be tested?

  • How many screens need to be tested?
  • How many objects need to be tested?

3. Think of repeatable units.

  • Are the same activities repeated over and over?
  • Is the user always logging in and logging out? Is the user always performing a certain set of actions to get to a different stage of the application?
  • This will allow you to create smaller units of code that will significantly decrease your maintenance time.

4. Think about all of the environments that need to be supported.

  • Will you be doing cross-browser testing?

If you are working with a web application, then most likely you will be, unless strictly told not to by your management.  It is highly recommended to cross-browser test because one well- designed script can be run on multiple browsers, providing great coverage for the QA team.

  • Will you be testing on multiple development environments?

I can almost guarantee that you will be! So plan ahead. Be sure that you are not hardcoding urls of you applications. Store all variables in external locations such as .xml or .json files for easy configuration changes.

Step 2: Prepare Infrastructure for Testing

infrastructure

Another critical step of the process is making sure that your entire testing infrastructure is in place.  You cannot predict everything that you will need in advance.  But, a lot of problems can be avoided with proper planning and care.

1. Build the set of resources to be used in your tests.

  • Object Repositories
  • Environmental Variable files
  • Function Libraries

2. Configure the QTP according to the needs of the application

  • Create scripts to automatically configure your QTP settings.
  • Create recovery scenarios.
  • Run session specific preferences.
  • Install any patches that you may need for QTP to work correctly.

This is such an important step, yet we have run into so many Automation Engineers who have no idea how to configure their QTP to even make it work.  It’s sad, don’t be one of those people.

Here is a series of videos to help you understand why QTP/UFT may not be recognizing objects:

QTP Is Not Recognizing Objects Video Series

3. Configure other infrastructure

  • Browsers

If you are working on a web application, don’t forget that all browsers are not created equal.  Each browser needs a special approach to be handled.

Also, make sure to turn off tabbed browsing.  This is the basics of QTP Automation Testing

  • Computers/Laptops

Yes, even different computers can affect how your script runs. Some may have Admin Rights, others may not. Maybe you need to allow other users to have the capability to remote into an automation machine. These are all questions that need to be asked.

Ideal situations include 1 vm that can run multiple processes and run all of your automated checks in the cloud. That way someone else maintains all the infrastructure and you get all of the benefits 🙂

Step 3: Script a Small Unit of Your Test

3-small building blocks

There are many ways to design your test but you need to plan the most logical and efficient manner.  Proceed through the application manually, step by step, and write down the process.  Once the process is written, just transform it into code!  Careful planning here will provide you with an efficient and easy to maintain script and framework.

  • Develop small functions that perform basic tasks.

These functions should be as reusable as possible to avoid needing future development of functions. This is the approach that we recommend and we believe to be most indicative of a skilled Automation Engineer.  Some common examples of functions include getting some value, setting some value, login, logout.

  • Do NOT use separate reusable actions to create a test.

This is similar to the creation of functions approach, but it has several disadvantages.  It is much harder to have a reusable action and constantly link to it whenever you need it because it’s an entire test script.  If you need to use a logout action in 200 scripts, it’s a painful process to constantly link to this separate action. Furthermore, each action needs to be configured to Output and Input parameters so that the actions are dynamic.  It is much faster and simpler to just transform your action and keep it in a global function library.

Step 4: Run

4 run the atuomation testing code

A test runs when it is fully scripted. This is what some individuals believe. However, this methodology is incorrect and outdated. Unit testing is where the developer creates a small module of code and then tests it for the functionality.  To be the most effective Automation Engineer, we believe this method to be the best.  Let’s face it. Technically, you are a developer so you need to follow the best development practices.  Therefore, you should alternate between scripting a small unit of code and then test it for functionality.  For example, create a small unit that opens an Excel sheet and validates the version of the template.  Test this unit.  If it is successful in achieving its goal, move on to the next functionality.

Step 5: Debug and Analyze

5- debug and analyze the code

Although the last step in the sequence of events, it does not mean that they are the least important.  An Automation Specialist who does not know how to debug is one whom we would never think about hiring for our projects.  We have seen individuals who have absolutely no concept of debugging and others who believe that well-placed Message Boxes are a way to debug.  Stories like these are sad but it is the reality of some Automation Testing Engineers in the world.  Therefore, learn proper debugging to stay ahead of these charlatans. QTP offers many features for debugging.

  1. Use Step Into, Step Over and so on to traverse code line by line.
  2. Utilize breakpoints to stop at a certain location in the script and analyze for possible errors.
  3. Use the Debug Viewer to analyze objects, variables and conditional logic.

You can perform debugging and analyzing everytime you are scripting to ensure that your logic is properly coded. Here are some excellent resources on how to debug:

Works Cited

QTP, HP. (n.d.). HP QuickTest Professional Software Version: 11.

0 Shares
Tweet
Share
Share