What is HP QTP? HP Quick Test Professional is automated testing software designed for testing various software applications and environments. It performs functional and regression testing through a user interface such as a native GUI or web interface. It works by identifying the objects in the application user interface or a web page and performing desired operations (such as mouse clicks or keyboard events); it can also capture object properties like name or Object ID. HP Quick Test Professional uses a VBScript scripting language to specify the test procedure and to manipulate the objects and controls of the application under test. To perform more sophisticated actions, users may need to manipulate the underlying VBScript. HP Quick Test Professional is usually used for "UI Based" Test Case Automation, it also can automate some "Non-UI" based Test Cases such as file system operations, database testing or Web services testing
What is Automation Framework? A test automation framework is a set of assumptions, concepts and tools that provide support for automated software testing. The main advantage of such a framework is the low cost for maintenance. If there is change to any test case then only the test case file needs to be updated and the Driver Script or Startup script will remain the same. Ideally, there is no need to update the scripts in case of changes to the application. Choosing the right framework/scripting technique helps in maintaining lower costs. The costs associated with test scripting are due to development and maintenance efforts. The approach of scripting used during test automation has effect on costs.
Types of Automation Frameworks Linear - procedural code, possibly generated by tools like those that use record and playback Structured - uses control structures - typically ‘if-else’, ‘switch’, ‘for’, ‘while’ conditions/ statements Data Driven - data is persisted outside of tests in a database, spreadsheet, or other mechanism Keyword Driven – based on the Keywords Hybrid - two or more of the patterns above are used
Testing Process1. Analyzing your application The first step in planning your test is to analyze your application to determine your testing needs. What are your application’s development environments (for example Web, Java, or .NET)? You will need load Quick Test add-ins for these environments to enable Quick Test to identify and work with the objects in your application. What business processes and functionality do you want to test? To answer this, think about the various activities that customers perform in your application to accomplish specific tasks. Consider how to divide these business processes into smaller units. You will be creating actions based on these tasks. Smaller and more modular actions make your tests easier to read and follow, and help ease maintenance in the long run. At this stage, you can already begin creating test skeletons and adding actions to them.
Testing Process (Contd.)2. Preparing the testing infrastructure Based on your testing needs, you determine what resources are required and create these resources, accordingly. Resources include shared object repositories containing test objects (which are representations of the objects in your application), function libraries containing functions that enhance Quick Test functionality, and so on. You also need to configure Quick Test settings so that Quick Test will perform the tasks you need, such as displaying a results report every time you run a test.
Testing Process (Contd.)3. Building your tests and adding steps to them After the testing infrastructure is ready, you can begin building your tests. You can create one or more empty tests and add actions to them to create the testing skeletons. You associate your object repositories with the relevant actions, and associate your function libraries with the relevant tests, so that you can insert steps using keywords. You may also need to configure test preferences at this point.
Testing Process (Contd.)4. Enhancing your test Inserting checkpoints into your test lets you search for a specific value of a page, object, or text string which helps you determine whether your application is functioning correctly. Broadening the scope of your test, by replacing fixed values with parameters, lets you check how your application performs the same operations with multiple sets of data. Adding logic and conditional or loop statements enables you to add sophisticated checks to your test.
Testing Process (Contd.)5. Debugging, running, and analyzing your test You debug a test to ensure that it operates smoothly and without interruption. After the test is working correctly, you run it to check the behavior of your application. While running, Quick Test opens and performs each step in your test. You examine the test results to pinpoint defects in your application.
Testing Process (Contd.)6. Reporting defectsIf you have Quality Center installed, you can report the defects youdiscover to a database. Quality Center is the HP test managementsolution.
TOM & TOC Test Object Model is a set of object types or Classes that Quick Test uses to represents the objects in our application. A Test Object Class comprises of a list of properties that can individually (uniquely) identify objects of that class and a set of appropriate methods that Quick Test can record for it. * A Test Object is an object that Quick Test creates in the test to correspond to (represent) the actual object in the application. Quick Test uses the stored information about the object during the run session to identify and check the object. * A run-time object is the real (actual) object in the application or Web site on which methods are performed during the run session.
Properties and Methods of Objects The property set for each test object is created and maintained by Quick Test. The property set for each run-time object is created and maintained by the object architect (creator) (Microsoft for Internet Explorer objects, Netscape for Netscape objects). Similarly, methods of test objects are methods that Quick Test recognizes and records when they are executed (performed) on an object while we are recording and that Quick Test executes when the test or component runs. Methods of Run-time object are the methods of the object in the application as defined by the object architect (creator). We can access and execute run- time object methods using the Object property.
*Some Important Points Each test object method we execute (perform) while recording is recorded as a separate step in the test. When we run the test, Quick Test executes (performs) the recorded test object method on the run-time object. Properties of test object are captured from object while recording. Quick Test uses the values of these properties to identify runtime objects in the application during a run session. Property values of objects in the application may change .To make the test object property values match the property values of the run-time object, we can modify test object properties manually while designing the test or component or using SetTOProperty statements during a run session. We can also use regular expressions to identify property values. We can view or modify the test object property values that are stored with the test or component in the Object Properties or Object Repository dialog box.
*Some Important Points (Contd.) We can view the syntax of the test object methods as well as the run-time methods of any object on our desktop using the Methods tab of the Object Spy. We can retrieve or modify property values of the TEST OBJECT during the run session by adding GetTOProperty and SetTOProperty statements in the Keyword View or Expert View. We can retrieve property values of the RUNTIME OBJECT during the run session by adding GetROProperty statements. If the available test object methods or properties for an object are not sufficient or they do not provide the functionality we need, we can access the internal methods and properties of any run-time object using the Object property. We can also use the attribute object property to identify Web objects in the application according to user-defined properties.