Your SlideShare is downloading. ×
Test drive your windows phone application
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

Test drive your windows phone application

2,524

Published on

Unit testing is a modern engineering practice that speed up development and give developers and testers a quick way to look for logic errors in the methods of apps they’ve written. …

Unit testing is a modern engineering practice that speed up development and give developers and testers a quick way to look for logic errors in the methods of apps they’ve written.
There is no excuse not to write unit tests for windows phone – since both the architecture and tools makes it feasible and simple. In this talk I’ll show examples and strategies of unit testing windows phone applications and how you can take control of your code today!

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

No Downloads
Views
Total Views
2,524
On Slideshare
0
From Embeds
0
Number of Embeds
25
Actions
Shares
0
Downloads
4
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
  • This how I learnt I need to write unit testshttp://blog.stackoverflow.com/2008/10/script-responsibly/
  • Transcript

    • 1. Test drive your windows phone application Dror Helper Senior consultant @dhelper | http://blog.drorhelper.com | drorh@oz-code.com
    • 2. About.ME • Developing software (professionally) since 2002 • TDD/Unit testing evangelist • Not a windows phone 8 expert • Blogger: http://blog.drorhelper.com
    • 3. Unit testing mobile applications is: Impossible or Too damn hard or Not cost effective
    • 4. The truth is that unit testing mobile applications is easy and fully supported* by your IDE
    • 5. A unit test is… Test individual unit of work For developers by developers
    • 6. Pillars of good unit test 1. Tests specific functionality 2. Clear pass/fail criteria 3. Good unit test runs in isolation
    • 7. This is a unit test [Test] public void CheckPassword_ValidUser_ReturnTrue() { bool result = CheckPassword(“Skroob”, “12345”); Assert.That(result, Is.True); }
    • 8. Test classification • Unit tests should be: – Small – Atomic – Test a single functional unit – Isolated! • Integration tests - test several units together • Functional/System tests
    • 9. Why write unit tests Saves time & money Don’t need to run full flow to test code Reduce manual testing effort Catch regression issues Documentation And especially
    • 10. Before that - a History lesson In the distant past (2008) The ultimate tool was created
    • 11. The new Notifier
    • 12. The flow to implement UserRepository WP8 App HttpClient StackExchange GetUser HttpGetAsync HTTP GET User JSON JSON (Compressed)
    • 13. Writing the “client” UserRepository WP8 App HttpClient StackExchange GetUser HttpGetAsync HTTP GET User JSON JSON (Compressed)
    • 14. Our client Get (user) data from StackOveflow StackExchange API: Http-Get  JSON
    • 15. Portable library Write and build managed assemblies targeted to one or more .NET framework platform .NET Framework Xamarin Silverlight PCL Windows Phone Xbox 360 WinRT
    • 16. Testing portable library Test as plain old .NET code unit testing framework of choice The new (and shiny) Test Explorer
    • 17. 17
    • 18. This is a unit test [Test] public void AddTest() { var cut = new Calculator(); var result = cut.Add(2, 3); Assert.AreEqual(5, result); }
    • 19. Testing in Isolation UserRepository WP8 App HttpClient StackExchange GetUser HttpGetAsync HTTP GET User JSON JSON (Compressed)
    • 20. Testing in UserRepository in Isolation UserRepository Test Code Fake HttpClient GetUser HttpGetAsync User JSON
    • 21. What Mocking framework can do for you? • Create Fake objects • Set behavior on fake objects • Verify method was called • And more...
    • 22. Testing our application UserRepository WP8 App HttpClient StackExchange GetUser HttpGetAsync HTTP GET User JSON JSON (Compressed)
    • 23. MVVM to the rescue Easy to create Model Easy to test ViewModel Binding Commands View
    • 24. The “real” WP8 unit testing MSTest Using Emulator Async Test methods supported Test logic (Model/ViewModels)
    • 25. Pitfalls and gotchas Async test won’t run  return Task from test method UnauthorizedAccessAxception  use [UITestMethod]
    • 26. Summary • Unit testing == good • Unit testing portable code as simple as “regular” code • Unit testing WP8 logic is easy(ish)
    • 27. Dror Helper C: 972.50.7668543 e: drorh@oz-code.com B: blog.drorhelper.com w: www.ozcode.net

    ×