Your SlideShare is downloading. ×
0
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Approval Tests - A Library for All Developers
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Approval Tests - A Library for All Developers

2,682

Published on

deck from my talk at SoCalCodeCamp June 2011 - library at www.ApprovalTests.com

deck from my talk at SoCalCodeCamp June 2011 - library at www.ApprovalTests.com

Published in: Technology, Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,682
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
14
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • www.ApprovalTests.com-->http://approvaltests.sourceforge.net/
  • ice-breaker - Comic credit - http://almaer.com/blog/uploads/feelingagile.png
  • Idea here is common misconceptions, i.e. ‘why I do not do TDD’Why TDD == spec, feedback, granularity, regressionIke to tell story of ‘why’ TDD change lock.
  • change perception.Photo credit – “Seeing the Invisible” - http://fc03.deviantart.net/fs71/i/2010/299/4/7/seeing_the_invisible_by_beloved_art-d31kfsc.jpg
  • Simple C# demo, show Console (breakpoint), Assert, Approve, Reporter with Add, then with Explain, then into Reporters (DiffHTMLDiff)Here are the steps from www.ApprovalTests.comStep 1: Create your scenario Step 2: Write that scenario in EnglishStep 3: Translate English to Code (TDD – name objects / methods FIRST)Step 4: Create Code so it works (Implement named objects / methods)Step 5: Run your test for feedback while you codeStep 6: Approve result so it continues to workStep 7: Change the requirement Step 8: See the new solution Step 9: Re-approve so it continues to work
  • Make the point that you can use ApprovalTests at all levels of testing granularity – both TDD (small) and BDD (big) AND in between – Approvals == better Asserts
  • Lynn talks about set up in C#Direct to www.ApprovalTests.comLibrary (mandatory)DiffTool (can select type, but will want to use) VS2010 – TortoiseDiff, WinDiff, doesn’t not work with BeyondCompare yetPlug-in (optional)  right click (highlight test method)  Approve (only appears when test is failing)
  • Re-iterate the testing cycle steps for TDD for new code, maybe mention BDD hereShow that the first illustration is incomplete – doesn’t include the ‘think it out / visualize it’ step
  • Point out that the reporters vary for the different (language) implementations, i.e. C#, Java, etc.. Point to the documentation!Reporter are VIEWERS for results on test FAILURE onlyIncluded reporters which are not listed are also WinDiff and BeyondCompareTypes – text, image, HTML, more?
  • Demo the VS2010 plug in, right-click ‘Approve’ – only works when test has not passed already.Contents provided are serialized to the file, depending on the Writer (which is encapsulated and associated to the method, examples:Approve(“”)*.txtApproveHtml(“”)*.htmlApprove(WinForm)*.pngApprove(IExecutableQuery)*.txt (SQL statement source generally)The act of approving allows you to take the contents of the received file and write them Namer – creates file name based on method nameWriter (depending on type, i.e. string) – inserts contents of object (i.e. string) into the new fileApprover – checks to see whether *.received file equals *.approvedReporter – called only on failure and then report (show) both files (*.approved & *.received)Received file is the contents that you gave the Writer written to the that file, the type is determined by the Writer, i.e. tiff, png
  • Can approve ‘parts’ of a form (controls), or reports (RDLC), different types of files, such as .tiff, etc…*to test part of a Form, must make that part (control) publicC# demo using WinDiff (or TortoiseImageDiff) – new code TDD, ReSharper or VS refactoring tools?Do a version of this demo - http://www.youtube.com/watch?v=k5Y_jo4Nn54Also for ArraysThere is a header and lambda function for arrays that allows for thetesting circle.var word = "Llewellyn";Approvals.Approve(word, word.ToCharArray(), (c) => c+ " => " + (int)c);would produce:LlewellynL => 76l => 108e => 101w => 119e => 101l => 108l => 108y => 121n => 110
  • About writing the ‘functional method(s)’ which will be tested by CombinationApprovalsTalk about the limits of ‘functional’ coding, not only for F#, i.e. coding in a functional way, testing in a functional way.  stored proc on visual.Photo credit – “Seeing the Invisible” - http://fc03.deviantart.net/fs71/i/2010/299/4/7/seeing_the_invisible_by_beloved_art-d31kfsc.jpg
  • There is a header and lambda function for arrays that allows for thetesting circle.var word = "Llewellyn";Approvals.Approve(word, word.ToCharArray(), (c) => c+ " => " + (int)c);would produce:LlewellynL => 76l => 108e => 101w => 119e => 101l => 108l => 108y => 121n => 110
  • Testing non-deterministic results – blog – testing the weatherOn test “pass”, there is NOT call to the data source (web service, database, etc…)ILoader implements Load(), uses IExQuerycombines, creates abstract base LoaderForSystem, example:SQL  conn string, T-SQLEF  conn string, LINQWCF  server, URL (query)
  • Biz opportunity (i.e. how much) Legacy code is out thereIntro the idea of using approvals for legacy code in addition to TDD (i.e. test-first on new code)Image credit - http://www.agilitrix.com/wp-content/uploads/2010/03/Legacy-Systems-ThoughtWorks-QTB.jpg
  • Explain the syntax of Approvals.ApproveAllCombinations(arg,arg,arg) in C# (9 overloads)Can pass  Enumerable, Array, RangeContrast to Debug.Assert (individual results) – Approvals.ApproveAllCombinations much richer output, here you are testing EVERY element in combination
  • Intro the idea of using approvals for legacy code in addition to TDD (i.e. test-first on new code)Code coverage in VS2010 Ultimate or can use DotCover (around $ 100), or othersCode Coverage is defined as running your tests and seeing how much of your code is ‘covered’
  • Intro the idea of using approvals for legacy code in addition to TDD (i.e. test-first on new code)
  • Legacy Code demo in Java, locking test, and code coverageDo a version of this demo - http://www.youtube.com/watch?v=EJ1tRFEOkcwDo this in C#CombinationApprovals.Approve (<func>, enum(r1Start,r1Length), enum(r2Start,r2Length)
  • Besure to read the FAQ - http://approvaltests.sourceforge.net/?q=node/3
  • Future – Approval Katas or Koans“Try our bowling with approvals. - Java / C# with MS Test / C# with Nunit”
  • www.ApprovalTests.com-->http://approvaltests.sourceforge.net/
  • Transcript

    • 1. Approval Tests
      Lynn Langit
      A library for you
    • 2. So, are YOU Agile?
      Do you code in C#, VB.NET, Java, PHP or Ruby?
    • 3. Why TDD?
      Better spec / scope
      Define, then create (objects)
      Do  Verify
      Feedback/regression/granularity
      But…
      Littered with Asserts?
      Extra work  less productivity?
      Why Test-Driven?
    • 4. For Code Quality
      Tests are ‘kind of’ important
      Africa is ‘kind of’ big…
    • 5. Demo
      How do I get started?
    • 6. How Test-Driven
      TDD
      BDD
      Think Bigger
      Less Code
      Scenarios
      How do Approvals fit with both?
      Assert
      Do
      Verify
    • 7. Setup
      Download Approvals
      Download IDE plugin
      VS2010, VS2008
      Select DiffTool(s)
    • 8. Approve is the new Assert
      Applying Approvals
    • 9. About Reporters
    • 10. How to Approve
      • Rename *.received to *.approved
      • 11. Right click ‘Approve’ (plug-in)
      • 12. Right click ‘Use whole file’ (DiffReporter)
      • 13. Copy ‘Move’ statement from Test Results to command window
      Contents provided are serialized to the file
    • 14. Demo
      I want to test a GUI…
    • 15. Functional ‘ality’
      Testing the untestable
      How do I make THAT functional?
    • 16. Testing Arrays…
      Testing multiple values
    • 17. Testing the Weather using SQL Server – Approvals.Approve(Loader…)
      DEMO
      Testing non-deterministic objects
    • 18. Legacy Code
      How much of your code base is dead code?
    • 19. Combinations
      Combination Approvals
    • 20. Code Coverage
      How much of your code base is covered?
    • 21. Coverage Config
      Code Coverage in VS 2010 Ultimate
    • 22. Demo
      I want to test combinations...
    • 23. Who wrote this?
      Dan Gilkerson (@dangilkerson)and Llewellyn Falco (@isidore_us)
    • 24. Now I want THAT
      www.ApprovalTests.com
      Pick your language & download
      Pick your diff tool
      Reference, Approve & Enjoy
    • 25. Approval Tests
      Lynn Langit@llangit
      Q & A

    ×