Sunteți pe pagina 1din 11

Introduction to Testing .

NET in
TestComplete

Contents
Introduction.............................................................................................3
What is .NET?........................................................................................3
Why Do I Need Test Automation for Testing .NET Apps?....................... 4
Testing .NET Apps with TestComplete....................................................5
What .NET Controls Does TestComplete Support?................................ 6
Creating and Recording Test for .NET Applications...............................7
Object-Based Recording for .NET..................................................................... 7
Direct Access to .NET Classes.......................................................................... 7
Images Captured During Recording.................................................................. 9

Conclusion............................................................................................10

TestComplete

by SMARTBEAR

Introduction
Not surprisingly, most of the world uses a PC for surfing the web, playing video games, and line of business applications. With such a high
usage of Microsoft Windows, chances are youve developed or tested
software for the Windows platform. This could be basic Windows, Windows Server, a Windows Phone or even Windows Azure. If so, youve
probably worked with the .NET framework, which is a development
platform designed to build such apps in the C# and Visual Basic programming languages. In fact, .NET has become so embedded in the PC
world that it is a required knowledge for anyone working in the software
development industry today. Thats why weve written this eBook so
you have the knowledge and tools to test Windows applications.

What is .NET?
Before we dive right into exactly what .NET is, lets take a look at what
the development field looked like before the mainstream use of .NET
frameworks. Before .NET came into existence, the development world
was a very different place. Think of a time before peer code reviews,
way back when developers tested their own software. Development
teams worked in silos and, quite honestly, programming was close to
mayhem. You had developers developing the same code simultaneously doubling man hours spent and therefore wasting money. These
were the days when bugs wrecked havoc on programs because there
was simply too much code.
With the introduction of frameworks such as .NET and IDEs (integrated
development environment) like Visual Studio, code could be recycled
by adding it to a framework library. Platform companies began providing
developers with objects that could be used universally, leading to less
coding and increased language interoperability.
Thats what .NET is and why it is so popular for Windows based applications. It is a library of code that can be reused rather than developed

TestComplete

by SMARTBEAR

over and over again, eliminating redundancy in the software development process. Better yet, this code is insured to be safe and meet
performance standards. How about that for a full package?
Why do I need Test Automation for Testing .NET Apps?

Why Do I Need Test Automation for Testing .NET Apps?

Before we go right into how we can test .NET applications - lets list
some types of testing we would need to perform on the program in order
for it become quality software.

Functional Testing

Exploratory Testing

Regression Testing

Load Testing

Data-Driven Testing

Performance Testing

Unit Testing
For the record, there are many other types of testing but these are the
most popularif not most importanttypes of tests. These tests will
present how a program reacts to the basic operations and functionality
via user input and allow development teams to understand how a system as a whole will react under the most extreme circumstances. The
point is that depending on the app, testing .NET applications requires a
lot of technical knowledge and perseverance. Understanding what types
of tests there are and what is needed is one thing, but how can we test
this in the increased velocity of teams using Agile methodologies today?
If you think your team can test .NET applications manually in the time
allotted, all the power to you, but I personally like to sleep at night.
Applications arent being run through the same hoops they were ten or
twenty years ago. Since we need our apps to work with multiple platforms, multiple browsers, multiple environments and multiple devices,
test automation is a necessity.
With TestComplete, you can test your 32-bit and 64-bit .NET applications. TestComplete can maintain test scripts using languages VBScript

TestComplete

by SMARTBEAR

and C# and Visual Basic compilers, so there will be no need to convert


syntax if you are testing basic Windows applications or even Windows
Runtime applications. You can record and replay various interactions
with .NET applications, such as navigation through the applications
screens, filling out forms and running menu commands. To ensure that
the tested application functions properly, you can insert various checkpoints for verifying data, GUI element states and other items.

Testing .NET Apps with TestComplete


How does TestComplete do this, you may ask? Thats a great question.
Its simply done by providing support via plug-ins. These plug-ins are
installed and active by default, so you can test most .NET applications
right out-of-the-box, without any additional configuration.
You can check to see if these plug-ins are active by selecting File | Install Extensions from TestCompletes main menu. Both plug-ins are part
of TestCompletes distribution, so they are active by default, provided
that you installed TestComplete with the default settings.
If one of the plug-ins is not available (that can happen, for example, if
you installed .NET Framework after TestComplete or if you installed
TestComplete with custom settings), you need to run the TestComplete
installation in the Modify mode and select the Extensions | Open Applications Support feature in the Installation Wizard.
As for controls in .NET applications, TestComplete supports all Microsoft controls via a graphical user interface. In order for TestComplete to
be able to work with Microsoft controls, the Microsoft Control Support
plug-in must be installed and enabled. This plug-in provides access to
Microsoft controls via special program objects. It also enables creating
of table checkpoints for some of the controls. By default, the tcThirdPartyControls.pls file that includes the Microsoft Control Support plug-in
is installed in the <TestComplete>\Bin\Extensions folder.

TestComplete

by SMARTBEAR

As you start testing your .NET applications in TestComplete, you will


quickly realize that .NET reaches a wide audience of applications and
the amount of controls depending on the application is vast. So vast,
that its impossible to list them in this eBook. To put it simply, TestComplete not only tests the basic controls in your applications, but also third
party controls.

What .NET Controls Does TestComplete Support?


TestComplete provides full-scale support for many custom .NET controls
and libraries, including those supplied by Developer Express, Infragistics, Syncfusion and other vendors in order to easily automate in-depth
UI testing of .NET applications that include third-party controls. And by
using the TestComplete SDK, developers and testers can add automated testing support for other non-standard .NET controls.
To give you a better idea of some of the controls that are supported in
TestComplete, here is a list of .NET technologies supported by TestComplete.
TestComplete supports testing .NET applications that use the following
technologies:

.NET Framework 2.0 - 4.5 (both 32-bit and 64-bit versions).


Note: Mono is not supported.
Any .NET development tools, languages and compilers
including:

Microsoft Visual Studio: C#, Visual Basic .NET, Visual


C++ .NET, JScript .NET, F# and so on.

CodeGear and Borland: Delphi for .NET and C#Builder.


Other: Python for .NET, IronPython, COBOL .NET, and
so on.

TestComplete

by SMARTBEAR

Note: PowerBuilder for .NET applications are supported


as WPF applications.

GUI frameworks:
Windows Forms (used in most .NET applications)
VCL.NET (used in Delphi for .NET applications)
Standard and third-party .NET controls. (See Support for .NET
Applications Controls.)

Object-Based Recording for .NET


The automated test recording engine records object-based operations,
such as choosing a menu item, selecting or clearing a check box, clicking tree nodes and so on. Such tests are more robust than coordinatebased automated tests, they do not fail if the applications UI changes
and the tests can be played back with little or no modifications.

Direct Access to .NET Classes


TestComplete provides direct access to .NET classes both intrinsic
.NET Framework classes and those defined in the tested .NET application and in arbitrary .NET assemblies. This way, you can extend
the functionality of automated tests with .NET classes and functions,
make use of testing utilities developed in .NET and even test .NET class
interfaces.

Creating and Recording Test for .NET Applications


With TestComplete, you can record and play back user actions in .NET
applications, or you can create tests manually from scratch. It is usually
easier to record the test first and then modify and enhance the recorded
test.
When you record a test, you interact with the tested .NET application as
an end-user would: navigate through the applications screens, fill out

TestComplete

by SMARTBEAR

forms and so on. TestComplete captures all actions you performed in


the application and adds them to the test.
A test consists of a sequence of operations that define various interactions with objects in the tested application. For example, in the sample
test below you can see that item selection from a combo box is represented by the ClickItem operation, text input into text boxes - by the
SetText operation, and so on.

The recorded tests can be modified and enhanced in a number of ways


to create more flexible and efficient tests. For example, you can:

Add new operations, reorder operations and modify their


parameters.

Delete or disable unneeded operations (such as superfluous


recorded operations).

Insert checkpoints for verifying objects and values in the tested


application.

Create data-driven tests that run multiple test iterations using


different sets of data.

TestComplete

by SMARTBEAR

Images Captured During Recording


Images that were captured during test recording are shown in the Test
Visualizer panel below the keyword test or script editor:

The entire panel looks like a series of slides or a movie. Individual


screenshots in it are called frames.
The test editor marks the test commands, for which an image was captured. When you select an image in the Test Visualizer panel, the editor
automatically highlights a test command to which the image relates.
The object with which a command works is marked with the red frame
on the image. The captured images illustrate test commands and make
analyzing the recorded test much simpler. By default, a Test Visualizer
frame contains images only. To make Test Visualizer collect test object
data along with images, enable the Capture images and test object info

TestComplete

by SMARTBEAR

project option. Then you can use the captured Test Visualizer frames to
insert test commands and property checkpoints that work with windows,
edit boxes, buttons and other objects shown on an image.
If youd prefer, you can also create your tests manually using keyword
tests. Check out our eBook on how to create keyword tests here.

Conclusion
If youd like to dive deeper into the richer features of TestComplete
or need more technical knowledge on automated testing in general please visit our SmartBear site to browse through an extensive list of
tutorials and support documents. If you havent done so already, try a
free trial of TestComplete and try creating automated test scripts for your
.NET applications today.

TestComplete

by SMARTBEAR

10

About SmartBear Software


More than one million developers, testers and operations professionals use SmartBear tools to ensure the quality and performance of their
APIs, desktop, mobile, Web and cloud-based applications. SmartBear
products are easy to use and deploy, are affordable and available for
trial at the website. Learn more about the companys award-winning
tools or join the active user community at http://www.smartbear.com, on
Facebook or follow us on Twitter @smartbear and Google+.

SmartBear Software, Inc. 100 Cummings Center, Suite 234N Beverly, MA 01915
+1 978.236.7900 www.smartbear.com
2013 by SmartBear Software, Inc. Specifications subject to change.

SB-TC-061313-WEB

S-ar putea să vă placă și