Testing for 'Net Developers - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

Testing for 'Net Developers

Description:

Waterfall. RUP (Rational Unified Process) Spiral/ Iterative Waterfalls. MSF CMMI (Formal) MSF Agile. Scrum. Extreme Programming ... – PowerPoint PPT presentation

Number of Views:45
Avg rating:3.0/5.0
Slides: 34
Provided by: plo66
Category:

less

Transcript and Presenter's Notes

Title: Testing for 'Net Developers


1
Testing for .Net Developers
  • By Paul Lockwood

2
Brief Bio
  • Coding is a hobby of 24 years
  • Taken three CompSci Degrees
  • First Consulting Gig in 1993
  • 100 Development Focused
  • There is still so much to learn!

3
Aims for Today
  • Awareness of Formality Extremes
  • Project-to-project is very different
  • Awareness of Testing Best Practices
  • Basic understanding of AUT Testing
  • Testing Buzzwords/ Products

4
Methodologies
  • Waterfall
  • RUP (Rational Unified Process)
  • Spiral/ Iterative Waterfalls
  • MSFCMMI (Formal)
  • MSFAgile
  • Scrum
  • Extreme Programming
  • Code-and-Fix

5
- The bottom line
  • Dont forget Quality!

6
Testing Techniques
  • Write a test plan (89)
  • V-Model (93)
  • Record Your Tests (96)
  • AUT - ASP.Net with MVC (02)
  • AUT - TCP/IP (04)
  • AUT - Data Processing (03/06)

7
Write a Test Plan I - Requirements
8
Write a Test Plan II The Plan
9
Write a Test Plan - III
  • 1989 - UK Ministry of Defence
  • Cost Plus Pricing
  • One Test Set could take over a week
  • Pros
  • Simplicity. Users can be trained to test
  • Can test anything with a script
  • Easy to tweak the plan while testing
  • Cons
  • How long will regression testing take?
  • Code is generally throw over a large fence i.e.
    this is an expensive procedure fraught with
    politics

10
A stitch in time saves nine
11
V-Model Test plans refined
  • 1993 - London Stock Exchange
  • Andersen Consulting
  • High . Testing is essential given nature of
    the business (13M over budget in sequence 2)
  • Manually compared EDI logs
  • Attention to detail necessary
  • Cabinets full of regression test results
  • In 2006 the better solution is obvious

12
The V Model
  • Old, but still in use today

13
Record Your Tests (Scripts) I
14
Record Your Tests (Scripts) II
  • 1996 Yellow Pages
  • Hundreds of GUI Screens with constant Maintenance
    and no time for regression tests
  • Automated Testing Appears
  • Cyrano Robot, SQL Robot, Rational Robot
  • Mercury WinRunner
  • Pros
  • Automated replaying of testing
  • Cons
  • Need a developer to maintain tests
  • Tests are Fragile
  • Need to baseline database before testing

15
AUT JUnit, NUnit, VS2K5
  • 2002 - ASP.Net Project
  • Post .bomb years so BCA
  • NUnit Mandated on Project
  • Only I used it
  • Only I had zero defects
  • Demo of AUT

16
Testing in VS2K5
  • Part of Team Suite
  • 4K(?) per seat
  • Use Test Driven.Net for free AUT
  • Test Tools in Team System (developers)
  • Unit Testing
  • Code Coverage
  • Static Analysis
  • Code Profiling
  • Test Tools in Team System (testers)
  • Load Testing
  • Web Testing
  • Also Reporting (via Sharepoint too?)

17
AUT - Very Involved GUI
  • 2004 GUI Test Tool
  • NUnit tested the Test Tool
  • PInvokes
  • Interaction with another application
  • Move click the mouse
  • Tricky threading issues
  • Hard to reproduce Singleton defect
  • NUnit kept me on the deadline

18
AUT - Data in, Data Out
  • 2003 NC DOT
  • 2006 Healthcare Project
  • Black Box Testing
  • Embed Data In
  • Embed Expected Data Out
  • And Simply Compare!
  • Datasets save as xml
  • Unique Keys zap with RegExpressions
  • Embedded Resource

19
White Box vs Black Box Testing I
  • Black Public API
  • White Knowledge of internals

20
White Box vs Black Box Testing II
  • Tester Terminology
  • Black As a user would
  • White As a developer would
  • Grey Access to config files
  • Developer Terminology
  • Black Public API
  • White Low level methods etc
  • VS 2005 can test Private members!
  • Auto-gens a proxy class

21
Test Driven Development
  • 1. Analysis/ Light Design
  • 2. Write tests
  • 3. Code
  • 4. Test
  • 5. Refactor

22
Refactoring
  • Improve the Design of Existing Code
  • Red, Green, Refactor
  • Bad Smells
  • Duplicated Code
  • Long Method
  • Shotgun Surgery
  • Large Class
  • Lazy Class
  • Switch Statements

23
Continuous Integration
  • Testing Nirvana
  • Auto build and test
  • HanselMinutes.com show 5
  • http//www.hanselminutes.com/default.aspx?showID5
  • Team System Policies
  • Unit Test before check-in

24
AUT Pros and Cons
  • The Good
  • Errors spotted Early
  • Much more testing will happen
  • Takes minutes to test if you support a new
    Service Pack, Database, OS etc
  • The Bad
  • Extra Work (20-50) Can double development time
  • Rework of tests if requirements change
  • The Ugly
  • Management/ Developer buy in
  • Tests can become un-maintainable

25
Final Slide
  • Paul Lockwood
  • dotnetchap_at_hotmail.com
  • www.dotnetworkaholic.com

26
History of xUnit
  • Smalltalk Test Harnesses
  • Smalltalk yet again!
  • JUnit
  • Kent Becks work
  • Refactoring
  • MEME reaching the masses now
  • Can Refactor Mercilessly with xUnit
  • XP and Agile Development
  • Test Driven Development (TDD)
  • Starts becoming High Church
  • Scares many managers

27
Did you say Free?
  • Open Source zlib/libpng license
  • Authors just want credit
  • Java Community driven
  • Proven concept
  • JUnit, Ant, log4java, Hibernate, Eclipse
  • Microsoft Endorsed
  • Often in MSDN Magazine
  • VS Team System 2005

28
What can NUnit do for us?
  • Provide Automated Testing
  • Not UI Testing
  • Programmer tests, not QA tests
  • Defects Found Sooner
  • Less eggs on fewer faces
  • Reduced costs
  • Increased Confidence
  • XP SP2, Yukon, .Net 2.0
  • Refactor Mercilessly

29
Simple Demo
  • Quick and Easy
  • Simple with VS 2005 Team System
  • Easy to save results
  • Saves repetitive manual testing
  • Simple Code Coverage

30
NUnit v2.x
  • Uses Attributes, not Inheritance
  • 'The new version is NUnit as it would have been
    done had it been done in C to begin with Kent
    Beck
  • Adding a new Test Class
  • TestFixture
  • Test
  • TestSetup TestTearDown
  • TestFixtureSetup TestFixtureTearDown
  • Doing the tests
  • Assert.AreEqual(..)

31
Useful Tips
  • Destroy all Singletons - (IDisposable)
  • And any other state!!
  • Testing stateless classes is easiest
  • Migrating NUnit tests is easy

32
Bigger Demo
  • Multi-Date Formats
  • Break the code and see Red
  • The errors is found very quickly
  • Benefits?
  • Less loss of face for silly errors
  • Lower cost finding error close to source

33
The V Model Testing Taxonomy
Write a Comment
User Comments (0)
About PowerShow.com