DEV302 - Visual Studio Team System Building Robust and Reliable Software Eric Lee Program Manager Microsoft Corporation
Development Teams Infrastructure Architect Solution Architect Project Manager Developer Tester End User
A day in the life … Write Code Write Unit Tests Review Work Run Code Analysis Operations! Developer
A day in the life … Write Code Write Unit Tests Review Work Run Code Analysis Operations! Developer Microsoft Research Internal Tools
Visual Studio Team System Change ManagementWork Item TrackingReportingProject Site Visual Studio Team Foundation Integration ServicesProject Management Process and Architecture Guidance Dynamic Code Analyzer Visual Studio Team Architect Static Code AnalyzerCode ProfilerUnit TestingCode CoverageVisio and UML ModelingTeam Foundation ClientVS ProClass ModelingLoad TestingManual TestingTest Case ManagementApplication ModelingLogical Infra. ModelingDeployment Modeling Visual Studio Team Developer Visual Studio Team Test Visual Studio Industry Partners
Visual Studio Team System Change ManagementWork Item TrackingReportingProject Site Visual Studio Team Foundation Integration ServicesProject Management Process and Architecture Guidance Visual Studio Industry Partners Dynamic Code Analyzer Visual Studio Team Architect Static Code AnalyzerCode ProfilerUnit TestingCode CoverageVisio and UML ModelingTeam Foundation ClientVS ProClass ModelingLoad TestingManual TestingTest Case ManagementApplication ModelingLogical Infra. ModelingDeployment Modeling Visual Studio Team Developer Visual Studio Team Test Dynamic Code AnalyzerStatic Code Analyzer Code Profiler Unit TestingCode Coverage
A day in the life … Write Code Write Unit Tests Review Work Run Code Analysis Operations! Developer
Test Driven Development Jim Newkirk
TDD Tenants Never write a single line of code unless you have a failing unit test Eliminate Duplication
Test List Task Based 4-8 hour duration minute exercise at beginning Brainstorm a list of unit tests Do not get hung up on completeness, you can always add more later Describes completion requirements
Red/Green/Refactor Write a test for new capability Start Compile Fix compile errors Run the test And see it fail Write the code Run the test And see it pass Refactor as needed
Test Driven Development (TDD)
Recap Integrate testing into the development process Testability is a primary motivation during development The Visual Studio Team System provides an ideal environment for doing Test Driven Development
A day in the life … Write Code Write Unit Tests Review Work Run Code Analysis Operations! Developer
A day in the life … Write Code Write Unit Tests Review Work Run Code Analysis Operations! Developer
Code Coverage How effective are my unit tests? Am I done testing? Am I executing all the relevant parts of my application?
Code Coverage void PurchaseItem(int itemID) { if (itemID == 0) { throw new Exception(); } else { ProcessOrder(itemID); } UnitTest() { PurchaseItem(1); }
{ if (itemID == 0) { throw new Exception(); } else { ProcessOrder(itemID); } Code Coverage UnitTest() { PurchaseItem(1); } void PurchaseItem(int itemID)
{ throw new Exception(); } else { ProcessOrder(itemID); } void PurchaseItem(int itemID) if (itemID == 0) Code Coverage UnitTest() { PurchaseItem(1); }
{ throw new Exception(); } { ProcessOrder(itemID); } void PurchaseItem(int itemID) if (itemID == 0) Code Coverage UnitTest() { PurchaseItem(1); } else
{ throw new Exception(); } { ProcessOrder(itemID); } void PurchaseItem(int itemID) if (itemID == 0) Code Coverage UnitTest() { PurchaseItem(1); } else ProcessOrder(itemID);
{ throw new Exception(); } { ProcessOrder(itemID); } void PurchaseItem(int itemID) if (itemID == 0) Code Coverage UnitTest() { PurchaseItem(1); } else ProcessOrder(itemID); throw new Exception();
Visual Studio Team System Code Coverage
Predictability Effective testing Drives up quality Catch ‘blind spots’ right in Visual Studio
A day in the life … Write Code Write Unit Tests Review Work Run Code Analysis Operations! Developer
A day in the life … Write Code Write Unit Tests Review Work Run Code Analysis Operations! Developer
Code Analysis String path = “”; for (int i = 0; i < 100; i++) { path += “Value”; } return path;.EXE Intermediate Representation
Code Analysis String path = “”; for (int i = 0; i < 100; i++) { path += “Value”; } return path;.EXE Intermediate Representation Static Code Analysis
Code Analysis String path = “”; for (int i = 0; i < 100; i++) { path += “Value”; } return path;.EXE Intermediate Representation Application Verifier/Code Profiling
Static Code Analysis Bad code is syntactically correct Different naming conventions Manual code reviews can be inconsistent
Static Code Analysis Defects Security Performance Design Policy String path = “”; for (int i = 0; i < 100; i++) { path += “Value”; } return path;
Static Code Analysis Defects Security Performance Design Policy Intermediate Representation
Static Code Analysis DefectsSecurity Performance DesignPolicy Intermediate Representation
Static Code Analysis Don’t call String.Concat inside of loops Prefer StringBuilder String path = “”; for (int i = 0; i < 100; i++) { path += “Value”; } return path; for (int i = 0; i < 100; i++) { path.Append(Value”); } return path.ToString();
Visual Studio Team System Static Code Analysis
Catch bugs at their source Capable of complex analysis Leverages lessons learned Turn habit into ‘rules’
Application Verifier ‘Works on my machine’ ‘It used to work’ Runtime issues
Application Verifier Adventure Works DefectsSecurityLogoApp Compat
Visual Studio Team System Application Verifier
Catch critical errors at runtime Handle/Heap verification issues ‘Breaks’ into Visual Studio Team System at the source of the problem
Code Profiler Constant hardware updates Poor end-user experience Low throughput of transactions
Sampling Adventure Works Login() 1 Browse()1 Login() 1 Browse()2 Login() 1 Browse()3 Login() 1 Browse()4 Login() 1 Browse()5 Login() 1 Browse()5 Details()1 Login() 1 Browse()5 Details()1 CheckOut()1 Login() 1 Browse()5 Details()1 CheckOut()1 Logout()1
Sampling Adventure Works Login() 1 Browse()5 Details()1 CheckOut()1 Logout()1 Browse()5
Instrumentation Adventure Works
Instrumentation Basic Blocks Adventure Works
Instrumentation Basic Blocks Adventure Works Timing Probes
Instrumentation Adventure Works Browse() 10 ms Init() 20 ms Browse() 10 ms Init() 20 ms String.Concat() 5060 ms Browse() 10 ms Init() 20 ms String.Concat() 5060 ms Cleanup() 5 ms
Instrumentation Adventure Works Browse() 10 ms Init() 20 ms String.Concat() 5060 ms Cleanup() 5 ms String.Concat() 5060 ms
Visual Studio Team System Code Profiler
Do more with less Great customer experience
A day in the life … Write Code Write Unit Tests Review Work Run Code Analysis Operations! Developer
A day in the life … Write Code Write Unit Tests Review Work Run Code Analysis Operations! Developer
Avicode MOM Configuration Pack Wizard
Visual Studio Team System Change ManagementWork Item TrackingReportingProject Site Visual Studio Team Foundation Integration ServicesProject Management Process and Architecture Guidance Visual Studio Industry Partners Dynamic Code Analyzer Visual Studio Team Architect Static Code AnalyzerCode ProfilerUnit TestingCode CoverageVisio and UML ModelingTeam Foundation ClientVS ProClass ModelingLoad TestingManual TestingTest Case ManagementApplication ModelingLogical Infra. ModelingDeployment Modeling Visual Studio Team Developer Visual Studio Team Test Dynamic Code AnalyzerStatic Code Analyzer Code Profiler Unit TestingCode Coverage
Other Sessions DayTimeSessionTopic Tuesday12:15DEVPNL2 Visual Studio Team System Partners Tuesday1:30 DEV 300 Project Management Tuesday1:30 ARC 304 Bridging the Gap Between IT and Dev Tuesday3:15 ARC 400 Developing SOAs Wednesday8:30 DEV 301 Software Testing Thursday1:30 DEV 302 Advanced Development Thursday3:15 DEV 303 Enterprise-Class Source Control Friday9:00 ARC 312 Designing for Deployment Friday12:15DEVPNL5 Implementing Software Processes
Attend a free chat or web cast List of newsgroups communities/newsgroups/en-us/default.aspx MS Community Sites Locate Local User Groups Community sites
Q1:Overall satisfaction with the session Q2:Usefulness of the information Q3:Presenter’s knowledge of the subject Q4:Presenter’s presentation skills Q5:Effectiveness of the presentation Please fill out a session evaluation on CommNet
© 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.