Visual Studio 2010: test-driven development

Source: Internet
Author: User
Tags new features visual studio 2010

Overview

Testing-driven development (test driven Development, TDD), commonly referred to as test-driven design, is a development approach. In this approach, the developer first writes the unit test and then writes the actual system code to ensure that the unit tests are passed smoothly. Unit tests can be thought of as a small specification of system behavior; First, writing unit tests allows developers to write only enough code to pass the test, helping to ensure that the system is compact, lightweight, and clearly focused on meeting identified requirements.

The pace of TDD is "red, green, and refactoring." "Red indicates a visual display of failed tests--the test that was originally written does not pass because you haven't written any code for it yet." Green means writing enough code in the system to ensure that unit tests pass--the Test manager's user interface now uses a green icon to indicate that the test passed smoothly. Refactoring represents the refactoring of code execution to improve its compactness, simplicity, and flexibility. This cycle will be repeated throughout the TDD developer's work.

Note: The purpose of this experiment is not to guide you in using TDD, but to highlight Visual Studio 2010 support for TDD. If you are interested in the TDD approach and its advantages, it is recommended that you first read the following books as a starting point:

Test driven Development in Microsoft. NET Author: James Newkirk and Alexei voronstov,isbn 0735619484

Pragmatic testing in C # with NUnit, 2nd Edition Author: Andy Hunt, Dave Thomas and Matt hargett,isbn 0977616673

The key to TDD is the pace of developers. To achieve an efficient development rhythm, developers need to have the right ideas, as well as the right tools to maximize work speed and reduce conflict.

Visual Studio 2010 introduces enhancements that help reduce development barriers and enable developers to focus on the following tasks: Writing high-quality code. In the next exercise, we will focus on some of the new features that can help developers improve their development pace. VS10 can help developers reduce the number of keystrokes in common tasks, accelerate solution navigation, and use test frameworks instead of MSTest.

To demonstrate its new features, we will implement a stack in "test first", showing how to use tests to drive the design and implementation of the Simplestack class.

Note: In the field of computer science, stacks are an abstract data type and structure, using the principle of LIFO (LIFO).

If you are unfamiliar with the data structure concept of stacks, or if you want to review some of the relevant knowledge, please read more comprehensive Wikipedia articles to get a deeper understanding of this concept.

Goal

In this hands-on experiment, you will learn how to:

Use the new smart tag action to reduce the number of keystrokes and let the IDE automatically generate small snippets of code.

Quickly navigate the code base using Quick Search.

System Requirements

You must have the following content to complete this experiment:

Microsoft Visual Studio Beta 2

. Net Framework 4.0

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.