Testing and Debugging Managed Applications PowerPoint PPT Presentation

presentation player overlay
1 / 28
About This Presentation
Transcript and Presenter's Notes

Title: Testing and Debugging Managed Applications


1
Testing and Debugging Managed Applications
Nick Randolph .NET CF MVP
VS2005 User Group Launch
2
Agenda
  • Test Driven Development
  • Developing code
  • Object data binding
  • Debugging running code

3
Test Driven Development
  • Does NOT imply NO design
  • Design class functionality
  • Write test cases to define class behaviour
  • Implement class to pass test cases

4
Class Designer
  • Why?
  • Understanding Existing Code
  • Class Design
  • Review/Refactor
  • Documentation

5
Class Designer - Toolbox
  • Design space objects
  • Class
  • Interface
  • Structure
  • .
  • Connectors
  • Inheritance (implements)
  • Association (collections)

6
Class Designer Code Alive
  • Dynamic representation of code
  • .cd file xml meta-data
  • Complete code round-tripping

7
Class Details
  • Properties, Methods, Fields, Events
  • Name, Type, Modifier, Summary, Hide
  • Parameters
  • Tree structure tab, intellisense

8
Class Details
  • Properties Window
  • Access
  • Accessor
  • Custom Attributes
  • Filename
  • Full Name
  • Generic
  • Implements
  • Inheritance Modifier
  • Inherits
  • .

9
Demo
  • Design Customer class
  • Name
  • Design Order class
  • Description
  • Quantity
  • Date ordered

10
Unit Testing
  • Precursor NUnit Framework
  • Test stub creation
  • Test framework for execution and reporting

11
Unit Testing Attributes
  • Nunit Team Suite
  • TestFixture TestClass
  • Test TestMethod
  • TestFixtureSetup ClassInitialize
  • TestFixtureTearDown ClassCleanup
  • Setup TestInitialize
  • TearDown TestCleanup

12
Demo
  • Building and executing test stubs
  • Completing Customer/Order classes

13
Object Workbench
  • Design-time tool for debugging
  • Create class instance with running application up
    or test framework
  • Class View
  • Class Diagram
  • Probe instance
  • Modify properties or fields
  • Invoke methods
  • Store return values

14
Demo
  • Creating and probing objects with the workbench

15
Drag n Drop UI Development
  • Data source window
  • Data source types
  • Data sets
  • Webservices
  • Objects
  • Two views
  • Data type (eg integers, strings)
  • Display view (when working with UI designer)

16
Drag n Drop UI Development
  • Drag n Drop Object Binding
  • Display options (datagridview or details)
  • Binding controls
  • BindingSource
  • BindingNavigator

17
Demo
  • Wiring up the Customer class for editting

18
Tangent Using Settings to Persist Data
  • Application/User Settings
  • VB.NET
  • My Namespace
  • Strong typing of settings under My.Settings
  • Application Framework
  • Auto save settings on close

19
Demo
  • Create User Setting
  • Modifying user setting to save Customer list

20
Debugging Support
  • Immediate Window
  • Break and Tracepoint Window
  • New breakpoint dialogs
  • Ability to run macros and write output without
    breaking
  • Edit Continue

21
Demo
  • Immediate execution without application in Debug
  • Setting break/trace points to track application
    progress
  • Modifying code while application paused

22
Debugger
  • Debugger.IsAttached
  • Determine if a debugger is attached
  • Debugger.Launch
  • Launches a debugger (if not attached)
  • Debugger.Break
  • Equivalent to a breakpoint
  • Will launch the debugger if not attached

23
Debugging
  • DebuggerDisplay
  • Single line representation
  • Hover over object
  • Can add property values
  • DebuggerBrowsable
  • C
  • Determines whether the variable/property is
    collapsed, never displayed, root hidden or
    expanded

24
Demo
  • DebuggerDisplay showing use of parameters

25
Debugging
  • DebuggerHidden
  • Debugger wont stop in method, property or
    constructor
  • Cant set breakpoints in there either
  • DebuggerNonUserCode
  • Class/Structure, Method, Constructor, Property
  • Prevents stepping into and appearance in UserCode
    section of call stack

26
Debugging
  • DebuggerStepThrough
  • Debugger wont step into method
  • Will stop for breakpoints
  • DebuggerTypeProxy
  • Shows alternative type instead of type being
    debugged
  • Must have a constructor with single argument of
    the type being debugged
  • DebuggerVisualizer
  • Allows user code to run when magnifier is
    selected
  • Must inherit from DialogDebuggerVisualizer

27
Demo
  • Create a property that modifies a value when Get
    is executed
  • Use DebuggerTypeProxy to prevent execution
  • Create a visualiser to represent data

28
Questions?
Write a Comment
User Comments (0)
About PowerShow.com