Your SlideShare is downloading. ×
Test::Class::Moose
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::Class::Moose

3,861
views

Published on

Test::Class::Moose combines Test::Class, Moose and Test::Most to take test suites to the next level. It gives you unparalleled levels of control and information for you test suite.

Test::Class::Moose combines Test::Class, Moose and Test::Most to take test suites to the next level. It gives you unparalleled levels of control and information for you test suite.

Published in: Technology, Business

0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,861
On Slideshare
0
From Embeds
0
Number of Embeds
16
Actions
Shares
0
Downloads
0
Comments
0
Likes
3
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
  • No need to add empty control methods
  • No need to add empty control methods
  • No need to add empty control methods
  • We've skipped some usual Moose boilerplate (namespace::autoclean and make_immutable)
  • Methods beginning with test_ are test methods.Two objects to every method
  • This works, but we constructed our object more than once. We don't want duplicated code.
  • Transcript

    • 1. Curtis "Ovid" Poe http://allaroundtheworld.fr/ http://blogs.perl.org/users/ovid/ http://www.slideshare.net/Ovid/testclassmoose info@allaroundtheworld.fr
    • 2. info@allaroundtheworld.fr
    • 3. •  •  •  •  OO tests for OO code Nice performance boost Easy to organize tests Already use Moose info@allaroundtheworld.fr
    • 4. info@allaroundtheworld.fr
    • 5. 1.  Getting started with Test::Class 2.  Inheriting Test::Class tests 3.  Making your testing life easier 4.  Using test control methods 5.  Test::Class tricks On www.modernperlbooks.com info@allaroundtheworld.fr
    • 6. info@allaroundtheworld.fr
    • 7. info@allaroundtheworld.fr
    • 8. info@allaroundtheworld.fr
    • 9. info@allaroundtheworld.fr
    • 10. info@allaroundtheworld.fr
    • 11. info@allaroundtheworld.fr
    • 12. info@allaroundtheworld.fr
    • 13. info@allaroundtheworld.fr
    • 14. info@allaroundtheworld.fr
    • 15. info@allaroundtheworld.fr
    • 16. info@allaroundtheworld.fr
    • 17. info@allaroundtheworld.fr
    • 18. info@allaroundtheworld.fr
    • 19. info@allaroundtheworld.fr
    • 20. info@allaroundtheworld.fr
    • 21. info@allaroundtheworld.fr
    • 22. info@allaroundtheworld.fr
    • 23. info@allaroundtheworld.fr
    • 24. Solution? ✘ ✘ ✓ Instantiate the object correctly? info@allaroundtheworld.fr
    • 25. •  •  •  •  We've written two classes We've written two test classes We've seen test inheritance … but it broke our test! info@allaroundtheworld.fr
    • 26. info@allaroundtheworld.fr
    • 27. info@allaroundtheworld.fr
    • 28. info@allaroundtheworld.fr
    • 29. •  It works •  But we constructed our object twice •  Wash/rinse/repeat for every test method? info@allaroundtheworld.fr
    • 30. Method Phase Before each test class Before each test method After each test method After each test class info@allaroundtheworld.fr
    • 31. •  •  •  •  •  Connect to a database (often in startup) Set up fixtures/transactions (setup) Clean fixtures/rollbacks (teardown) Disconnect from database (shutdown) And more … info@allaroundtheworld.fr
    • 32. info@allaroundtheworld.fr
    • 33. info@allaroundtheworld.fr
    • 34. info@allaroundtheworld.fr
    • 35. info@allaroundtheworld.fr
    • 36. info@allaroundtheworld.fr
    • 37. info@allaroundtheworld.fr
    • 38. info@allaroundtheworld.fr
    • 39. info@allaroundtheworld.fr
    • 40. info@allaroundtheworld.fr
    • 41. info@allaroundtheworld.fr
    • 42. info@allaroundtheworld.fr
    • 43. •  •  •  •  •  •  •  Only run API tests Only run unit tests Run correct code coverage Run Jenkins tests Run DB tests Create fixtures only if the test needs it Skip network tests if the network is down info@allaroundtheworld.fr
    • 44. info@allaroundtheworld.fr
    • 45. info@allaroundtheworld.fr
    • 46. info@allaroundtheworld.fr
    • 47. info@allaroundtheworld.fr
    • 48. info@allaroundtheworld.fr
    • 49. info@allaroundtheworld.fr
    • 50. info@allaroundtheworld.fr
    • 51. info@allaroundtheworld.fr
    • 52. •  •  •  •  Fine-grained control xUnit-style testing Full Moose integration Reporting info@allaroundtheworld.fr
    • 53. info@allaroundtheworld.fr
    • 54. info@allaroundtheworld.fr
    • 55. info@allaroundtheworld.fr
    • 56. ? info@allaroundtheworld.fr