Testing automation is a tricky and complex area of computer science, as it requires not only experience in both testing and programming, but also knowing some specifics of using Graphical User Interface (GUI).
During the last several years a lot of software has been created to help to automate testing by emulating users' actions. Some of these programs are strictly specialized, while others allow users to automate a wide range of software.
TestComplete is one of the tools which supports testing of software developed on different platforms and application types (.NET, Win32, Java, Delphi, Web, and so on), at the same time using similar techniques for all of them, thus simplifying process of automation by software testers.
This book will teach you how to effectively use TestComplete by many simple and well thought-out examples, at the same time showing how to solve the most frequently asked questions. By executing the steps from each recipe and then reading the explanation text of what has been done, you will master TestComplete quickly and easily.
We hope this book will be a great support to you in studying TestComplete and testing automation principles.
Chapter 1, Getting Started, provides basic information about TestComplete and prepares you for further topics. This chapter will be helpful if you are new to TestComplete.
Chapter 2, Working with Tested Applications, explains how to work with tested applications in TestComplete using different approaches.
Chapter 3, Scripting, provides programming solutions for frequently asked questions and shows examples of different testing methodologies and frameworks.
Chapter 4, Running Tests, explains how to run your TestComplete tests including running from command line and scheduling automatic test runs.
Chapter 5, Accessing Windows, Controls, and Properties, explains how TestComplete interacts with tested applications, their controls, and data within windows.
Chapter 6, Logging Capabilities, covers several topics related to TestComplete log including working with screenshots, exporting logs, and sending results via e-mail.
Chapter 7, Debugging Scripts, describes how to use TestComplete debug capabilities when maintaining tests.
Chapter 8, Keyword Tests, introduces a simple way to create automated tests which doesn't require programming skills.
Chapter 9, Data-driven Testing, explains how to separate scripts code from test data and effectively work with it in tests.
Chapter 10, Testing Web Applications, covers Web-specific topics which were not covered in other chapters.
Chapter 11, Distributed Testing, shows how to run tests on several workstations and share data between them.
Chapter 12, Events Handling, introduces TestComplete events—a powerful tool to customize and improve your testing framework.
To run the examples in the book the following software will be required:
Microsoft Windows 7 x86 (32 bits) Home, Professional, Ultimate, or Enterprise Edition (most examples will also work in 64-bits version of the OS)
SmartBear TestComplete 9.0 or higher (most examples will also work in TestComplete 7.x and 8.x)
Microsoft Calculator Plus 1.0
Mozilla Firefox (any version supported by selected TestComplete version)
If you wish to use TestComplete for testing automation, this book will help you learn the very basics of the tool, as well as improve your knowledge if you already have some experience in working with TestComplete.
The recipes provided in this book can be studied one by one, thus improving your knowledge step-by-step. The book can also be read randomly, depending on the type of problem that you are trying to resolve.
It is implied that you are already aware of the programming basics (knowing what is a variable, loop, condition, function). This will tremendously facilitate further understanding of the approaches and solutions that are being considered. Nonetheless, we have tried to select examples that would be easy to understand, even for a novice in programming. These examples are easily scalable for your specific needs, as well as portable and scalable.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles, are shown as follows: "The Runner.CallObjectMethodAsync
method accepts two parameters: the object
and the callee
method."
A block of code is set as follows:
function testPirtureFormat() { Options.Images.ImageFormat = "BMP"; Log.Picture(Sys.Desktop.Picture(), "BMP screenshot"); Options.Images.ImageFormat = "PNG"; Log.Picture(Sys.Desktop.Picture(), "PNG screenshot"); }
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
TestedApps.notepad.Close(); if(pNotepad.WaitWindow("#32770", "Notepad", -1, 1000).Exists) { pNotepad.Window("#32770", "Notepad").Keys("~n"); }
Any command-line input or output is written as follows:
C:\Program Files\SmartBear\TestComplete 9\Bin\TestComplete.exe" "z:\TestCompleteCookBook\TestCompleteCookBook.pjs" /run /project:Chapter4 /Unit:Unit1 /routine:testDemoTestItems2
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on the Configure button in the Images group".
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]>
if you are having a problem with any aspect of the book, and we will do our best to address it.