11

SmartBear TestComplete NET eBook

  • Upload
    ptaiba

  • View
    31

  • Download
    0

Embed Size (px)

DESCRIPTION

Book Soap

Citation preview

Page 1: SmartBear TestComplete NET eBook
Page 2: SmartBear TestComplete NET eBook

2TestCompleteby SMARTBEAR

Introduction to Testing .NET in TestComplete

ContentsIntroduction ............................................................................................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 ..............................7Object-Based Recording for .NET .................................................................... 7Direct Access to .NET Classes ......................................................................... 7Images Captured During Recording ................................................................. 9

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

Page 3: SmartBear TestComplete NET eBook

3TestCompleteby SMARTBEAR

Introduction

What is .NET?

Not surprisingly, most of the world uses a PC for surfing the web, play-ing video games, and line of business applications. With such a high usage of Microsoft Windows, chances are you’ve developed or tested software for the Windows platform. This could be basic Windows, Win-dows Server, a Windows Phone or even Windows Azure. If so, you’ve probably worked with the .NET framework, which is a development platform designed to build such apps in the C# and Visual Basic pro-gramming 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. That’s why we’ve written this eBook – so you have the knowledge and tools to test Windows applications.

Before we dive right into exactly what .NET is, let’s 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 simultane-ously – 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.

That’s what .NET is and why it is so popular for Windows based applica-tions. It is a library of code that can be reused rather than developed

Page 4: SmartBear TestComplete NET eBook

4TestCompleteby SMARTBEAR

over and over again, eliminating redundancy in the software develop-ment 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?

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

For the record, there are many other types of testing but these are the most popular—if not most important—types 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 sys-tem 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 aren’t being run through the same hoops they were ten or twenty years ago. Since we need our apps to work with multiple plat-forms, multiple browsers, multiple environments and multiple devices, test automation is a necessity.

With TestComplete, you can test your 32-bit and 64-bit .NET applica-tions. TestComplete can maintain test scripts using languages VBScript

¿ Functional Testing

¿ Regression Testing

¿ Data-Driven Testing

¿ Unit Testing

¿ Exploratory Testing

¿ Load Testing

¿ Performance Testing

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

Page 5: SmartBear TestComplete NET eBook

5TestCompleteby 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 application’s screens, filling out forms and running menu commands. To ensure that the tested application functions properly, you can insert various check-points for verifying data, GUI element states and other items.

Testing .NET Apps with TestComplete

How does TestComplete do this, you may ask? That’s a great question. It’s 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 | In-stall Extensions from TestComplete’s main menu. Both plug-ins are part of TestComplete’s 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 Ap-plications Support feature in the Installation Wizard.

As for controls in .NET applications, TestComplete supports all Micro-soft 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 tcThird-PartyControls.pls file that includes the Microsoft Control Support plug-in is installed in the <TestComplete>\Bin\Extensions folder.

Page 6: SmartBear TestComplete NET eBook

6TestCompleteby 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 it’s impossible to list them in this eBook. To put it simply, TestCom-plete 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, Infragis-tics, 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 automat-ed 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 Test-Complete.

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.

Page 7: SmartBear TestComplete NET eBook

7TestCompleteby 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, click-ing tree nodes and so on. Such tests are more robust than coordinate-based 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 ap-plication 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.

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 application’s screens, fill out

Creating and Recording Test for .NET Applications

Page 8: SmartBear TestComplete NET eBook

8TestCompleteby 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 interac-tions with objects in the tested application. For example, in the sample test below you can see that item selection from a combo box is rep-resented 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.

Page 9: SmartBear TestComplete NET eBook

9TestCompleteby 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 cap-tured. 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

Page 10: SmartBear TestComplete NET eBook

10TestCompleteby 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 you’d prefer, you can also create your tests manually using keyword tests. Check out our eBook on how to create keyword tests here.

Conclusion

If you’d 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 haven’t done so already, try a free trial of TestComplete and try creating automated test scripts for your .NET applications today.

Page 11: SmartBear TestComplete NET eBook

About SmartBear Software

More than one million developers, testers and operations profession-als 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 company’s 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