0 Shares 2024 Views 4 Comments

How Test Complete Handles Unexpected Windows

Oct 01, 2012
2024 Views 4

When you are designing your script and you know that a specific popup will appear on a particular event then you design your script in that way. You handle that using assertions something like below

But what if, when you are not aware of a popup window which appears suddenly due to an issue/bug/change in functionality. This could be due to many reasons. e.g. you are working on a printer dialog box and the window popup occurs as ‘printer out of paper”, which is an unexpected window.

The way Test Complete handles this situation, is in following sequence

1. Script execution is delayed until expiration of the “Auto-wait timeout” interval set in the project property, playback section.

2. If the unexpected window is still open, TestComplete generates the OnUnexpectedWindow event. You can use this event to perform required action when an unexpected window appears.The event has the following parameters:

Sender: The Event control that processes the event.

Window: Specifies an unexpected window as a Window object.

LogParams: Properties of the LogParams object hold text, priority, color and other attributes of the error message posted to the log.

below is a simple example, which takes the screenshot and changes the message, when an unexpected window appears.

This event can be added to by adding ‘Events’ to your project.

Events

3. If the window is not closed by the OnUnexpectedWindow event handler, TestComplete posts an error message to the log along with an image of the unexpected window and then acts according to the Playback settings:

  • If Stop on error is checked, then the run ends at that point.
  • If Stop execution is checked in the Unexpected Window section, Stops the execution

Otherwise, any of the four following actions is taken, depending on the settings in the Unexpected window section:

  • Click on focused button simulates a click to the window’s default button.
  • Press Esc simulates an ESC keypress.
  • Press Enter simulates an ENTER keypress.
  • Send WM_CLOSE sends the window the normal window-closing message.
  • If the window is still not closed (which may occur if you do not have a closing-action checked, or if the closing action(s) failed), the run ends

 

You may be interested

UFT Patch Updates – UFT 14.03
Unified Functional Testing
434 views1
Unified Functional Testing
434 views1

UFT Patch Updates – UFT 14.03

Saket - Mar 11, 2018

Post the launch of UFT 14.0, there are three patch updates has been released including a number of features and enhancement. Recently Micro Focus unveiled third patch…

Setting up Web Service Automation Project
Katalon Studio
877 views
Katalon Studio
877 views

Setting up Web Service Automation Project

Saket - Oct 24, 2017

Web services are specific services that can be published and called over the Internet by client applications. Katalon Studio supports functional testing of web services. This topic…

Setting up Mobile Automation Project in MacOS
Katalon Studio
821 views1
Katalon Studio
821 views1

Setting up Mobile Automation Project in MacOS

Saket - Oct 09, 2017

Using Katalon Studio, mobile tester can design automation test for both Android and iOS to run on physical devices, cloud services and emulators. This tutorial explains how…

4 Comments

  1. Is there any mechanism to handle run time errors so that the test run stops automatically and next test run continous to run if i parametarize routines through excel.

    As human intervention is required when VB Script run time error occurs and than run stops. It is stopping my next test runs.

    Apart from try catch mechanism, Can we handle this?

    Reply
  2. Hi Shireesha,
    VB Script run time error can be easily handled using ‘On Error Resume Next’. Using this you can avoid the VBS Error dialog and so the human intervention.
    Apart from this, disabling ‘Error Dialog’ Option will let TestComplete continue the test execution without showing the error dialog.
    Furthermore you will need to disable Stop on error options, which will let testcomplete continue the script in case of any other error gets logged. You can find them on the Properties page of Project editor at Playback-Runtime. You will be able to view all the errors that occurred during the test run in the test log once your execution is complete.

    Reply
  3. Thanks Saket ..I was facing the similar issue and was looking for the solution.I tried the approach suggested by you and it worked fine for me.

    Reply
  4. Pingback: Fix Test Complete Stop On Error Errors - Windows XP, Vista & Windows 7, 8

Leave a Comment

Your email address will not be published.

Most from this category

Join The Growing Group of 15000+ Test Automation Engineers

Signup for our newsletter and get access to free downloads, as well as tips, tricks and techniques and various test automation resources.
Name
Email Address
Secure and Spam free...