Perl Testing                       Consideration                          (seen from other languages)                     ...
Profile                 • Masaki Nakagawa                 • @ikasam_a                 • metacpan.org/author/MASAKI         ...
Thank you !                 ameblo.jp/yuki-kashiwagi-we/image-11002817849-11452563522.html2011   10   14
Works                 • Embedded Development w/ C++                 • WebApp. Development w/ Ruby                 • Projec...
Embedded Development                 • “Hardware Driven”                 • “The Waterfall”                 • Development P...
Classification of Testing                  Perspective   Target                     How         What2011   10   14
Perspective                      Developer or User (Customer)                 • Developer Testing                 • Accept...
Target                               One or More                 • Unit Testing                 • Integration Testing2011 ...
How                        Techniques for writing tests                 • Black Box Testing                 • White Box Te...
What                           the Purpose of testing                 • Functional Testing                 • Non-Functiona...
Testing Framework                 1. Helping to write tests                 2. Executing tests                 3. Reportin...
Ruby Testing                 www.atmarkit.co.jp/fcoding/rails/articles/passionate/07/passionate07a.html                   ...
e.g.) RSpec                 1. describe ... it ...                 2. $ rspec ...                 3. Spec::Runner::Formatt...
e.g.) Cucumber                 1. Given ... When ... Then ...                 2. $ cucumber ...                 3. Cucumbe...
Many Frameworks2011   10   14
Perl Testing                 1. Test::More, Test::Class,                    Test::Base, Test::Spec, ...                 2....
Perl has TAP2011   10   14
TAP                 • testanything.org                  • “the Test Anything Protocol”                  • “is a simple tex...
Perl <3 TAP                 • From any test description                  •   e.g.) Test::Class, Test::Base, Test::Spec    ...
Rails Testing                  gihyo.jp/magazine/wdpress/archive/2011/vol612011   10   14
Rails Testing                 •   Perspective                     •   UnitTest, End-to-End                 •   Frameworks ...
Catalyst                 • Catalyst::Test                 • Test::WWW::Mechanize::Catalyst                 • Test::WWW::Se...
Plack                 • Plack::Test                 • Test::WWW::Mechanize::PSGI2011   10   14
Browser Integration                 • WWW:: + WAF Customization                  • WWW::Mechanize                  • WWW::...
Test Double                         xunitpatterns.com/Test%20Double.html                 • Mock                  • Test::M...
Test Double                                  xunitpatterns.com/Test%20Double.html                 •   Test::Double (under ...
Test Double                          xunitpatterns.com/Test%20Double.html                 • Spy                  • DBD::Mo...
Descriptive Frameworks                 • Test::More                 • Test::Class (xUnit style)                 • Test::De...
Weakness                 • Expectation and Verification                  • vs. rr, rspec-mocks, mocha, ...                 ...
Comparision                 • Pros                  • TAP-based Test Description                  • Many Helpful Modules  ...
Conclusions                 • About Testing                  • 4 Classifications                  • 3 Elements in Framework...
Thank you!                 Questions?2011   10   14
Upcoming SlideShare
Loading in...5
×

Perl Testing Consideration (seen from other languages)

3,136

Published on

YAPC::Asia Tokyo 2011

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

No Downloads
Views
Total Views
3,136
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
18
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Perl Testing Consideration (seen from other languages)

  1. 1. Perl Testing Consideration (seen from other languages) Masaki Nakagawa YAPC::Asia 2011 Tokyo (yapcasia.org/2011/talk/80)2011 10 14
  2. 2. Profile • Masaki Nakagawa • @ikasam_a • metacpan.org/author/MASAKI • MC of Yokohama.pm (yokohama.pm.org) • github.com/masaki • socialbios.com/ikasam_a • “Pushing the Team B”2011 10 14
  3. 3. Thank you ! ameblo.jp/yuki-kashiwagi-we/image-11002817849-11452563522.html2011 10 14
  4. 4. Works • Embedded Development w/ C++ • WebApp. Development w/ Ruby • Project Management (small) • New Business Development • www.ricoh.co.jp/ucs/ • www.ricoh.co.jp/ucs/P3000/2011 10 14
  5. 5. Embedded Development • “Hardware Driven” • “The Waterfall” • Development Process • QA Process • Systematic Testing2011 10 14
  6. 6. Classification of Testing Perspective Target How What2011 10 14
  7. 7. Perspective Developer or User (Customer) • Developer Testing • Acceptance Testing2011 10 14
  8. 8. Target One or More • Unit Testing • Integration Testing2011 10 14
  9. 9. How Techniques for writing tests • Black Box Testing • White Box Testing2011 10 14
  10. 10. What the Purpose of testing • Functional Testing • Non-Functional Testing • Performance / Stress / Usability / ...2011 10 14
  11. 11. Testing Framework 1. Helping to write tests 2. Executing tests 3. Reporting test results2011 10 14
  12. 12. Ruby Testing www.atmarkit.co.jp/fcoding/rails/articles/passionate/07/passionate07a.html survey.hamptoncatlin.com/survey/stats2011 10 14
  13. 13. e.g.) RSpec 1. describe ... it ... 2. $ rspec ... 3. Spec::Runner::Formatter2011 10 14
  14. 14. e.g.) Cucumber 1. Given ... When ... Then ... 2. $ cucumber ... 3. Cucumber::Formatter2011 10 14
  15. 15. Many Frameworks2011 10 14
  16. 16. Perl Testing 1. Test::More, Test::Class, Test::Base, Test::Spec, ... 2. $ prove ... (TAP::Harness) 3. TAP (TAP::Formatter)2011 10 14
  17. 17. Perl has TAP2011 10 14
  18. 18. TAP • testanything.org • “the Test Anything Protocol” • “is a simple text-based interface” 1..4 ok 1 - Input file opened not ok 2 - First line of the input valid ok 3 - Read the rest of the file not ok 4 - Summarized correctly # TODO Not written yet testanything.org/wiki/index.php/Main_Page2011 10 14
  19. 19. Perl <3 TAP • From any test description • e.g.) Test::Class, Test::Base, Test::Spec • Convert results to non-TAP format • e.g.) TAP::Formatter::JUnit • Easy to write test helpers • e.g.) Test::Exception, Test::Deep, ...2011 10 14
  20. 20. Rails Testing gihyo.jp/magazine/wdpress/archive/2011/vol612011 10 14
  21. 21. Rails Testing • Perspective • UnitTest, End-to-End • Frameworks • Test::Unit (+ Shoulda), RSpec, Cucumber • Browser Integration • Capybara (rack-test, Selenium, Envjs, ...) • Test Double • rspec-mocks, rr, WebMock2011 10 14
  22. 22. Catalyst • Catalyst::Test • Test::WWW::Mechanize::Catalyst • Test::WWW::Selenium::Catalyst2011 10 14
  23. 23. Plack • Plack::Test • Test::WWW::Mechanize::PSGI2011 10 14
  24. 24. Browser Integration • WWW:: + WAF Customization • WWW::Mechanize • WWW::Selenium (Selenium-RC) • not yet for testing • WWW::HtmlUnit • Selenium::Remote::Driver (WebDriver)2011 10 14
  25. 25. Test Double xunitpatterns.com/Test%20Double.html • Mock • Test::MockObject • Test::Mock::Recorder • Stub • Test::Mock::Guard • Test::Mock::LWP::Dispatch2011 10 14
  26. 26. Test Double xunitpatterns.com/Test%20Double.html • Test::Double (under construction) • 0.01 released ! • metacpan.org/release/Test-Double • github.com/masaki/Test-Double • Mocks and Stubs • mock out w/ mocha style • stub out w/ rr style • Collaborators Welcome!!!2011 10 14
  27. 27. Test Double xunitpatterns.com/Test%20Double.html • Spy • DBD::Mock • Fake • Test::mysqld • Test::TCP2011 10 14
  28. 28. Descriptive Frameworks • Test::More • Test::Class (xUnit style) • Test::Declare / Test::More + “subtest” • Test::Spec (RSpec 1 compat.) • Test::Base (Parameterized Tests) • Test::Cukes / Test::BDD::Cucumber (Cucumber clone)2011 10 14
  29. 29. Weakness • Expectation and Verification • vs. rr, rspec-mocks, mocha, ... • Browser Integration API • vs. Capybara, Webrat, ... • Naming of Test Double modules • Test::Mock::Guard is “Stub” module2011 10 14
  30. 30. Comparision • Pros • TAP-based Test Description • Many Helpful Modules • Cons • Non-Uniform Browser Integration • Poor Expectation and Verification2011 10 14
  31. 31. Conclusions • About Testing • 4 Classifications • 3 Elements in Frameworks • Perl and Ruby/Rails Testing Environments • Perl has TAP and Many Great Modules • Learn and Steal MORE from Ruby/Rails • Write More Descriptively2011 10 14
  32. 32. Thank you! Questions?2011 10 14
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×