Dela via


What's New in Developer Quality and Diagnostic Tools in Visual Studio 2012

Visual Studio 2012 includes new features for the developer in the following areas:

Unit tests

Area

New features and supported areas

Test Explorer

The new Visual Studio Test Explorer is designed to support developers and teams who incorporate unit testing in their software development practices. As you run your tests, Test Explorer displays the results in groups of failed, passed, and not run. You can choose Run All to run all your tests, or choose Run... to choose a subset of tests to run.

Unit Test Explorer

See Running Unit Tests with Test Explorer.

Support for third-party unit test framework adapters

Test Explorer can run any unit test framework that has developed an adapter interface for the Explorer. You can download and install many third-party unit test frameworks by using the Visual Studio Extension Manager, or from the Visual Studio Gallery on the MSDN website. Frameworks can also be downloaded from other sites such as the website of the framework.

See How to: Install Third-Party Unit Test Frameworks.

Unit tests for native C++ code

Microsoft.VisualStudio.TestTools.CppUnitTestFramework is a lightweight unit test framework for native code that makes it easy to develop unit tests that run in Test Explorer.

See:

Isolated unit tests

Developers often seek to test individual components in isolation, to make testing more robust and scalable. To accommodate this, Visual Studio Ultimate 2012 now includes Microsoft Fakes. Microsoft Fakes is a lightweight framework for creating delegate-based test stubs and detours in .NET Framework applications. Fakes can be used to detour any .NET method, including non-virtual and static methods in sealed types.

See Isolating Code under Test with Microsoft Fakes.

Unit tests for Windows Store apps

Visual Studio 2012 includes support for unit testing Windows Store apps and includes unit test library templates for Visual C#, Visual Basic and Visual C++.

See Walkthrough: Creating and Running Unit Tests for Windows Store Apps.

Compatibility of unit tests with Visual Studio 2010

Visual Studio 2012 includes test project compatibility with Visual Studio 2010 SP1 test projects. For example, test projects that you created with Visual Studio 2010 SP1 can be opened using Visual Studio 2012 without any upgrade. Therefore, your team can use both Visual Studio 2010 SP1 and Visual Studio 2012 to work with same test project.

Visual Studio 2012 introduces several changes for unit testing, some of which have some impact on compatibility between Visual Studio 2010 and Visual Studio 2012. In addition to the new Test Explorer, these changes include a new unit test project template, which by default excludes a test setting file, to enhance performance. For compatibility, you can still use existing test projects that you created using Visual Studio 2010. However, for performance reasons, we recommend that you remove the test settings file associated with the test project unless you have a specific need for the test settings file. For example, you might choose to retain the test settings file if your unit tests run in a distributed environment, or you need to collect specific diagnostic data. If you have a similar need using the new unit test project template, or coded UI test project template, you can manually add a test settings file to them as well.

Because of these changes, it is important to understand the compatibility issues between previous versions of Visual Studio and Visual Studio 2012.

See Upgrading Unit Tests from Visual Studio 2010 and Upgrading Tests from Earlier Versions of Visual Studio.

IntelliTrace

Area

New features and supported tasks

Collecting IntelliTrace data from applications

Collect IntelliTrace data from ASP.NET Web applications hosted on IIS 7.0 or later and from managed applications (.exe files) running on computers without Visual Studio. Use the IntelliTrace standalone data collector to record diagnostic information in environments where you don't want to change the computer configuration, for example, in deployment and production environments.

Installing the collector doesn't change your computer configuration, and you can uninstall the collector just by deleting its folder.

Learn best practices and guidelines to reduce the performance impact of collecting IntelliTrace data from your application while maximizing the amount of useful data collected.

See Collect IntelliTrace Data Outside Visual Studio with the Standalone Collector.

Reviewing Web requests in IntelliTrace recordings

Analyze and debug events in Web requests submitted to application pools for ASP.NET Web applications hosted on IIS 7.0 or later.

Learn how to use the data in an IntelliTrace recording to help you debug your application.

See Debug Your App with IntelliTrace Log Files.

Code analysis

Area

New features and supported tasks

Code Analysis window

Code analysis warnings now appear on the Code Analysis tool window. The window helps you manage and resolve code analysis warnings.

Filter warning messages

On the window, you can filter messages on the Code Analysis window by keyword, project, and severity.

Code editor highlighting

Selecting a message in the window Code Analysis highlights the line in the source code editor where the message was triggered.

C++ message suppression

On the Code Analysis window, you can insert a pragma into the source code that suppresses a selected warning.

C++ rule sets

Like managed code, you can now specify the analysis rules that you want to apply to code analysis runs by creating or using rule sets.

C++ concurrency warnings

New concurrency warnings help you ensure locking disciplines in multithreaded C/C++ programs. The analyzer detects a number of concurrency bugs, including potential race conditions, lock order inversions, caller/callee locking contract violations, and mismatched synchronization operations.

Performance profiling

Area

New features and supported tasks

One-step profiling

You can now start a profiling session without configuring a performance session.

  • Choose Start Performance Analysis (Keyboard: ALT + F2) on the Debug menu to start profiling the application by using the default values.

  • Choose Start Performance Analysis Paused (Keyboard: CTRL + ALT + F2) on the Debug menu to start the application with the profiler loaded but not collecting data.

Suspend and resume profiling from the profiler document window

To profile only the scenarios that you are interested in, choose:

  • Choose Pause Profiling on the profiler document window to stop collecting data.

  • Choose Resume Profiling to start collecting data.

You can pause and resume profiling as often as needed.

See Also

Concepts

What's New in Modeling Tools for Application Lifecycle Management in Visual Studio 2012

What's New in Visual Studio 2012

Improving Quality with Visual Studio Diagnostic Tools