DEV307: Delving into Visual Studio 2005 Team Edition

Download Report

Transcript DEV307: Delving into Visual Studio 2005 Team Edition

Delving into
Visual Studio 2005
Team Edition for
Software Developers
Brian A. Randell
Senior Consultant
MCW Technologies
About Brian
Senior Consultant with
MCW Technologies, LLC
Contact me via my blog or e-mail:
http://www.mcwtech.com/cs/blogs/brianr/
[email protected]
Visual Basic MVP
Author of Visual Studio 2005
Team Edition for Database Professionals
Hands-on Labs
Manager and co-author of
Microsoft SQL Server 2005
Hands-on Labs
Author of Core Team System training course
Co-author of Effective Visual Basic
Something Wicked This
Way Comes …
… And It’s Your Code!
Agenda
Why Quality Matters to You
Unit Testing
Code Coverage
Static Analysis
Dynamic Analysis
Code Profiling
Testing vs. Debugging
“Testing is a means of detecting errors”
“Debugging is a means of diagnosing and
correcting the root causes of errors that have
already been detected”
Steve McConnell, Code Complete 2nd Ed., p500
Projects and Testing
Often an expensive afterthought
Strategies for minimizing impact
30
25
20
Relative Cost
To Fix Bugs...
15
10
5
Why Quality Matters to You
Defect detection rates rarely rise above 75%
when using a single technique
The techniques average about 40%
If you’re trying to achieve high defect-rate
detection, you need to use a combination of
techniques
The bottom line:
You can’t just rely upon your test team—quality
begins with you!
Steve McConnell, Code Complete 2nd Ed., p470
Tools Can Help
Building software is hard—good tools can help
Visual Studio 2005 Professional is the foundation
for developers who want to write solid, highquality code
Visual Studio 2005 Team Edition for Software
Developers (VSTESD) brings testing to the
developer as an integrated feature—not an
afterthought
Visual Studio Team System
New!
Visual Studio Team Suite
MSF Process and Guidance
Visual
Studio
Team
Explorer
Software
Architects
Software
Developers
Software
Testers
Database
Professionals
Application
Modeling
Code Analysis
Performance
Testing
Infrastructure and
Deployment
Modeling
Performance
Tuning
Manual Testing
Database
Change
Management
Database Testing
Test Case
Management
Database
Deployment
Security Analysis
Unit Testing
Code Coverage
Class
Modeling
Visio and UML Modeling
Visual Studio Professional
Edition
Load Test Agent
Visual Studio Team Foundation Server
Change Management
Reporting
Integration Services
Work Item Tracking
Project Site
Project Management
Visual
Studio
Industry
Partners
Unit Testing
The process of running repeatable,
programmatic tests, generally written by a
developer, against some code (a class, set of
methods, individual method, etc)
Formalizes the process of test rigs
Whole “lifestyle” dedicated to it—Test Driven
Development (TDD)
Unit Testing in VSTESD
Explicit Test Project Type
Can be created by you or by Visual Studio
Test artifacts that support code can be C#, Visual
Basic, or Managed C++
Right-click support for
Test project and member generation from most project
types (Class libraries, Windows Forms, etc.)
Member generation from test projects
Can run tests against any managed target and
most unmanaged targets (just might require code
and effort on your part)
Unit Testing Runtime
Tests can be run inside or outside of Visual
Studio
VSTestHost.exe spawned when running via the
debugger
MSTest.exe supports command-line integration
Unit Testing and C++
Only supports “production code”
Unmanaged—callable from a static library, an .obj file,
or a DLL entry point.
Only traditional native binding mechanisms work
Mixed—project that uses the /clr compiler option.
As long as it’s not an EXE any callable method in your code
can be called and tested.
Safe or Pure--any callable assembly method can be
called and tested
EXE or DLL
Right-click generation only supported from
projects using /clr:safe compiler option
Team Foundation Server Integration
Work items—bugs, tasks, etc.—can be created
from Test Results window
Test results can be published to TFS
Tests can be run as part of nightly or integration
builds via Team Build
Code Coverage
Code Coverage allows you to see what code is
being executed, neé covered, and what code is
not
This is accomplished by instrumenting the
assembly
Support for both managed and native code
What’s going on inside?
New assembly is generated
Two types are added in custom namespace
Methods are injected with calls to internally
generated class
A minimum of two calls are added
One to register
one to track entry
Additional calls based upon coding constructs like
conditionals, loops, etc.
External dependency on VSCover80.dll
Code Coverage in VSTESD
Instrumentation of assemblies does not occur
until tests are run with Code Coverage enabled
Done on a per assembly basis
Programmatic access to coverage data possible
via managed interfaces
Full command-line support via three tools:
Instrumentation—vsinstr.exe
Monitoring—VSPerfMon.exe
Control—VSPerfCmd.exe
TFS Integration
Work items—bugs, tasks, etc.—can be created
from Test Results window linking to test with
code coverage
Code coverage data can be included with test
results that are published to TFS
Code coverage can be run with tests as part of a
nightly or integration build via Team Build
Things to watch out for
Cannot debug assemblies that have Code
Coverage enabled
It is possible to not get 100% code coverage
My in Visual Basic projects
Certain conditional or looping operations
Static Code Analysis
Support for both managed and unmanaged code
Evolution of FxCop for managed developers
Post compilation analysis of compiled IL
PREfast for C++ developers
Analysis done during build process
Static Code Analysis in VSTESD
Managed projects have a new property page
labeled Code Analysis
Check-box to turn it on; 11 categories of rules
Violation of rules can trigger warning or error
Can decorate code with attributes to suppress a
warning (right-click support from Error List window)
Use FxCopCmd.exe at the command line
C++ projects done via Code Analysis node under
Configuration Properties
Can use /analyze switch at command line
TFS Integration
Work items—bugs, tasks, etc.—can be created
from Error List window
Source Code Control Policy can be used to
enforce code analysis before check-in
Support for migration of policy from server to solutions
on client machines
Support for both managed and C++ projects
Code analysis can be run as part of nightly or
integration builds via Team Build
Things to watch out for
Customization of rules not possible for C++ in
this release
Customization of rules for managed code is
discouraged by product team
It’s not officially supported or documented
Issues with policy migration to new Visual Studio
2005 Web Project types
Dynamic Code Analysis
Application Verifier catches heap, handle and
lock errors in native applications
Used with C++ projects during runtime only
Available via Debug | Start With Application
Verifier
Things to watch out for
You must be an administrator on the system that
you are using in order to run Application Verifier
Application Verifier only runs on Windows XP
and Windows Server 2003
I’ve not tried it on Vista or Longhorn server yet
Code Profiling
Support two modes of application profiling for
both managed and native application
Sampling captures runtime data on a periodic
basis without modification of the application
Generally best for isolating hot spots
Instrumentation modifies binaries by inserting
probes and provides very granular information
Generally used after a hot spot is found and you want
to dig deeper
Code Profiling in VSTESD
Can be started from Visual Studio via Tools |
Performance Tools
Can also generate performance session from a
test via the Test Results window
However doesn’t work correctly for C++ projects
Rich Command Line Support
VsPerfCLREnv.exe to setup and cleanup
VsPerfCmd.exe to start and stop
VsPerfMon.exe for advanced profiling
vsinstr.exe to instrument your assemblies
VsPerfReport.exe to analyze reports
TFS Integration
Not much
No right-click support for SCC or Work Items
Performance window is its own window is its own
window
Things to watch out for
Make sure you setup a symbol server or hook up
to Microsoft’s to see external member names
Profiling can generate TONS of data
Make sure you have lots of disk space
Can’t profile in sampling mode under Virtual PC
Only supports .NET 2.0 managed applications
Does not support 64-bit applications
Add a post-compilation event to re-sign
assemblies if your profiling code with strong
names
3rd Party Tools
SPI Dynamics
Comprehensive Find and Fix Approach: DevInspect and
SecureObjects accelerate the construction and delivery of secure
Web applications by identifying vulnerabilities and fixing insecure
source code within Visual Studio 2005
DevInspect and SecureObjects leverage Visual Studio 2005
Team System’s source control system and code check-in policies
to prevent developers from checking insecure source code.
For more information:
http://www.spidynamics.com/products/devinspect/index.html
http://www.spidynamics.com/products/devinspect/datasheet.html
VSTS Breakout Sessions
DEV311 - Delving into Visual Studio 2005 Team Edition for Software
Testers
6/12/2006 5:00PM-6:15PM 104 ABC
DEV217 - Introducing Visual Studio 2005 Team Edition for Database
Professionals
6/13/2006 10:15AM-11:30AM 104 ABC
DAT312 - Managing and Deploying Your SQL Server Schemas with
Visual Studio Team Edition for Database Professionals
6/13/2006 1:00PM-2:15PM 156 ABC
DAT320 - Testing and Refactoring Your Database with Visual Studio
Team Edition for Database Professionals
6/14/2006 8:30AM-9:45AM 160 ABC
DEV327 - Visual Studio 2005 Team Foundation Server (Part 1):
Applying Version Control, Work Item Tracking and Team Build to
Your Software Development Project
6/14/2006 10:15AM-11:30AM 160 ABC
VSTS Breakout Sessions
DEV429 - Visual Studio 2005 Team Foundation Server (Part 2):
Developing Custom Process Templates, Work Item Types and
Policies
6/14/2006 2:00PM-3:15PM 160 ABC
DEV233 - Visual Studio 2005 Team Foundation Server: Using
Metrics to Manage and Troubleshoot Your Projects
6/14/2006 5:30PM-6:45PM 153 ABC
DEV237 - Visual Studio 2005 Team Foundation Server: Step-by-Step
Migration and Adoption Planning
6/15/2006 9:45AM-11:00AM 104 ABC
DEV439- Visual Studio 2005 Team System and Microsoft Solution
Framework: Implementing an Agile or CMMI Process
6/15/2006 1:00PM-2:15PM 156 ABC
DAT433
Under the Hood of Visual Studio Team Edition for
Database Professionals 6/15/2006
1:00PM-2:15PM 160 ABC
VSTS HOL / TCL
Hands on Labs
DEV005 Streamlining your Development Process with Visual
Studio 2005 Team System
DEV008 Take a Tour of Visual Studio 2005 Team System for
Database Professionals
Chalktalks
Building Quality In: Visual Studio Team System and Continuous
Integrated Testing
DEV TLC Theatre 6/14/2006 8:30AM-9:45AM
Teamlook and TeamSpec in Context Modeling that Supports
Visual Studio 2005
DEV TLC Theatre 6/14/2006 5:30PM-6:45PM
Modeling that Supports Visual Studio 2005
DEV TLC Theatre 6/14/2006 5:30PM-6:45PM
Visual Studio Team Edition for Database Professionals: Overview
DEV TLC Theatre 6/15/2006 9:45AM-11:00AM
Code Generation and Model Execution from DSL Tools
DEV TLC Theatre 6/15/2006 2:45PM-4:00PM
Summary
Quality is everyone’s job
Use the tools when it makes sense
Questions?
I’m here all week or contact me via my blog or e-mail:
http://www.mcwtech.com/cs/blogs/brianr/
[email protected]
Resources
Technical Chats and Webcasts
http://www.microsoft.com/communities/chats/default.mspx
http://www.microsoft.com/usa/webcasts/default.asp
Microsoft Learning and Certification
http://www.microsoft.com/learning/default.mspx
MSDN & TechNet
http://microsoft.com/msdn
http://microsoft.com/technet
Virtual Labs
http://www.microsoft.com/technet/traincert/virtuallab/rms.mspx
Newsgroups
http://communities2.microsoft.com/
communities/newsgroups/en-us/default.aspx
Technical Community Sites
http://www.microsoft.com/communities/default.mspx
User Groups
http://www.microsoft.com/communities/usergroups/default.mspx
Fill out a session
evaluation on
CommNet for
a chance to
Win an XBOX 360!
© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not
be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.