Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
c02.indd 10c02.indd 10 8/27/2012 10:39:02 AM8/27/2012 10:39:02 AM
PROFESSIONAL APPLICATION LIFECYCLE
MANAGEMENT WITH VISUAL STUDIO® 2012
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxi
CHAPTER 1 Introduction to Application Lifecycle Management
with Visual Studio 2012 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
� PART I TEAM FOUNDATION SERVER
CHAPTER 2 Introduction to Team Foundation Server . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
CHAPTER 3 Team Foundation Version Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
CHAPTER 4 Branching and Merging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
CHAPTER 5 Team Foundation Build . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
CHAPTER 6 Common Team Foundation Server Customizations . . . . . . . . . . . . . . . 125
� PART II BUILDING THE RIGHT SOFTWARE
CHAPTER 7 Introduction to Building the Right Software . . . . . . . . . . . . . . . . . . . . . . 139
CHAPTER 8 Storyboarding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
CHAPTER 9 Capturing Stakeholder Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
� PART III PROJECT MANAGEMENT
CHAPTER 10 Introduction to Project Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
CHAPTER 11 Agile Planning and Tracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
CHAPTER 12 Using Reports, Portals, and Dashboards . . . . . . . . . . . . . . . . . . . . . . . . . 221
� PART IV ARCHITECTURE
CHAPTER 13 Introduction to Software Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
CHAPTER 14 Top-Down Design with Use Case, Activity, Sequence,
Component, and Class Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
CHAPTER 15 Analyzing Applications Using Architecture Explorer
and Dependency Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
CHAPTER 16 Using Layer Diagrams to Model and Enforce
Application Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
ffirs.indd iffirs.indd i 8/31/2012 7:46:11 AM8/31/2012 7:46:11 AM
� PART V SOFTWARE DEVELOPMENT
CHAPTER 17 Introduction to Software Development . . . . . . . . . . . . . . . . . . . . . . . . . . .317
CHAPTER 18 Unit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
CHAPTER 19 Code Analysis, Code Metrics, and Code Clone Analysis . . . . . . . . . . . 351
CHAPTER 20 Profi ling and Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
CHAPTER 21 Debugging with IntelliTrace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
� PART VI TESTING
CHAPTER 22 Introduction to Software Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
CHAPTER 23 Manual Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
CHAPTER 24 Coded User Interface Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
CHAPTER 25 Web Performance and Load Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
CHAPTER 26 Lab Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
ffirs.indd iiffirs.indd ii 8/31/2012 7:46:11 AM8/31/2012 7:46:11 AM
PROFESSIONAL
Application Lifecycle Management
with Visual Studio® 2012
Mickey GoussetBrian Keller
Martin Woodward
ffirs.indd iiiffirs.indd iii 8/31/2012 7:46:12 AM8/31/2012 7:46:12 AM
Professional Application Lifecycle Management with Visual Studio® 2012
Published byJohn Wiley & Sons, Inc.10475 Crosspoint BoulevardIndianapolis, IN 46256www.wiley.com
Copyright © 2012 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-118-31408-1
ISBN: 978-1-118-43937-1 (ebk)
ISBN: 978-1-118-33209-2 (ebk)
ISBN: 978-1-118-33533-8 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifi cally disclaim all warranties, including without limitation warranties of fi tness for a particular purpose. No warranty may be created or extended by sales or pro-motional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the pub-lisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with stan-dard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2012944683
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other coun-tries, and may not be used without written permission. Visual Studio is a registered trademark of Microsoft Corporation. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
ffirs.indd ivffirs.indd iv 8/31/2012 7:46:13 AM8/31/2012 7:46:13 AM
To Amye. I love you.
—MICKEY GOUSSET
To all of the teachers I have had in my life who put up
with my endless stream of questions. Chap Percival,
who taught me to program; Deb Blackwood, who
taught us how to express our creative sides; Steve
Dacey, for making learning fun; Dr. Graham Allgood,
for teaching us about life; Carolyn Niccolai, for
believing in me; Bijli Myers, for helping us to become
adults; Ray and Sue Ellen Keller, who taught me
everything else; and the myriad others who shaped me
into the person I am today.
—BRIAN KELLER
To my father, Roy Woodward.
—MARTIN WOODWARD
ffirs.indd vffirs.indd v 8/31/2012 7:46:13 AM8/31/2012 7:46:13 AM
CREDITS
EXECUTIVE EDITOR
Robert Elliott
PROJECT EDITOR
Tom Dinse
TECHNICAL EDITORS
Steve St. Jean
Ed Blankenship
PRODUCTION EDITOR
Kathleen Wisor
COPY EDITOR
Charlotte Kughen, Wordsmithery LLC
EDITORIAL MANAGER
Mary Beth Wakefi eld
FREELANCER EDITORIAL MANAGER
Rosemarie Graham
ASSOCIATE DIRECTOR OF MARKETING
David Mayhew
MARKETING MANAGER
Ashley Zurcher
BUSINESS MANAGER
Amy Knies
PRODUCTION MANAGER
Tim Tate
VICE PRESIDENT AND EXECUTIVE GROUP
PUBLISHER
Richard Swadley
VICE PRESIDENT AND EXECUTIVE
PUBLISHER
Neil Edde
ASSOCIATE PUBLISHER
Jim Minatel
PROJECT COORDINATOR, COVER
Katie Crocker
PROOFREADERS
James Saturino, Word One
Louise Watson, Word One
INDEXER
Jack Lewis
COVER DESIGNER
Ryan Sneed
COVER IMAGE
© Ben Blankenburg/istockphoto.com
ffirs.indd viffirs.indd vi 8/31/2012 7:46:13 AM8/31/2012 7:46:13 AM
ABOUT THE AUTHORS
MICKEY GOUSSET is a Principal Consultant for Infront Consulting Group, a consult-ing company focused on the Microsoft System Center family of products. He has been a Microsoft Application Lifecycle Management MVP seven years running, and he is co-author of the books Professional Team Foundation Server (Wiley, 2006) and Professional Application Lifecycle Management with Visual Studio 2010 (Wiley,
2010). Gousset runs ALM Rocks! (www.almrocks.com), where he writes about Visual Studio, TFS, and ALM in general. He is also a co-host of the popular Team Foundation Server podcast, Radio TFS (www.radiotfs.com). He has spoken around the world on ALM and System Center topics. When not writing or working with computers, Mickey enjoys a range of hobbies, from playing on Xbox Live (Gamer Tag: HereBDragons) to participating in local community the-ater. Nothing beats his favorite pastime though — sitting on his couch with his lovely wife Amye, and their two Chihuahuas, Lucy and Linus.
BRIAN KELLER is a Senior Technical Evangelist for Microsoft, specializing in Visual Studio and application lifecycle management. He has been with Microsoft since 2002 and has presented at conferences all over the world, including TechEd, Professional Developers Conference (PDC), Build, and MIX. This is his third book for Wiley. He is also a regular personality on MSDN’s Channel 9 website and is co-host of the
popular show, This Week on Channel 9. Outside of work, you can usually fi nd him enjoying the great outdoors while either rock climbing, backpacking, surfi ng or spending time with the love of his life, Elisa.
MARTIN WOODWARD is a Senior Program Manager for Microsoft Visual Studio Team Foundation Server specializing in the Eclipse and Cross-Platform Tooling. Before joining Microsoft, Martin was awarded MVP of the Year for Visual Studio Application Lifecycle Management, and he has spoken about Team Foundation Server at international events. Not only does Martin bring a unique insight into the
inner workings of the product, but he has many years of experience at companies large and small that he is always happy to share. When not working or speaking, you can fi nd Martin at his blog www.woodwardweb.com or on the podcast http://radiotfs.com.
ffirs.indd viiffirs.indd vii 8/31/2012 7:46:13 AM8/31/2012 7:46:13 AM
ACKNOWLEDGMENTS
First off, I want to thank Brian and Martin for taking this journey with me once again. You have been incredible people to work with, and this book couldn’t have been created without you. I’ll write with y’all any day. I’d like to thank everyone at Wiley and Wrox, specifi cally Bob Elliot and Tom Dinse, our editors. This book could not have happened without their help and constant atten-tion to detail. Ed Blankenship and Steven St. Jean, thank you for the excellent technical editing job. You kept me sane. Mr. Gene, thank you for keeping my lawn from looking like a jungle, and Mrs. Kathy, those fudge brownies were just the thing for those all-night writing sessions. Mom, thank you for all your support and help during this process. Finally, a big thank you to Amye, Emma, and Meg for your understanding, love, and support during the late nights and long weekends when I disappeared into my offi ce to write.
—Mickey Gousset
First and foremost, thanks once again to Elisa for believing in me and inspiring me to be the best person I can be. You make every day brighter, I am so lucky to have you in my life! Thanks to the Developer Division at Microsoft for building such a wonderful set of products and technologies for me to write about and evangelize — you make my job easy. Thanks to Ed Blankenship, Steven St. Jean, and Ravi Shanker for your expert guidance on this book. And of course to Mickey, Martin, and the great team at Wiley — I still can’t believe you talked me into writing another book, but it’s been worth it.
—Brian Keller
First, I would like to thank my co-authors, Brian and Mickey, for allowing me to help them in putting this book together — you will struggle to meet two nicer people, and I am lucky to count you both as my friends.
I would like to acknowledge the help, advice and assistance from the people both inside and outside the Visual Studio team at Microsoft. Special thanks go to Jamie Cool, Buck Hodges, Grant Holliday, Matthew Mitrik, Ed Holloway, Peter Provost, and William Bartholomew — without whom my contributions to this book would not have been possible. Thanks also to Rob Caron, Jeff Beehler, Corey Steffen, Jamie Cool, and Brian Harry for encouraging my involvement in the Visual Studio and Eclipse communities over the past eight years.
Finally, I would also like to thank my wife, Catherine, for her encouragement, her support and for sacrifi cing the countless evenings and weekends to enable me to take part in this book. For such an otherwise intelligent and rational woman, I’ve yet to fi gure out why she agreed to marry me in the fi rst place. But ten years on she is still as caring and beautiful as the girl I fell in love with in our fi rst year at university, and she is still way, way out of my league. Luckily she doesn’t read anything I write, so hopefully she’ll never fi nd out.
— Martin Woodward
ffirs.indd viiiffirs.indd viii 8/31/2012 7:46:16 AM8/31/2012 7:46:16 AM
CONTENTS
INTRODUCTION xxi
CHAPTER 1: INTRODUCTION TO APPLICATION LIFECYCLE MANAGEMENT WITH VISUAL STUDIO 2012 1
Application Lifecycle Management 2
Visual Studio 2012 Product Lineup 3
Application Lifecycle Management Challenges 4
Enter Visual Studio 2012 5
Application Lifecycle Management in Action 6
Requirements 6
System Design and Modeling 7
Code Generation 7
Testing 7
Feedback 7
Operations 8
Putting It into Context 8
Summary 8
PART I: TEAM FOUNDATION SERVER
CHAPTER 2: INTRODUCTION TO TEAM FOUNDATION SERVER 11
What Is Team Foundation Server? 12
Acquiring Team Foundation Server 13
Hosted Team Foundation Server 13
On-Premises Installation 15
Team Foundation Server Core Concepts 15
Team Foundation Server 16
Team Project Collection 16
Team Project 17
Team 19
Process Templates 20
Work Item Tracking 22
Version Control 23
ftoc.indd ixftoc.indd ix 8/10/2012 10:55:12 AM8/10/2012 10:55:12 AM
x
CONTENTS
Team Build 26
Accessing Team Foundation Server 26
Accessing Team Foundation Server from Visual Studio 27
Accessing Team Foundation Server through a Web Browser 28
Using Team Foundation Server in Microsoft Excel 29
Using Team Foundation Server in Microsoft Project 29
Command-Line Tools for Team Foundation Server 30
Accessing Team Foundation Server from Eclipse 30
Windows Explorer Integration with Team Foundation Server 31
Access to Team Foundation Server via other Third-Party Integrations 32
What’s New in Team Foundation Server 2012 32
Version Control 32
Web Access 33
Team Explorer 34
Teams 34
Work Item Tracking 34
The Cloud 34
Adopting Team Foundation Server 35
Summary 36
CHAPTER 3: TEAM FOUNDATION VERSION CONTROL 37
Team Foundation Version Control and Visual SourceSafe (VSS) 2005 39
Setting Up Version Control 39
Using the Source Control Explorer 40
Setting Up Your Workspace 42
Getting Existing Code 42
Sharing Projects in Version Control 44
Check-In Pending Changes 46
Checking In an Item 47
Creating and Administering Check-In Policies 51
Viewing History 54
Labeling Files 55
Shelving 56
Workspaces 58
Server Workspaces 61
Local Workspaces 62
Command-Line Tools 63
Summary 63
ftoc.indd xftoc.indd x 8/10/2012 10:55:12 AM8/10/2012 10:55:12 AM
xi
CONTENTS
CHAPTER 4: BRANCHING AND MERGING 65
Branching Demystifi ed 65
Branch 66
Merge 66
Confl ict 66
Branch Relationships 67
Baseless Merge 68
Forward/Reverse Integration 68
Common Branching Strategies 68
No Branching 69
Branch per Release 70
Code-Promotion Branching 71
Feature Branching 72
Implementing Branching Strategies 73
The Scenario 73
The Plan 74
Implementation 75
Dealing with Changesets 81
Tracking Change through Branches 91
Summary 92
CHAPTER 5: TEAM FOUNDATION BUILD 95
Team Foundation Build 96
What’s New in Team Foundation Build 2012 97
Hosted Build Services 98
Drop to Version Control 98
Batched Gated Check-in 98
Changes to the Build Service Protocol 100
Updated Build Report 101
Team Foundation Build Architecture 101
Working with Builds 102
Team Explorer 102
Build Explorer 103
Build Details View 104
Creating a Build Defi nition 105
Queuing a Build 114
Build Notifi cations 115
Team Build Process 117
DefaultTemplate Process 117
Build Process Parameters 119
ftoc.indd xiftoc.indd xi 8/10/2012 10:55:12 AM8/10/2012 10:55:12 AM
xii
CONTENTS
Summary 124
CHAPTER 6: COMMON TEAM FOUNDATION SERVER CUSTOMIZATIONS 125
Object Models 126
Client Object Model 127
Server Object Model 127
Build Process Object Model 127
Simple Object Model Example 127
Java SDK for TFS 129
Customizing Team Foundation Build 129
Creating Custom Build Process Templates 129
Creating Custom Build Workfl ow Activities 131
Customizing Team Foundation Version Control 132
Custom Check-in Policies 132
Team Foundation Server Event Service 133
Customizing Work Item Tracking 134
Modifying Work Item Type Defi nitions 134
Creating Custom Work Item Controls 134
Summary 135
PART II: BUILDING THE RIGHT SOFTWARE
CHAPTER 7: INTRODUCTION TO BUILDING THE RIGHT SOFTWARE 139
Stakeholders 140
Storyboarding 142
Capturing Stakeholder Feedback 142
Work Item Only View 143
Third-Party Requirements Management Solutions 144
TeamSpec 145
TeamLook 145
inteGREAT 147
Summary 148
CHAPTER 8: STORYBOARDING 149
Why Storyboarding? 149
PowerPoint Storyboarding 151
ftoc.indd xiiftoc.indd xii 8/10/2012 10:55:12 AM8/10/2012 10:55:12 AM
xiii
CONTENTS
Storyboard Shapes 152
Layouts 154
Screenshots 154
My Shapes 158
Animations 159
Hyperlinks 160
Storyboard Links 161
Summary 163
CHAPTER 9: CAPTURING STAKEHOLDER FEEDBACK 165
Requesting Feedback 166
Providing Feedback 168
Summary 171
PART III: PROJECT MANAGEMENT
CHAPTER 10: INTRODUCTION TO PROJECT MANAGEMENT 175
Project Management Enhancements in Team Foundation Server 2012 176
Rich Work Item Relationships 176
Agile Planning Tools 177
Test Case Management 178
Feedback Management 179
Enhanced Reporting 179
SharePoint Server Dashboards 180
Work Items 180
Work Item Types 180
Areas and Iterations 182
Process Templates 185
MSF for Agile Software Development 186
MSF for CMMI Process Improvement 187
Visual Studio Scrum 191
Third-Party Process Templates 192
Custom Process Templates 193
Managing Work Items 193
Using Visual Studio 193
Using Microsoft Excel 198
Using Microsoft Project 200
Using Team Web Access 201
Project Server Integration 202
ftoc.indd xiiiftoc.indd xiii 8/10/2012 10:55:12 AM8/10/2012 10:55:12 AM
xiv
CONTENTS
Summary 202
CHAPTER 11: AGILE PLANNING AND TRACKING 205
Defi ning a Team 206
Maintaining Product Backlogs 210
Planning Iterations 212
Tracking Work 215
Customization Options 218
Summary 218
CHAPTER 12: USING REPORTS, PORTALS, AND DASHBOARDS 221
Team Foundation Server Reporting 222
Working with Team Foundation Server Reports 224
Tools to Create Reports 225
Working with Microsoft Excel Reports 226
Working with RDL Reports 236
Summary 237
PART IV: ARCHITECTURE
CHAPTER 13: INTRODUCTION TO SOFTWARE ARCHITECTURE 241
Designing Visually 241
Microsoft’s Modeling Strategy 243
Understanding Model-Driven Development 243
Understanding Domain-Specifi c Languages 244
The “Code Understanding” Experience 245
The Architecture Tools in Visual Studio Ultimate 2012 245
Use Case Diagrams 246
Activity Diagrams 247
Sequence Diagrams 247
Component Diagrams 247
Class Diagrams 249
Layer Diagrams 249
Architecture Explorer 250
What’s New with Architecture Tools in Visual Studio Ultimate 2012 251
Architecture Menu Options 251
Dependency Graph Enhancements 251
Visual Studio Visualization and Modeling SDK 252
ftoc.indd xivftoc.indd xiv 8/10/2012 10:55:12 AM8/10/2012 10:55:12 AM
xv
CONTENTS
Summary 252
CHAPTER 14: TOP-DOWN DESIGN WITH USE CASE, ACTIVITY, SEQUENCE, COMPONENT, AND CLASS DIAGRAMS 253
Use Case Diagrams 254
Creating a Use Case Diagram 254
Use Case Diagram Toolbox 257
Activity Diagrams 259
Creating an Activity Diagram 259
Activity Diagram Toolbox 262
Adding an Activity Diagram to a Use Case Diagram 263
Sequence Diagrams 264
Creating a Sequence Diagram 264
Sequence Diagram Toolbox 266
Component Diagrams 267
Creating a Component Diagram 268
Component Diagram Toolbox 272
Class Diagrams 274
Creating a Class Diagram 274
Class Diagram Toolbox 276
Generating Code from a UML Class Diagram 278
Summary 278
CHAPTER 15: ANALYZING APPLICATIONS USING ARCHITECTURE EXPLORER AND DEPENDENCY GRAPHS 281
Understanding the Code Base 282
Architecture Explorer Basics 283
Understanding the Architecture Explorer Window 284
Architecture Explorer Options 284
Navigating through Architecture Explorer 285
Exploring Options for Namespaces 287
Exploring Options for Classes 289
Exploring Options for Members 290
Dependency Graphs 291
Creating the First Dependency Graph 292
Creating a Dependency Graph without Architecture Explorer 294
Navigating through Your Dependency Graph 294
Dependency Graph Legend 297
Dependency Graph Toolbar 299
ftoc.indd xvftoc.indd xv 8/10/2012 10:55:12 AM8/10/2012 10:55:12 AM
xvi
CONTENTS
Dependency Graph Enhancements in Visual Studio 2012 300
Summary 302
CHAPTER 16: USING LAYER DIAGRAMS TO MODEL AND ENFORCE APPLICATION ARCHITECTURE 303
Creating a Layer Diagram 304
Defi ning Layers on a Layer Diagram 305
Creating a Layer for a Single Artifact 306
Adding Multiple Objects to a Layer Diagram 307
The Layer Explorer 307
Defi ning Dependencies 309
Validating the Layer Diagram 311
Layer Diagrams and the Build Process 313
Summary 313
PART V: SOFTWARE DEVELOPMENT
CHAPTER 17: INTRODUCTION TO SOFTWARE DEVELOPMENT 317
What’s New for Developers in Visual Studio 2012 318
Unit Testing 318
Improved Code Analysis 319
Code Metrics 319
Code Clone Analysis 320
Profi ler 320
Advanced Debugging with IntelliTrace 320
My Work 321
Suspend and Resume 321
Code Review 322
Summary 324
CHAPTER 18: UNIT TESTING 325
Unit Testing Concepts 326
Benefi ts of Unit Testing 326
Writing Eff ective Unit Tests 327
Third-Party Tools 328
Visual Studio Unit Testing 328
Creating Your First Unit Test 329
Managing and Running Unit Tests 331
Debugging Unit Tests 332
Programming with the Unit Test Framework 333
ftoc.indd xviftoc.indd xvi 8/10/2012 10:55:12 AM8/10/2012 10:55:12 AM
xvii
CONTENTS
Initialization and Cleanup of Unit Tests 333
Using the Assert Methods 336
Using the CollectionAssert class 339
Using the StringAssert class 341
Expecting Exceptions 341
Defi ning Custom Unit Test Properties 342
TestContext Class 342
Introduction to Microsoft Fakes 343
Choosing between Stubs and Shims 344
Using Stubs 344
Using Shims 347
Test Adapters 348
Summary 350
CHAPTER 19: CODE ANALYSIS, CODE METRICS, AND CODE CLONE ANALYSIS 351
The Need for Analysis Tools 352
What’s New for Code Analysis in Visual Studio 2012 352
Using Code Analysis 353
Built-in Code Analysis Rules 354
Code Analysis Rule Sets 355
Enabling Code Analysis 356
Executing Code Analysis 358
Working with Rule Violations 359
Using the Command-Line Analysis Tool 363
FxCopCmd Options 363
FxCopCmd Project Files 366
Build Process Code Analysis Integration 367
Creating Code Analysis Rules 367
Code Metrics 367
Code Clone Analysis 370
Finding Code Clones 370
Reviewing the Code Clone Analysis Results 371
How Code Clone Analysis Works 371
Excluding Items from Code Clone Analysis 372
Summary 372
CHAPTER 20: PROFILING AND PERFORMANCE 375
Introduction to Performance Analysis 376
Types of Profi lers 376
ftoc.indd xviiftoc.indd xvii 8/10/2012 10:55:13 AM8/10/2012 10:55:13 AM
xviii
CONTENTS
Visual Studio Profi ling 377
Using the Profi ler 377
Creating a Sample Application 377
Creating a Performance Session 379
Using the Performance Explorer 382
Confi guring a Sampling Session 390
Confi guring an Instrumentation Session 391
Confi guring a .NET Memory Allocation Session 392
Confi guring a Concurrency Profi ling Session 392
Executing a Performance Session 393
Managing Session Reports 393
Reading and Interpreting Session Reports 395
Command-Line Profi ling Utilities 404
Profi ling JavaScript 405
Just My Code 406
Common Profi ling Issues 406
Debugging Symbols 406
Instrumentation and Code Coverage 408
Summary 408
CHAPTER 21: DEBUGGING WITH INTELLITRACE 409
IntelliTrace Basics 410
IntelliTrace — An Example 410
Navigating the IntelliTrace Events View 413
Collecting Method Call Information 413
Collecting Detailed Information 415
Saving Your IntelliTrace Session 417
IntelliTrace Options 421
IntelliTrace in Production 424
Installing the IntelliTrace Stand-Alone Collector 424
Confi guring IntelliTrace PowerShell Commandlets 426
Collecting Execution Information 426
Summary 427
PART VI: TESTING
CHAPTER 22: INTRODUCTION TO SOFTWARE TESTING 431
Role-Based Testing Tools 432
Types of Tests 432
Diagnostic Data Adapters 434
ftoc.indd xviiiftoc.indd xviii 8/10/2012 10:55:13 AM8/10/2012 10:55:13 AM
xix
CONTENTS
Microsoft Test Manager 436
Managing Automated Tests with Visual Studio 437
Test Project Types 437
Test Explorer 438
Code Coverage 440
Using Ordered Tests 441
Test Settings 443
Summary 444
CHAPTER 23: MANUAL TESTING 445
Microsoft Test Manager 446
Using Test Plans 446
Confi guring Test Settings 449
Using Builds 450
Analyzing Impacted Tests 452
Defi ning Test Confi gurations 452
Plan Contents 453
Running Tests and Tracking Results 459
Using Test Runner 460
Supported Technologies for Action Recordings 464
Filing Bugs and Saving Test Results 465
Exploratory Testing 465
Running Automated Tests 470
Summary 471
CHAPTER 24: CODED USER INTERFACE TESTING 473
Creating Coded UI Tests Using the Coded UI Test Builder 474
Setting up the Sample Application 474
Create a Test Project 475
Coded UI Test Builder 476
Generated Code 480
Running Your Test 483
Creating a Data-Driven Test 483
Failing Tests 485
Taking Screenshots 486
UI Map Editor 486
Creating Coded UI Tests Using Action Recordings 488
Supported Technologies 492
Summary 492
ftoc.indd xixftoc.indd xix 8/10/2012 10:55:13 AM8/10/2012 10:55:13 AM
xx
CONTENTS
CHAPTER 25: WEB PERFORMANCE AND LOAD TESTING 493
Web Performance Tests 494
Web Performance Tests versus Coded UI Tests 494
Creating a Sample Web Application 495
Creating Users for the Site 495
Creating and Confi guring Web Tests 497
Recording a Web Performance Test 498
Confi guring Web Performance Test Run Settings 500
Parameterizing the Web Server 501
Test Settings 502
Running a Web Performance Test 504
Observing Test Execution and Results 504
Editing a Web Performance Test 505
Data-Driven Web Performance Tests 509
Coded Web Performance Tests 512
Load Tests 514
Creating and Confi guring Load Tests 515
Editing Load Tests 523
Executing Load Tests 527
Viewing and Interpreting Load Test Results 527
Distributed Load Tests 530
Installing Controllers and Agents 530
Confi guring Controllers 531
Confi guring Agents 532
Running a Distributed Load Test 532
Summary 533
CHAPTER 26: LAB MANAGEMENT 535
Lab Management Infrastructure 536
Golden Images 537
Agents 537
SCVMM Environments 538
Testing with Environments 545
Create New Test Settings 545
Run Manual Tests with an Environment 547
Automated Build-Deploy-Test with Environments 551
Standard Environments 555
Summary 556
INDEX 557
ftoc.indd xxftoc.indd xx 8/10/2012 10:55:13 AM8/10/2012 10:55:13 AM
INTRODUCTION
OVER THE LAST FIFTEEN YEARS, Microsoft’s software development tooling has matured to address not only the needs of a lone programmer, but the needs of an entire software development team. This includes business analysts, project managers, architects, testers, programmers, managers, stakeholders, and even operations personnel who will deploy and maintain applications. This book was written to help teams understand and adopt these tools with the end goal of making them more cohesive, productive, and ultimately to produce higher-quality software on time and on budget.
Whether you already own Visual Studio 2012, or are considering purchasing it, this book will help you evaluate and adopt the right tools for your project. This book considers all of the roles which make up a modern software development project. The tools and technologies which are relevant to each role are examined in detail, including walkthroughs which will help you learn and apply each tool within your team.
WHO IS THIS BOOK FOR
This book primarily targets teams of professionals in the fi eld of commercial or enterprise software development — in other words, intermediate to advanced users. You are likely to fi nd the book use-ful if you are any of the following:
‰ A developer, tester, or architect who wants to learn how the Visual Studio 2012 family of products can help you perform your job
‰ A project manager who must manage a software development project
This book is not designed for the absolute beginner. The focus is on practical application of the tools, code samples, and hands-on scenarios. The book’s organization makes it easy to use as both a step-by-step guide and a reference for modeling, designing, testing, and coordinating enterprise solu-tions at every level.
Visual Studio 2012 is designed for software teams of all sizes. So, whether you have a team of 5 or 2,000 members, this book includes useful information for you related to Visual Studio 2012 and application lifecycle management. Unlike most Wrox books, this book targets all roles in the soft-ware development organization — architects, developers, testers, project leads, and management — not just developers.
flast.indd xxiflast.indd xxi 8/10/2012 10:53:47 AM8/10/2012 10:53:47 AM
xxii
INTRODUCTION
WHAT DOES THIS BOOK COVER
This book includes a complete overview of the application lifecycle management capabilities of Visual Studio 2012. The book is divided into six main parts, based around the different aspects of application lifecycle management:
‰ Part I: Team Foundation Server
‰ Part II: Building the Right Software
‰ Part III: Project Management
‰ Part IV: Architecture
‰ Part V: Software Development
‰ Part VI: Testing
Part I: Team Foundation Server
Because Team Foundation Server is at the heart of Microsoft’s application lifecycle management solution, this book starts with an examination of its capabilities. It discusses the architecture of Team Foundation Server 2012, and then delves into the version control system and some best prac-tices surrounding branching and merging using Team Foundation Server. Finally, there is an in-depth look at the automated build process — Team Foundation Build — followed by some examples of common customizations you can make to Team Foundation Server.
Part II: Building the Right Software
Microsoft’s application lifecycle management offerings in this release of Visual Studio 2012 have expanded to recognize the role that stakeholders play in the software development process. Stakeholders could be future end users of an application, the decision makers who are authoriz-ing payment for an application, lawyers who need to approve applications for regulatory require-ments, or any number of people external to the development team who have a vested interest in the outcome of a particular development project. In this section of the book, you fi nd out about new tooling available to engage with stakeholders early and often throughout the development process. These tools can lead to higher-quality software that is more likely to meet expectations and deliver continuous value while minimizing the amount of rework required.
Part III: Project Management
This section of the book deals with the project and process management functionality of Visual Studio 2012 and Team Foundation Server 2012. This section examines the process templates that ship with the product, and it covers the new web-based Agile planning and tracking capabilities. Part III also discusses the reports that ship with Team Foundation Server. Whether you are practic-ing a lightweight development methodology such as Scrum, or a more formal, rigorous development
flast.indd xxiiflast.indd xxii 8/10/2012 10:53:47 AM8/10/2012 10:53:47 AM
xxiii
INTRODUCTION
process, you will discover that Team Foundation Server will provide you with the tooling you need to manage your projects.
Part IV: Architecture
This section of the book examines the tools available in Visual Studio 2012 for defi ning and ana-lyzing application architecture. After a brief introduction to architecture concepts, the discussion dives into all the new UML tools available, including use case diagrams, activity diagrams, sequence diagrams, class diagrams, and component diagrams. You then learn about the Architecture Explorer and how you can use it to understand the architecture of your application. Finally, this section wraps up with a discussion of layer diagrams.
Part V: Software Development
This section of the book covers topics of most interest to a software developer using Visual Studio 2012. The topics selected for this section of the book are those that pertain most to building either complex applications or working with teams. For example, the section explains how unit testing, static code analysis, profi ling, code coverage, and the new code clone analysis feature are ways to improve your application’s overall quality and maintainability. Part V introduces the new built-in code review capability and how you can use it to collaborate with other developers. You fi nd out how the ability to suspend and resume work in progress makes it easier to deal with interruptions. Finally, the section provides in-depth coverage of debugging applications with IntelliTrace, including a new way of using IntelliTrace for debugging applications in a production environment.
Part VI: Testing
Visual Studio 2012 has numerous tools available for testers to use. The examination starts with a look at the manual testing functionality available in Microsoft Test Manager, as well as the abil-ity to automate user interface tests with coded user interface (UI) tests. Web performance testing and load testing enable you to create tests that can help you ensure that users of your website will experience the best possible performance, even under heavy load. The section concludes with a look the improved lab management capabilities of Visual Studio 2012, which enable you to make use of physical or virtual environments that you can use to automate build-deploy-test workfl ows.
TEAM FOUNDATION SERVER ADMINISTRATORS
If you are the person on your team who is responsible for administering your Team Foundation Server deployment, you should consider purchasing this book as well as its sister book — Professional Team Foundation Server 2012 (Wrox, 2012. ISBN 978-1-118-31409-8) — which dives deeper into setup, confi guration, and administration of Team Foundation Server 2012. You fi nd out more about the possible deployment topologies you can choose from, how to make changes to pro-cess templates, advanced security settings, considerations for disaster recovery and geographically distributed teams, and much more.
flast.indd xxiiiflast.indd xxiii 8/10/2012 10:53:47 AM8/10/2012 10:53:47 AM
xxiv
INTRODUCTION
CONVENTIONS
To help you get the most from the text and keep track of what’s happening, we’ve used a number of conventions throughout the book.
WARNING Boxes like this one hold important, not-to-be forgotten information that is directly relevant to the surrounding text.
NOTE Notes, tips, hints, and tricks are offset and placed in italic like this.
SIDEBAR
Asides to the current discussion are offset like this.
As for styles in the text:
‰ We highlight new terms and important words when we introduce them.
‰ We show keyboard strokes like this: Ctrl+A.
‰ We show fi lenames, URLs, and code within the text like so: persistence.properties.
‰ We present code in two different ways:
We use a monofont type with no highlighting for most code examples.We use boldface to emphasize code that is particularly important in thepresent context.
SOURCE CODE
As you work through the examples in this book, you may choose either to type in all the code man-ually, or to use the source code fi les that accompany the book. All the source code used in this book is available for download at www.wrox.com. When you’re at the site, simply locate the book’s title (either by using the Search box, or by using one of the title lists) and click the Download Code link on the book’s detail page to obtain all the source code for the book.
NOTE Because many books have similar titles, you may fi nd it easiest to search by ISBN; this book’s ISBN is 978-1-118-31408-1.
flast.indd xxivflast.indd xxiv 8/10/2012 10:53:47 AM8/10/2012 10:53:47 AM
xxv
INTRODUCTION
After you download the code, just decompress it with your favorite compression tool. Alternatively, you can go to the main Wrox code download page at www.wrox.com/dynamic/books/download.aspx to see the code available for this book and all other Wrox books.
ERRATA
We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you fi nd an error in one of our books, such as a spelling mistake or a faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and you will be helping us provide even higher quality information.
To fi nd the errata page for this book, go to www.wrox.com and locate the title using the Search box or one of the title lists. Then, on the book details page, click the Book Errata link. On this page, you can view all errata that has been submitted for this book and posted by Wrox editors. A complete book list, including links to each book’s errata, is also available at www.wrox.com/misc-pages/booklist.shtml.
NOTE A complete book list including links to errata is also available at www.wrox.com/misc-pages/booklist.shtml.
If you don’t spot “your” error on the Book Errata page, go to www.wrox.com/contact/techsupport.shtml and complete the form to alert us to the error you have found. We’ll check the information and, if appropriate, post a message to the book’s errata page and fi x the problem in sub-sequent editions of the book.
P2P.WROX.COM
For author and peer discussion, join the P2P forums at http://p2p.wrox.com. The forums are a web-based system for you to post messages relating to Wrox books and related technologies, and to interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.
At http://p2p.wrox.com, you can fi nd several different forums that will help you not only as you read the book, but also as you develop your own applications. To join the forums, just follow these steps:
1. Go to http://p2p.wrox.com and click the Register link.
2. Read the terms of use and click Agree.
flast.indd xxvflast.indd xxv 8/10/2012 10:53:48 AM8/10/2012 10:53:48 AM
xxvi
INTRODUCTION
3. Complete the required information to join, as well as any optional information you want to provide, and click Submit.
4. You will receive an e-mail message with information describing how to verify you account and complete the joining process.
You can read messages in the forums without joining P2P, but in order to post your own messages, you must join.
After you join, you can post new messages and respond to messages other users post. You can read messages at any time on the Web. If you would like to have new messages from a particular forum emailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.
For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works, as well as many common questions specifi c to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.
flast.indd xxviflast.indd xxvi 8/10/2012 10:53:48 AM8/10/2012 10:53:48 AM
1Introduction to Application Lifecycle Management with Visual Studio 2012
WHAT’S IN THIS CHAPTER?
‰ Defi ning application lifecycle management
‰ Learning about the Visual Studio 2012 product family
‰ Understanding the structure of this book
In June of 1999, Microsoft started to re-evaluate how Visual Studio was being used as part of the software development process. Microsoft was continuing to serve the needs of an individ-ual programmer through the highly productive “code-focused rapid-application-development” features of Visual Studio, but wasn’t doing much to help programmers work together as a team. And what about software architects—how should they be working with the program-ming team? And testers? Project managers?
Many teams had begun to set up their own solutions using a mixture of third-party, in-house, and vendor-provided tools to address such challenges as version control, bug tracking, and team communications. But this mishmash of tools can be tricky to set up and maintain, and even more diffi cult to integrate. Microsoft sought to address this challenge by providing an integrated set of tools designed to address the needs of the entire software development team. Thus, Visual Studio Team System was born, and was fi rst released with the Visual Studio 2005 product line.
At the heart of Team System, Team Foundation Server was created to provide a hub for all members of the development team to collaborate. Team Foundation Server is uniquely posi-tioned from its predecessors across the industry by being the fi rst tool of its kind built from the ground up to provide an integrated solution for many capabilities which had historically been offered as standalone tools. Team Foundation Server provides a unifi ed solution for stor-ing source code (along with a history of changes), work item tracking (which can include bugs,
c01.indd 1c01.indd 1 8/27/2012 9:53:58 AM8/27/2012 9:53:58 AM
2 x CHAPTER 1 INTRODUCTION TO APPLICATION LIFECYCLE MANAGEMENT WITH VISUAL STUDIO 2012
requirements, and so on), and automated builds. By providing a single solution with all of these capabilities, Microsoft delivered the ability to link all these artifacts for end-to-end traceability, reporting, process enforcement, and project management.
Team System also included “client” functionality, which surfaced in the various editions of Visual Studio development tools. Visual Studio seamlessly integrated with Team Foundation Server, but much of this tooling could also be used independently or with third-party source control solutions. Visual Studio Team System also introduced role-specifi c tooling that lived outside of the core Visual Studio development environment by recognizing that team members such as project managers are oftentimes more comfortable using tools such as Excel or Project, both of which could be used to manage and track work that lived in Team Foundation Server.
Team System was built from a foundation of tools and technologies that Microsoft had been using internally for many years to build some of the most complex software projects ever undertaken. Team System appealed not only to programmers, but to all members of the development team—architects, application developers, database developers, and project managers.
Three years later, Visual Studio 2008 Team System evolved from the previous version to include even more tools and functionality for all members of the project team to use. Two years after that, Visual Studio 2010 added even more functionality, including an entirely new set of tools for general-ist testers (also referred to as manual testers), bringing a new audience of prospective users into the same set of tooling used by the rest of the team.
APPLICATION LIFECYCLE MANAGEMENT
Along with the release of Visual Studio 2010, Microsoft also stopped using the sub-brand “Team System” to describe these capabilities. Instead, Microsoft started referring to these tools as the application lifecycle management capabilities of Visual Studio. Application lifecycle management is a term that has gained momentum in the development industry to describe the way an application is managed from its conception, through its creation and deployment, to its eventual retirement.
It is important to note that application lifecycle management is a more comprehensive concept than its more popular predecessor, software development lifecycle (SDLC). SDLC is primarily focused on the core coding activities that comprise the creation of an application’s life, beginning with a requirement for an application and ending when that application is built and delivered. Application lifecycle management recognizes that requirements aren’t simply born out of thin air. They evolve based on business needs, or ideas for new opportunities, and stakeholders who are considered external to the development team may still play a role during the development of an application in helping to refi ne requirements and provide feedback on implementations. Application lifecycle management also recognizes that a development team’s job isn’t done the moment they hand off a “fi nished” application. The development team will likely be called upon to help troubleshoot the application when things go wrong in the production environment, or to create subsequent ver-sions of the application based on feedback from users or analytics from the operations team. Visual Studio itself has matured over time to grow from being a tool targeted squarely at programmers
c01.indd 2c01.indd 2 8/27/2012 9:54:03 AM8/27/2012 9:54:03 AM