Your SlideShare is downloading. ×
0
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
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

Testing with VS2010 - A Bugs Life

13,591

Published on

V1.0 …

V1.0
How often do you get a bug report that you can’t reproduce?
How often do you struggle to find the source of the bug in your code?
How can you streamline the testing process and make sure you don’t repeat the same bugs?
With Visual Studio 2010 & Team Foundation Server (TFS) 2010 there are a lot of new features for testers and developers that will solve these problems.
In this session you will learn how to: automate more, reproduce bugs easier, maintain your tests and configuration and discover problems sooner.

from Peter Gfader

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
13,591
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
287
Comments
0
Likes
2
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
  • Peter Gfader Testing with VS2010
  • Java current version 1.6 Update 171.7 released next year 2010Dynamic languages Parallel computingMaybe closures
  • The silliest bug report ever seen ...“The worst bug report I ever seen... And actually I wrote it”
  • Not everyone in GermanyThis is already quite good...Stacktrace, Exception, Screenshot ...Automated exception handlerNo steps to reproduceUnable to reproduce without customer...Not easy to fix, until I know This is the answer to the problem... But I don’t know what the question is...I want steps to reproduce...You could to a lot of Trace.Writelines or use log4net or some other logging framework...I save you from all these! 
  • Windows app?
  • This is another way of sending a bug. Its OKTFS web accessTester and Client can directly enter bugs into your bug tracking system
  • TFS + Emails + TeamCompanion
  • Windows app?We take that a bit further as well...Is there anything else you want to have in your bug reports?Sys infoScreen size...MHTML, short for MIMEHTML, is a web page archive format used to bind resources that are typically represented by external links (such as images, Flash animations, Java applets, audio files) together with HTML code into a single file. The content of an MHTML file is encoded as if it were an HTML e-mail message, using the MIME type multipart/related.
  • Do all these things....
  • App.xaml
  • SKIP THIS
  • We have RyanDo you have a dedicated tester?That does just testing? No coding? Not on the same project...
  • Integrate the whole system
  • Relies on entries in the database, should use in memory/mock objectsWhat are we testing here?Naming of Test should reflect: What are we testing? Scenario: Input values, Behaviour,
  • Tests that span multiple layers (for example business logic, view, and controller) are also not considered unit tests You have to do special things to your environment (such as editing config files) to run it.
  • how is it different that an integration test?An integration test usually is not in-memory: it may touch the disk file system, databases, registry or other shared resources.  It may read or need a configuration file of the file system, wheas a unit test can be fully configured in-memory, for example.An integration test will usually run much slower because it does not run in-memory.An integration test can be less consistent – it may use threads or random number generators so that the result of the test is not always consistent.---
  • An integration test will usually run much slower because it does not run in-memory.An integration test can be less consistent – it may use threads or random number generators so that the result of the test is not always consistent.---– it may use threads or random number generators so that the result of the test is not always consistent.
  • Integration test: Test on physical serverIntegration tests: Should be setup env. Themselves and tear down afterwardsDateTime.Now Moq:MDateTime
  • Readable: Easy to understand, see what we are testing, why, expectMaintainable: If they are to hard to maintain they’ll get stale, and your investment in writing them was wasted. Trustworthy: If you can’t trust your tests to find bugs (and especially if you don’t know you can’t trust them), then the opposite may be true — you may be confident you don’t have bugs when you do.
  • Don’t repeat the same logic in the test!Bug is reproduced in test!
  • ** Find better example for DB mocking
  • WebFormsMvp.UnitTestshttp://webformsmvp.codeplex.com/
  • WebFormsMvp.UnitTestshttp://webformsmvp.codeplex.com/
  • This is the old way!!!
  • No detailed planCreate click sequence that is out of the mainstream
  • Magic moment when we close tasks:Dev: “Should be fine now”“Unable to reproduce” = “Works on my machine”“Unable to reproduce” is just as silly as “works on my mach”Every time you choose that, the screen should come up
  • No time to fix all bugs --> We must SHIP (we call this the “Vista method”) #8
  • How often do you get a bug report that you can’t reproduce? How often do you struggle to find the source of the bug in your code?
  • Start up “Microsoft Test and LabManager”
  • ONLY IN Visual Studio Ultimate edition
  • Tester sees tests to doWe pick test division by 0
  • “Create action recording” - To reproduce steps
  • TestCaseCollectorErrorWarning.xml =WarningErrors from MTLM<?xml version="1.0" encoding="UTF-8"?><DataCollectionLogxmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> <DataCollectorMessages> <DataCollectorExceptionMessage timestamp="2009-11-14T22:26:52.7623220+11:00" dataCollectorUri="datacollector://microsoft/VideoRecorder/1.0" dataCollectorFriendlyName="Video Recorder" agentName="WIN-M3V9YMSUKRG" level="Error"> <Text>A video recording cannot be created</Text> <ExceptionType>Microsoft.VisualStudio.TestTools.Execution.WindowsMediaEncoderNotInstalledException</ExceptionType> <ExceptionMessage>To create a video recording, follow the instructions on the following link to install any necessary software:http://go.microsoft.com/fwlink/?LinkId=154778</ExceptionMessage> </DataCollectorExceptionMessage> <DataCollectorMessage timestamp="2009-11-14T22:29:45.6272345+11:00" dataCollectorUri="datacollector://microsoft/TraceDebugger/1.0" dataCollectorFriendlyName="IntelliTrace" agentName="WIN-M3V9YMSUKRG" level="Warning"> <Text>No Microsoft .NET applications were launched during the test run. Launch applications from Explorer or a new command prompt after a test case has started. If no .NET application is being tested, disable the Test Impact and IntelliTrace Data Collectors.</Text> </DataCollectorMessage> <DataCollectorMessage timestamp="2009-11-14T22:29:45.6321170+11:00" dataCollectorUri="datacollector://microsoft/TraceDebugger/1.0" dataCollectorFriendlyName="IntelliTrace" agentName="WIN-M3V9YMSUKRG" level="Warning"> <Text>The data collector is configured to collect data from IIS, but no web request was intercepted during the test. Ensure that the "ASP.NET Client Proxy for IntelliTrace and Test Impact" is enabled in the client test settings and that "localhost" or "127.0.0.1" is not being used to contact the server. This warning is expected if the test is not testing a web application or web service on the IIS server.</Text> </DataCollectorMessage> </DataCollectorMessages></DataCollectionLog> ActionLog.txt Log fileUse this to create a test
  • What does the dev get?BAD: the tdlog (intelliTrace) is huge > 10MB of this exception
  • Trace (intelliTrace) is there in this bug (All Links)Uitest is there as well
  • Stacktrace is good...We don’t need it anymore...We see the error in yellow!!** Balloons over this
  • Balloon on exception on the transitionHOVER OVER d and see NAN: NOT POSSIBLE?
  • From my tester
  • http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.uitesting.applicationundertest%28VS.100%29.aspx
  • [TestMethod] public void CodedUITestMethod1() {ApplicationUnderTestappUT = ApplicationUnderTest.Launch(@"c:DataPeterGfaderProjectsTFSPeter-Gfader-Calculator runkWPFCalculatorcsharpinx86DebugAvalonCalculator2.exe"); // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. this.UIMap.Press2();this.UIMap.PressDivide(); this.UIMap.Press0();this.UIMap.PressEquals();Assert.IsTrue(appUT.Process.Responding, "App not responding"); // cleanupappUT.Close(); }
  • Bug can be fixed directly in debugging session – since on same machine...Not sure if that’s the case when tester is on another machine...
  • BAD: the tdlog (intelliTrace) is huge > 10MB for this exception (1minute)
  • Think of falling asleep during a movie... Then you wake up suddenly because a shot happened in the movie. Now you rewind back to see what happened...Now imagine this with an exception (=shot)
  • Think of falling asleep during a movie... Then you wake up suddenly because a shot happened in the movie. Now you rewind back to see what happened...Now imagine this with an exception (=shot)
  • Think of falling asleep during a movie... Then you wake up suddenly because a shot happened in the movie. Now you rewind back to see what happened...Now imagine this with an exception (=shot)
  • Dev shouldn’t close the bugDev just says: Resolved
  • nDepend
  • Create sequence diagram -> context menu on method
  • "That is all I have for today. I appreciate you giving me your time. Thank you very much and have a great day." Peter Gfader
  • Menu doesn’t hop up and down on switching projects...
  • Adding more values (including notes) to data tipsIs this in source control? otherwise ???
  • Searching in the Breakpoints windowLabel breakpointsImport and export breakpoints (put under source control for all devs)String comparison for breakpoint conditions in native debuggingExport and Import of Breakpoints and Data Tips
  • Windows app?
  • Similar to TDD...
  • Click to add notesPeter Gfader Testing with VS2010
  • Transcript

    • 1. A bug’s life<br />Testing with VS 2010<br />
    • 2. Testing the world with Visual Studio 2010<br />How often do you get a bug report that you can’t reproduce?<br />How often do you struggle to find the source of the bug in your code?<br />How can you streamline the testing process and make sure you don’t repeat the same bugs?<br />With Visual Studio 2010 &amp; Team Foundation Server (TFS) 2010 there are a lot of new features for testers and developers that will solve these problems. <br />In this session you will learn how to: automate more, reproduce bugs easier, maintain your tests and configuration and discover problems sooner.<br />Abstract<br />
    • 3. In every day software development, we often encounter bugs that are difficult to reproduce and even more difficult to find. This problem is accentuated when it’s a reoccurring bug in the system. Visual Studio 2010 &amp; Team Foundation Server (TFS) 2010 introduces heaps of new features that will help testers and developers in squashing these bugs once and for all.<br />In this session you will learn how to:<br />Reproduce bugs <br />Automate your tests to find reoccurring bugs <br />Maintain your tests and configuration <br />Discover problems sooner <br />Abstract<br />
    • 4. SSA @ SSW<br />Loves C# and .NET (Java not anymore)<br />Specializes in <br />Windows Forms<br />ASP.NET<br />TFS testing<br />Automated tests<br />Peter Gfader<br />
    • 5. How to report bugs<br />What to test to find bugs?<br />Tests<br />Unit tests<br />Integration test<br />Testing, reporting bugs and fixing bugs<br />Test &amp; Lab Manager (MTLM)<br />VS2010<br />Missing in VS2010<br />Agenda<br />
    • 6. “Pass by my office then I show you”<br />
    • 7.
    • 8.
    • 9. Email <br />Web application<br />TFS web access<br />How do you report bugs?<br />
    • 10.
    • 11. <ul><li>We love TFS
    • 12. And we love emails</li></ul>TeamCompanion glues those worlds together<br />http://www.ssw.com.au/ssw/standards/rules/rulestobetterprojectmanagementwithtfs.aspx#TeamCompanionWorkItem<br />How we report bugs<br />
    • 13. Instructions to tester<br />Reproduce steps<br />Screen captures<br />Stacktrace (Windows Forms, WPF, ASP.NET, Silverlight)<br />Win7 Recorder?<br />How do you report bugs (Instructions)?<br />
    • 14. Reproduce steps<br />Screen captures<br />Stacktrace (Windows Forms, WPF, ASP.NET, Silverlight)<br />Win7 Recorder ???<br />URL (Page)<br />Version number<br />Browser (Firefox or IE)<br />http://www.ssw.com.au/ssw/standards/Support/BugReportOrEnhancement.aspx<br />Instructions to tester<br />
    • 15. <ul><li>Handle All unhandled exceptions
    • 16. Application.ThreadException
    • 17. Global.asax
    • 18. ** JavaScript</li></ul>Capturing unreported bugs #2<br />
    • 19. <ul><li>SSW Exception handler
    • 20. LadyLog</li></ul>http://www.ssw.com.au/ssw/Standards/Rules/RulesToBetterErrorHandling.aspx<br />We suggest to use<br />
    • 21. ** Triaging rule<br />Runtime error  this release<br />Suggestions / feature  next release<br />Little UI ones  this release<br />** RULE<br />Do you have rules on triaging?<br />
    • 22. ** add pix<br />Ryan<br />His favourite quote<br />“Test failed – 5 critical bugs found”<br />Do you have a dedicated tester?<br />
    • 23. Code<br />UI<br />DB<br />Deployment<br />Reports<br />Performance<br />Security<br />Whole system<br />User requirements fulfilled<br />What do we want to test?<br />
    • 24. Theory<br />
    • 25. What is the problem here?<br />1. What are we testing?<br />[TestMethod]<br />publicvoidTestCalculation()<br />{<br />varorderManager = newOrderManager();<br />using (var db = newNorthwindDataContext())<br /> {<br />var order = db.Orders.FirstOrDefault();<br />var actual = orderManager.GetTotalIncGST(order);<br />var expected = order.OrderItems.Sum(oi =&amp;gt; oi.Qty * price) * 1.1;<br />Assert.AreEqual(actual, expected);<br /> }<br />}<br />2.<br />
    • 26. “A unit test is a fast, in-memory, consistent, automated and repeatable test of a functional unit-of-work in the system.”<br />“A unit of work is any functional scenario in the system that contains logic. It can be as short as a function, or it can span multiple classes and functions, and it provides internal or business value to the system under test.”<br />“Art of Unit Testing” Roy Osherove<br />What is a Unit test?<br />
    • 27. It talks to the database<br />It communicates across the network<br />It touches the file system<br />It can&amp;apos;t run at the same time as any of your other unit tests<br />You have to do special things to your environment<br />Configuration files, registry, ...<br />Michael Feathers<br />What is NOT a Unit test? <br />
    • 28. Integrates different pieces<br />UI<br />Business Layer<br />Database<br />Not in memory<br />Touches <br />File system<br />Registry <br />Database<br />Other shared resources<br />Integration test<br />
    • 29. Run much slower <br />not run in-memory<br />Less consistent<br />Dependent from external resources<br />Has side effects<br />Harder to prepare <br />E.g. Database setup<br />Integration test<br />
    • 30. Unit tests – ALWAYS<br />Integration tests – “allow” to be red<br />Why is this important?<br />
    • 31. Readable<br />Understand!<br />What? Scenario? Expectation?<br />Maintainable<br />We change our application<br />Trustworthy<br />All  We are bug free<br />Attributes of a good Unit test<br />
    • 32. Exam!<br />
    • 33. [TestMethod]<br />publicvoidActualEndTime_PlusOvertimeHardcoded_Valid()<br />{<br />// Arrange<br />EmployeeShiftnewShift=newEmployeeShift();<br />newShift.EndTime=newDateTime(2000, 01, 01, 8, 0, 0);<br />newShift.OvertimeAfter= 1.5;<br />// Act<br />DateTime actual = newShift.ActualEndTime;<br />// Assert<br />Assert.IsTrue(actual == <br />newDateTime(2000, 01, 01, 9, 30, 0));<br />}<br />
    • 34. [TestMethod]<br />publicvoidGetDirtyObjects_Insert2Shifts_DirtyObjectsFound()<br />{<br />using (var db = newNorthwindDataContext())<br /> {<br /> // Arrange<br />db.CreateNewEmployeeShift(<br />1 // EmployeeId<br />&amp;quot;01/01/2000 02:00&amp;quot;, &amp;quot;01/01/2000 10:00“);<br />db.CreateNewEmployeeShift(<br /> 2 // EmployeeId<br /> &amp;quot;01/01/2000 15:00&amp;quot;, &amp;quot;01/01/2000 19:00”);<br />// Act<br />vardirtyObjects = <br />db.GetDirtyObjects(empShiftIdToVerify);<br />// Assert<br />Assert.IsTrue(dirtyObjects.Count() &amp;gt; 0);<br /> }<br />}<br />
    • 35.         [TestMethod]<br />        publicvoidAlwaysTrueRuleTest()<br />        { //Arrange<br />            var rules = newList&amp;lt;IRule&amp;lt;Shift&amp;gt;&amp;gt;<br />            {<br />                newWorkflowRule&amp;lt;Shift&amp;gt;()<br />                {<br />                    Name = &amp;quot;Rule 1&amp;quot;,<br />                    Description = &amp;quot;This rule will always pass&amp;quot;,<br />                    Condition = &amp;quot;true&amp;quot;,<br />                    ErrorMessage = &amp;quot;This will never be shown&amp;quot;<br />                }<br />            };<br />            var shift = newShift()<br />            {<br />                ShiftID = Guid.NewGuid(),<br />                StartTime = DateTime.Now,<br />                EndTime = DateTime.Now<br />            };<br /> //Act<br />            var results = RuleManager.Execute&amp;lt;Shift&amp;gt;(shift, rules);<br /> //Assert<br />            Assert.IsTrue(results.Count == 0);<br />            Assert.IsTrue(results.IsValid);<br />        }<br />
    • 36. [TestMethod]<br />publicvoidTestCalculation()<br />{<br />varnorthWindDataContextFake = <br />MockRepository.GenerateStub&amp;lt;INorthwindDataContext&amp;gt;();<br />varorderitemsFake = Helper.CreateListOfOrders();<br />varorderFake = Helper.CreateNewOrder();<br />northWindDataContextFake.Stub(<br /> d =&amp;gt; d.Orders.FirstOrDefault()).Return(orderFake);<br />northWindDataContextFake.Stub(<br /> d =&amp;gt; d.OrderItems).Return(orderitemsFake);<br />varorderManager = newOrderManager();<br />using (var db = northWindDataContextFake)<br /> {<br />var order = db.Orders.FirstOrDefault();<br />var actual = orderManager.GetTotalIncGST(order);<br />var expected = order.OrderItems.Sum(<br />oi =&amp;gt; oi.Qty * oi.Price) * 1.1;<br />Assert.AreEqual(actual, expected);<br /> }<br />}<br />
    • 37. [TestMethod]<br />publicvoidPresenter_Request_ReturnsRequestFromHttpContext()<br />{<br />// Arrange<br />var view = MockRepository.GenerateStub&amp;lt;IView&amp;gt;();<br />varhttpContext = <br />MockRepository.GenerateStub&amp;lt;HttpContextBase&amp;gt;();<br />var request = MockRepository.GenerateStub&amp;lt;HttpRequestBase&amp;gt;();<br />httpContext.Stub(h =&amp;gt; h.Request).Return(request);<br />// Act<br />var presenter = newTestPresenter(view);<br />presenter.HttpContext = httpContext;<br />// Assert<br />Assert.AreSame(request, presenter.Request);<br />}<br />http://webformsmvp.codeplex.com/ <br />
    • 38. [TestMethod]<br />publicvoidRedirectPresenterRedirectsOnActionAccepted()<br />{<br />// Arrange<br />var view = MockRepository.GenerateMock&amp;lt;IRedirectView&amp;gt;();<br />varhttpContext = MockRepository.GenerateMock&amp;lt;HttpContextBase&amp;gt;();<br />varhttpResponse = MockRepository.GenerateMock&amp;lt;HttpResponseBase&amp;gt;();<br />httpContext.Expect(h =&amp;gt; h.Response).Return(httpResponse);<br />httpResponse.Expect(r =&amp;gt; r.Redirect(&amp;quot;~/RedirectTo.aspx&amp;quot;));<br />var presenter = newRedirectPresenter(view)<br /> {<br />HttpContext = httpContext<br /> };<br />// Act<br />view.Raise(v =&amp;gt; v.Load += null, view, newEventArgs());<br />view.Raise(v =&amp;gt; v.ActionAccepted += null, view, newEventArgs());<br />presenter.ReleaseView();<br />// Assert<br />httpContext.VerifyAllExpectations();<br />httpResponse.VerifyAllExpectations();<br />}<br />http://webformsmvp.codeplex.com/ <br />
    • 39. [TestMethod]<br />publicvoid DataContextSubmitChangesValidateDirtyObjects_RuleResultSavedMeasureTime_RunProcessorAfterInsert5Shifts()<br />{<br />for (inti = 0; i &amp;lt; 5; i++)<br /> {<br />//dummy entries<br />DbHelper.CreateNewEmployeeShift(<br /> DbHelper.EmployeeId1SouthSuperIntendentEast,<br />&amp;quot;01/01/2000 15:00“,<br />&amp;quot;01/01/2000 16:00“,<br />true);<br /> }<br /> Stopwatch stopwatch = new Stopwatch();<br />stopwatch.Start();<br />RuleProcessor.Default.Start();<br />System.Threading.Thread.Sleep(2000);<br />RuleProcessor.Default.Stop();<br />stopwatch.Stop();<br />// no dirty object left<br />vardirtyObjects = DbHelper.GetDirtyObjects();<br />Assert.IsTrue(dirtyObjects.Count() == 0,&amp;quot;Dirty objects found&amp;quot;);<br />}<br />
    • 40. Hard to see<br />Naming convention<br />Unit test<br />Test single small “unit of work”<br />Integration test<br />Test integration, functionality<br />Unit test vs. Integration test<br />
    • 41. Test &amp; Lab Manager (MTLM)<br />VS2010<br />TestingReporting bugsFixing bugs<br />
    • 42. VS2008Scenario #1<br />Coding done<br />Internal testing done<br />Deploy to staging<br />“Test please” to Tester…<br />
    • 43. No plan (no user stories)<br />Lucky to find bugs<br />Waste a lot of time on irrelevant things<br />This is called “Exploratory testing”<br />Tester tests<br />
    • 44. Subject: Bug found!!<br />“I cant quite remember what I did but I got this after a while”<br />
    • 45. Hi Ryan<br />The developer tests and replies...<br />
    • 46. Bug never gets fixed<br />
    • 47. Dev: We have 2 additionally reported bugs<br />PM: No time to fix bugs...<br />We must SHIP!<br /> We call this the “Vista method”<br />Finally at the end of Test phase<br />
    • 48. 2 weeks development  BANG<br />Tester has no plan – Exploratory testing<br />Tester tests everything<br />“Unable to reproduce” = “Works on my machine”<br />Bug never gets fixed<br />Ship a buggy product<br />Problems<br />
    • 49. VS2010#1 Tester uses Test Lab Manager<br />
    • 50.
    • 51.
    • 52.
    • 53.
    • 54.
    • 55. Add screenshot <br />
    • 56. #2 Tester files bug<br />
    • 57.
    • 58. #3 Dev sees bug<br />Start VS2010<br />Open “My work items”<br />
    • 59.
    • 60. More details...<br />
    • 61. Bug in TFS<br />Video.wmv<br />Detailed steps<br />IntelliTrace (drill through to Visual Studio)<br />Automated recording<br />Lots of details (you don’t need if you get intelliTrace)<br />Stack trace<br />System info<br />What’s good?<br />
    • 62. #4 Dev rewinds debugging session Dev spots bugs<br />
    • 63.
    • 64.
    • 65. From recorded test we create an automated test<br />Don’t fix bug yet#5 Create automated test<br />
    • 66.
    • 67.
    • 68.
    • 69. Changes to the test<br />//Arrange<br />ApplicationUnderTestappUT = <br />ApplicationUnderTest.Launch(@”binx86DebugAvalonCalculator2.exe&amp;quot;);<br />//Act // SNIP SNIPSNIP<br />//Assert<br />Assert.IsTrue(appUT.Process.Responding, <br />&amp;quot;App not responding&amp;quot;);<br />
    • 70.
    • 71. #6 Dev fixes bug<br />
    • 72. VS2008: Developer tests manually his bug fix<br />VS2010: Replay coded UI test<br />#7 Dev verifies bug fix<br />
    • 73. Automated test is GREEN<br />
    • 74. Easy to reproduce the bug<br />Create functional test (coded UI test)<br />Automate the test from recording<br />Good for future changes (Regression testing)<br />What’s good with coded UI tests<br />
    • 75. <ul><li>Fall asleep during a movie</li></ul>IntelliTrace<br />
    • 76. <ul><li>Fall asleep during a movie
    • 77. Suddenly wake up because of a surprise!</li></ul>IntelliTrace<br />
    • 78. <ul><li>Fall asleep during a movie
    • 79. Suddenly wake up because of a surprise!
    • 80. Rewind back to see what happened...</li></ul>IntelliTrace<br />
    • 81. Was called “Historical Debugging”<br />Easy to spot the bug<br />Record method calls with parameters<br />Advanced call stack<br />Get intellitrace logs from your testers <br />Record / Trace testers execution <br />Use same source code to debug as the tester had to test<br />Get intellitrace logs from your build server <br />What’s good in IntelliTrace<br />
    • 82. Hi Ryan<br /> Done – Fixed and test added<br /> PS: you don’t need to test this again <br /> PPS: testers are becoming less useful with 2010<br />Peter<br />#8 Email to tester<br />
    • 83. Everyone is happy<br />
    • 84. They destroy things<br />They break our code<br />“Developers hate testers”<br />
    • 85. VS2010 – New dev joins team<br />
    • 86. Dependency graphs<br />Get an overview<br />
    • 87. TODO Insert image<br />Assembly dependency<br />
    • 88. Create sequence diagram -&amp;gt; context menu on method<br />What happens when?<br />
    • 89. TODO Insert image<br />
    • 90. Call hierarchy (not just debugging)<br />View  Code definition window<br />Navigate To Ctrl+comma<br />Reference highlighting - select and wait<br />Code navigation <br />
    • 91. Extras<br />
    • 92. <ul><li>Dead code -> Code analysis</li></ul>Why gets my breakpoint never hit?<br />
    • 93. Test impact analysis<br />The developer sees that his code affected other tests (Test Impact analysis)<br />Saves time on running tests<br />Running a lot of tests is slow<br />
    • 94. Changed shortcuts<br />
    • 95. Many test cases<br />Start application<br />Login to application<br />Browse to start page<br /> Annoying!<br />What are shared steps?<br />
    • 96. Re-use test steps over different test cases<br />Record once<br />Play back in other tests<br />Use shared steps<br />
    • 97. intelliTrace with WPF 64bit<br />
    • 98. Tester: I want to test that specific build<br />
    • 99. Choose specific build to test<br />
    • 100. Tip: Why do I have this toolbar?<br />
    • 101. Let your Knowledge workers know of this tool!<br />Sending you problems in a standardized way<br />With Win7 --&amp;gt; use recorder<br />
    • 102. VS2010 Debugging<br />
    • 103. Sticky Data tips<br />
    • 104. Pinning quick watch <br />
    • 105. Label breakpoints<br />Searching in the Breakpoints window<br />Export and Import of Breakpoints and Data Tips (put under source control for all devs)<br />Breakpoints Window<br />
    • 106. MTLMHow can I get it? <br />
    • 107. Email <br />Web application<br />TFS web access<br />Test &amp; Lab Manager<br />Which one would you use now?<br />
    • 108.
    • 109. When you get a bug report!<br />Create test<br />Test is RED<br />Fix bug<br />Test is GREEN<br />Send a “Done - Test created”<br />When do you create a test?<br />
    • 110. Reproduce bug<br />Spot bug<br />“Works on my machine”<br />Bug never gets fixed<br />Generate test from bug <br />Dev uses “Re-play” button instead of manual test<br />Recap Scenario<br />
    • 111.
    • 112. Every time I change something I want to test (verify) that I didn’t introduce a bug<br />Deployment<br />Bug fix<br />New feature<br />New report added<br />I love automated tests<br />
    • 113. Integrated web UI tests<br />Windows UI tests, when they do it for Web, they can do it for Windows apps (Windows Forms, WPF)<br />RowTests<br />Data driven tests with attributes next to the test<br />What I want in VS2012<br />
    • 114. [TestMethod]<br />[DeploymentItem(@&amp;quot;TestDatavalidConditions.txt&amp;quot;)]<br />[DataSource(&amp;quot;System.Data.OleDb&amp;quot;, <br />&amp;quot;Provider=Microsoft.Jet.OLEDB.4.0;<br />DataSource=|DataDirectory|;<br />Extended Properties=&amp;apos;text;FMT=TabDelimited;HDR=YES&amp;apos;&amp;quot;, @&amp;quot;validConditions#txt&amp;quot;, DataAccessMethod.Sequential)]<br />publicvoidCodeParserTryParseCondition_Valid_ValidConditionsFromFile()<br />{<br /> // Arrange<br />string condition = TestContext.DataRow[0].ToString();<br />CodeParsercodeParser = new CodeParser();<br /> // Act<br />boolsuccessFul = codeParser.TryParseCondition(condition);<br /> // Assert<br />Assert.IsTrue(successFul);<br />}<br />
    • 115. [TestMethod]<br />[Row(&amp;quot;Target.IsDirty&amp;quot;)]<br />[Row(&amp;quot;Target.IsValid“)]<br />[Row(&amp;quot;(1 != 2)&amp;quot;)]<br />publicvoidCodeParserTryParseCondition_Valid_ValidConditionsFromFile(<br />stringcondition)<br />{<br /> // Arrange<br />CodeParsercodeParser = new CodeParser();<br /> // Act<br />boolsuccessFul = codeParser.TryParseCondition(condition);<br /> // Assert<br />Assert.IsTrue(successFul);<br />}<br />
    • 116. Roy Osherove<br />Book http://www.artofunittesting.com/<br />Blog http://weblogs.asp.net/ROsherove/<br />Unit test definitionhttp://weblogs.asp.net/ROsherove/archive/2009/09/28/unit-test-definition-2-0.aspx<br />Michael Feathers<br />Bloghttp://www.artima.com/weblogs/index.jsp?blogger=mfeathers<br />What is not a unit test?http://www.artima.com/weblogs/viewpost.jsp?thread=126923<br />Resources<br />
    • 117. Compare Visual Studio editionshttp://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx#compare<br />Visual Studio pricing optionshttp://arstechnica.com/microsoft/news/2009/10/visual-studio-2010-simplified-to-four-skus-beta-2-arrives.ars<br />Resources<br />
    • 118. Good blog about VS2010http://blogs.msdn.com/habibh/<br />How Does VS2010 Historical Debugging Work?http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/06/16/how-does-vs2010-historical-debugging-work.aspx<br />Resources<br />
    • 119. 3things…<br />PeterGfader@ssw.com.au<br />http://peitor.blogspot.com<br />
    • 120. Thank You!<br />Gateway Court Suite 10 81 - 91 Military Road Neutral Bay, Sydney NSW 2089 AUSTRALIA <br />ABN: 21 069 371 900 <br />Phone: + 61 2 9953 3000 Fax: + 61 2 9953 3105 <br />info@ssw.com.auwww.ssw.com.au <br />

    ×