Book Image

Software Testing using Visual Studio 2010

By : Satheesh Kumar. N, S. Subashni
Book Image

Software Testing using Visual Studio 2010

By: Satheesh Kumar. N, S. Subashni

Overview of this book

<p>When testing your applications on the Microsoft platform, Visual Studio 2010 offers you a range of powerful tools for different types of testing. This Microsoft product makes the testing process easier and faster.<br /><br />A concise guide that will lead you through the amazing range of features offered by Visual Studio 2010 to test your software applications before going live. It is packed with simple but interesting examples to make you comfortable with Visual Studio 2010 testing environment. The book introduces you to the main types of testing available in Visual Studio for both desktop and web applications, and then walks you through deploying, running, and interpreting the results of tests.<br /><br />Visual Studio 2010 is the new version of Microsoft's software development product, and includes lots of new features for developing and testing software applications. In collaboration with Team Foundation Server, it provides supporting tools for the management of the entire application life cycle, including development and testing.</p> <p>This book is more focused on testing features and the supporting tools provided by Visual Studio 2010 for testing the applications.</p> <p>The book begins by explaining different types of tests as part of the software development cycle, and then dives deep into providing an overview of each type of application testing using Visual Studio 2010 features. Along the way you will also learn in detail about creating and maintaining the test cases and associating the test cases with requirements using the Test Manager Tool.<br /><br />Each chapter in the book concentrates on explaining each test type using the features and tools provided by Visual Studio 2010. You will be guided in using these features with real world examples with step by step explanations.</p>
Table of Contents (19 chapters)
Software Testing using Visual Studio 2010
Credits
About the Authors
About the Reviewers
Preface
11
Working with Test Results
Index

Preface

The Microsoft Visual Studio 2010 suite contains several features that support the needs of developers, testers, managers, and architects to simplify the development process. Visual Studio provides different editions of the products such as Professional, Premium, and Ultimate with different sets of tools. Visual Studio 2010 is tightly integrated with Team Foundation Server 2010, which is the central repository system that provides version control, process guidance and templates, automated build, automated test, bug tracking, work item tracking, reporting, and supporting of the Lab Center and Test Center.

This book helps developers to get familiarized with the Visual Studio tools and techniques to create automated unit tests, using automated user interface testing, code analysis, and profiling to find out the performance and quality of the code. Testers benefit from learning more about the usage of Test Center and Lab Center, which are very new tools in Visual Studio 2010. This books also covers different types of testing such as Web Performance Test, Load Test, Executing the Manual Test cases, and recording the user actions, rerunning the tests using the recording, Test case execution, and capturing the defects and integrating the requirements, test cases, test results, and defects together is also covered in detail. Testers also get a high level overview on using Lab Center for creating virtual environments for testing multiple users and multiple location scenarios.

Visual Studio provides user interface tools such as Test List Editor, Test View, Test Results, Test Configuration user interfaces, Test Center, and Lab Center to easily manage and maintain multiple test cases, and Test Results in integration with Team Foundation Server. This book provides detailed information on all of the tools used for testing the application during the development and testing phase of the project life cycle.

What this book covers

Chapter 1, Visual Studio 2010 Test Types, provides an overview of different types of testing which help with testing software applications throughout different phases of software development. This chapter also introduces the tools and techniques in Visual Studio 2010 for different testing types.

Chapter 2, Test Plan, Test Suite, and Manual Testing, explains the steps involved in creating the Test Plan, Test cases, and Test Suite used for manual testing. Creating the manual test by recording the user action and running the test with data inputs is also covered as part of this chapter.

Chapter 3, Automated Tests, provides the step-by-step approach to create a Coded UI test from the user action recording. It also explains the steps to provide data to the coded UI test and custom rules for the test.

Chapter 4, Unit Testing, explains the detailed steps involved in creating the unit test classes and methods for the code. It also explains different types of assert methods and parameters for testing the code. Passing a data source with a set of data and testing the code is also explained in detail.

Chapter 5, Web Performance Testing, explains the basic method of web testing using VSTS and features such as adding rules and parameterization of dynamic variables. Microsoft Visual Studio 2010 ultimately provides many new features for the Web Performance Testing such as adding new APIs to the test results, web performance test results in a separate file, looping and branching, new validation and extraction rules, and many more.

Chapter 6, Advanced Web Testing, generates the code for the testing scenario explained in Chapter 5 using the Generate Code option. This is very useful for customizing tests using the code.

Chapter 7, Load Testing, can simulate the number of users, network bandwidth, a combination of different web browsers, and different configurations. In the case of web applications it is always necessary to test the application with different sets of users and browsers to simulate multiple requests to the server. This chapter explains the steps involved in simulating the real world scenario and testing the application.

Chapter 8, Ordered and Generic Tests, explains both test types, the ones used for testing the existing third party tool or programs which can also be run using the command line, in detail. Visual Studio 2010 provides a feature called ordered test to group all or some of these tests and then execute the tests in the same order. The main advantage of creating the ordered test is to execute multiple tests in an order based on the dependencies. Generic tests are just like any other tests except that they are used for testing the existing third-party tool or program which can also be run using the command line.

Chapter 9, Managing and Configuring a Test, provides different tools that support easy ways of managing and grouping the tests. Using these tools, we can enable and disable the tests or select them to run, filter the tests from the list of all the tests created for the project, and set the properties for the individual test. The Test List Editor is the main interface provided by Visual Studio for managing all tests under the solution. This chapter explains the details of the test settings file and the tools used for managing the tests.

Chapter 10, Command Line, explains the command line tool, MSTest, used for running the test with different options and then collecting the output and publishing it to the Team Project.

Chapter 11, Working with Test Results, helps us to verify whether the test methods return the expected results but also to analyze the application quality and to verify the build. We can add the test as part of the Team Foundation Server automated build so that we can verify the build and make sure the latest code is checked in to the source control, and is working as expected. This chapter explains the process of running the tests and publishing the test results to the Team project.

Chapter 12, Reporting, explains the details of accessing the publishing and reporting test results in a specific format. Accessing different types of testing reports and creating new test reports are also explained in this chapter

Chapter 13, Test and Lab Center, is useful for creating the Test Plans and adding Test Cases to the plans. We can also associate the requirements to the test plans. The Lab Center helps us to create and configure different virtual/physical environments for the test runs, test settings such as defining the roles and configuring the data and diagnostics information for the selected roles, configuring the Test Controllers required for the test, and configure the test library to store the environment information.

What you need for this book

This book requires a basic knowledge of any of the versions of Visual Studio and Team Foundation Server. The reader must be familiar with Visual Studio IDE and integration with Team Foundation Server and have a basic knowledge of C#. To generate coded tests and customize the code, the testers should have a basic knowledge of C#. The following tools are required in order to try the samples in all of the chapters of this book:

  • Visual Studio 2010 Ultimate

  • SQL Server 2008

  • Team Foundation Server 2010

  • Microsoft Office (Microsoft Word and Microsoft Excel)

  • SQL Server Analysis and Reporting Services (for customizing reports)

Who this book is for

If you are a developer, a software tester, or an architect who wishes to master the amazing range of features offered by Visual Studio 2010 for testing your software applications before going live—then this book is for you.

This book assumes that you have a basic knowledge of testing software applications and have good work experience of using Visual Studio IDE.

Conventions

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 are shown as follows: "Now assign a name for the new test project. Let us name it as AddNumbersTestProject."

A block of code is set as follows:

public double CalculateTotalPrice(double quantity)
{
  double totalPrice;
  double unitPrice;
  // Todo get unit price. For test let us hardcode it 
  unitPrice = 16.0;
  totalPrice = unitPrice * quantity;
  return totalPrice;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

get
{
	return testContextInstance;
}

Any command-line input or output is written as follows:

cd c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE

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:"After selecting the required counters, click on Finish to complete the wizard and start the generation of the actual report".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

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 , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

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.

Customer support

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.

Tip

Downloading the example code for this book

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.

Errata

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/support, 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

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 with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.