Sie sind auf Seite 1von 36

Visual Studio Team System 2008

Overview

Adopting Visual Studio Team System 2008


Mickey Williams Director, Center of Excellence
mickey.williams@neudesic.com
Visual Studio Team System 2008
Visual Studio Team System 2008 Architecture Edition
• System Definition Model (SDM):
– A formal model of a complete system
– All information pertinent to deployment and operations
? ?
• Machine-readable, capturing intent of
developers and IT Professionals
Applications
– System topology
– Developer constraints
– IT policy Application
Hosts
– Installation directives
– Health model
– Monitoring rules Network
Topology
– Service Level Agreements & OS
– Reports
Hardware

4
Visual Studio Team System 2008 Development Edition
Agenda
• Code Analysis
• Code Coverage
• Profiling

6
Agenda
• Code Analysis
• Code Coverage
• Profiling

7
Code Analysis

• Evaluating code without execution


– Managed & unmanaged code
– Integrated with IDE
– Callable from the command line

• Great way of finding bugs earlier in your development cycle


– Costs less when you find bugs early
– Code review in a box

• Can be used at the Team level


– Part of your build process
– Part of your check-in policy

8
Code Analysis for Managed Code

• Based on FxCop

• Static analysis for .NET assemblies


– Supports all managed languages

• Enforces Design Guidelines

• Customizable
– Which checks to include
– Whether to report as error or warning
– Create custom rules

9
Custom Code Analysis Rules
• Create using a VS Class Library
– Reference FxCopSdk.dll and Microsoft.Cci.dll
– Add a rules definition XML file
– Inherit from BaseIntrospectionRule
– Override the Check method

• Client side installation


– Must be deployed on developer workstations and build servers utilizing static
analysis
› Copy the rule DLL to the client machine

• See http://blogs.msdn.com/fxcop/

10
Agenda
• Code Analysis
• Code Coverage
• Profiling

11
Code Coverage
• Measure test effectiveness

• Line-by-line

• Block-by-Block

• Assemblies must be instrumented


– Done automatically by Visual Studio when needed

• Results sent to viewer or XML file

12
Agenda
• Code Analysis
• Code Coverage
• Profiling

13
Profiling
• Gather information on application timing and performance

• Integrated into VSTS

• Used by many internal teams and on customer engagements

• Two measurement methods


– Sampling gathers information at fixed intervals on whatever is executing
– Instrumentation records every call

14
Agenda
• Code Analysis
• Code Coverage
• Profiling

15
New Features for 2008
• Code metrics

• Improved profiling
– “Hot Pathing” to pinpoint problem
– WCF support
– Load/Web test integration
– Baseline support

• Customize code correctness policies

• Better profile report compression

• Saving analysis

16
The 5 Code Metrics
Metric: Class Coupling
# of Dependencies Between Types

Business
Logic

GUI Transaction

Customer Account

18
Metric: Class Inheritance

# of Base Types

Component

Control

ListControl Label

ComboBox ListBox LinkLabel

19
Metric: Lines of Code

# of Executing Lines of Code


static class Program
{
#region Application Entry Point
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
1 Application.EnableVisualStyles();
2 Application.SetCompatibleTextRenderingDefault(false);
3 Workflow(args);
}
#endregion

#region Static Methods


/// <summary> Primary workflow for the application. </summary>
/// <param name="args"> Command line arguments. </param>
private static void Workflow(string[] cmdargs)
{
// Collect the list of command line arguments
4 List<string> args = new List<string>(cmdargs);

// Show usage syntax if the user so asks


5 if (UseArg(args, "/?")) { ShowAbout(); return; }

20
Metric: Cyclomatic Complexity

# of Branches

bool ParseCommandLine(string[] args)


{
1 if (args.Length == 0) ShowHelp(); return;
2 for (int i = 0; i < args.Length; i++)
switch (args[i])
{
3 case "/?" :
ShowHelp();
4 return false;
5 case "/input" :
6,7 if (args.Length > i && File.Exists(args[i + 1]))
InputFile = args[i++];
8 break;
9 case "/c" :
Colapse = true;
10 break;
}
11 return true;
}

21
Metric: Maintainability Index

– Overall indication of complexity by aggregation of several factors [Carnegie 1]

– Lines of Code
– Cyclomatic Complexity
– Computational Complexity [Halstead 1]
• Used on the Windows Code Base

Maintainability Index = 171 - 5.2 * log2(Halstead Volume) -


0.23 * (Cyclomatic Complexity) - 16.2 * log2(Lines of Code)

[Carnegie 1] Carnegie Mellon University, Software Engineering


Institute, Maintainability Index Technique for Measuring Program
Maintainability, http://www.sei.cmu.edu/str/descriptions/mitmpm.html
[Halstead 1] Halstead, Maurice H. Elements of Software Science,
Operating, and Programming Systems Series Volume 7. New York, NY:
Elsevier, 1977.

22
Visual Studio Team System 2008 Database Edition
Product Overview

• Database project system


– Supports schema and script versioning
– Schema build & deploy
• Schema compare
• Data compare
• Database unit testing
• Test data generator
• Schema refactoring
• T-SQL editor with query execution
• Work item and process integration with TFS

24
24
Database Development Life Cycle
The cycle of life for database developers

SQL Import database schema


Server
Database

Database
Project
Database
Template Create New Project Project

SQL
Script Reverse engineer existing .SQL script files (*)

25
25
Database Development Life Cycle
The cycle of life for database developers

Edit

Refactor

Compare

Database
Deploy Build
Project

Data
Generation

Test

Compare 26
26
Database Development Life Cycle
The cycle of life for database developers

SQL Import database schema


Server Deploy
Database SQL
Script

Build project
Database
Database
Project
Create New Project Project
Template
Deploy project

SQL
SQL Server
Script Reverse engineer existing .SQL script files Database

27
27
Visual Studio Team System 2008 Test Edition
Agenda
• Web Tests
• Load Tests
• Ordered Tests

29
Web Testing
• Very easy to create basic web tests
– Record/playback scenario
– Can be converted to coded tests
– Can be data-driven

• Tests HTTP requests and results only


– Not a UI testing tool

• Will record AJAX calls


– New in VSTS 2008

30
Visual Studio Integration

• Fully integrated into Visual Studio Team System


– Simplifies adoption and integration
– Test Manager and Test View are integrated into the shell
– Very easy to create a work item based on a failed test
– Tests are considered equal partners to code
› Can be versioned, branched, labeled

• Tests have full access to .NET Framework


– Tests can be written in any .NET language
– Can be inspected using the Visual Studio debugger

31
Agenda
• Web Tests
• Load Tests
• Ordered Tests

32
Key Benefits – Load Testing
• Scale out load generation
– Enables multiple commodity machines to be used to drive load
– One controller, add agent machines as needed

• Efficient load generation


– About 1000 users from a typical test machine

• Supports testing against web farms


– Ensures that load is applied to the actual production scenario

• Test controller is licensed per machine, agents per CPU


– Not licensed per virtual user
– Results in significant cost reduction
– Enables team-based load testing

• Performance counters collected on load agents and machines under test

• Load Test Monitor enables monitoring a test in progress

33
Load Testing
• A load test can contain any automated test
– Web tests, unit tests

• Load tests can be run on a developer’s machine


– Load test early and often
– Specialized hardware not required

• Load test agents and load test agent controllers used when scaling out
– Load test agent controller runs as a service
– Each load test agent can test about 1000 users

• Load test parameters include:


– Test mix
– Monitored performance counters
– Ramp-up, virtual users, and think times

34
Ordered Tests

• Test containers that incorporate other tests


– Except load tests
– May include manual tests

• Useful when testing across test and list hierarchy


– Regression test bundles
– Features that cross multiple teams

• Guarantees that tests are executed in a specific order


– One pass/fail result for the entire container
– Individual results can be viewed (double click results to drill-down)
– Manual tests will be bypassed when running remotely

36
Questions?

Das könnte Ihnen auch gefallen