SlideShare ist ein Scribd-Unternehmen logo
1 von 56
Curtis "Ovid" Poe
http://allaroundtheworld.fr/
http://blogs.perl.org/users/ovid/
http://www.slideshare.net/Ovid/testclassmoose
info@allaroundtheworld.fr
info@allaroundtheworld.fr
• 
• 
• 
• 

OO tests for OO code
Nice performance boost
Easy to organize tests
Already use Moose

info@allaroundtheworld.fr
info@allaroundtheworld.fr
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
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
Solution?
✘
✘
✓

Instantiate the object correctly?

info@allaroundtheworld.fr
• 
• 
• 
• 

We've written two classes
We've written two test classes
We've seen test inheritance
… but it broke our test!

info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
•  It works
•  But we constructed our object twice
•  Wash/rinse/repeat for every test method?

info@allaroundtheworld.fr
Method

Phase
Before each test class
Before each test method
After each test method
After each test class

info@allaroundtheworld.fr
• 
• 
• 
• 
• 

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
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
• 
• 
• 
• 
• 
• 
• 

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
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
• 
• 
• 
• 

Fine-grained control
xUnit-style testing
Full Moose integration
Reporting

info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
info@allaroundtheworld.fr
?
info@allaroundtheworld.fr

Weitere ähnliche Inhalte

Ähnlich wie Test::Class::Moose

Frequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last timeFrequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last time
Andreas Jung
 
How to ship web software like pirates!
How to ship web software like pirates!How to ship web software like pirates!
How to ship web software like pirates!
Sylvain Carle
 

Ähnlich wie Test::Class::Moose (20)

Foundation selenium java
Foundation selenium java Foundation selenium java
Foundation selenium java
 
Code Review: How and When
Code Review: How and WhenCode Review: How and When
Code Review: How and When
 
Practical IronRuby
Practical IronRubyPractical IronRuby
Practical IronRuby
 
Frequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last timeFrequently asked questions answered frequently - but now for the last time
Frequently asked questions answered frequently - but now for the last time
 
Porque VIM?
Porque VIM?Porque VIM?
Porque VIM?
 
Vladimir Primakov - Qa management in big agile teams
Vladimir Primakov - Qa management in big agile teamsVladimir Primakov - Qa management in big agile teams
Vladimir Primakov - Qa management in big agile teams
 
How to ship web software like pirates!
How to ship web software like pirates!How to ship web software like pirates!
How to ship web software like pirates!
 
Dov'è il tasto ok?
Dov'è il tasto ok?Dov'è il tasto ok?
Dov'è il tasto ok?
 
RootedCON 2015 - Deep inside the Java framework Apache Struts
RootedCON 2015 - Deep inside the Java framework Apache StrutsRootedCON 2015 - Deep inside the Java framework Apache Struts
RootedCON 2015 - Deep inside the Java framework Apache Struts
 
Leveling Up at JavaScript
Leveling Up at JavaScriptLeveling Up at JavaScript
Leveling Up at JavaScript
 
Apache Solr - search for everyone!
Apache Solr - search for everyone!Apache Solr - search for everyone!
Apache Solr - search for everyone!
 
Puppet101
Puppet101Puppet101
Puppet101
 
Nif practical
Nif practicalNif practical
Nif practical
 
Selenium IDE and Beyond
Selenium IDE and BeyondSelenium IDE and Beyond
Selenium IDE and Beyond
 
Lingle TESOL France 2012. Todays news in your classroom - Rapid Authentic Tex...
Lingle TESOL France 2012. Todays news in your classroom - Rapid Authentic Tex...Lingle TESOL France 2012. Todays news in your classroom - Rapid Authentic Tex...
Lingle TESOL France 2012. Todays news in your classroom - Rapid Authentic Tex...
 
Introducing OWASP OWTF Workshop BruCon 2012
Introducing OWASP OWTF Workshop BruCon 2012Introducing OWASP OWTF Workshop BruCon 2012
Introducing OWASP OWTF Workshop BruCon 2012
 
200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet Code200,000 Lines Later: Our Journey to Manageable Puppet Code
200,000 Lines Later: Our Journey to Manageable Puppet Code
 
Craig Sullivan - Oh Boy! These A/B tests look like total bullshit! MKTFEST 2014
Craig Sullivan - Oh Boy! These A/B tests look like total bullshit! MKTFEST 2014Craig Sullivan - Oh Boy! These A/B tests look like total bullshit! MKTFEST 2014
Craig Sullivan - Oh Boy! These A/B tests look like total bullshit! MKTFEST 2014
 
Training Webinar: Top front-end techniques for OutSystems
 Training Webinar: Top front-end techniques for OutSystems Training Webinar: Top front-end techniques for OutSystems
Training Webinar: Top front-end techniques for OutSystems
 
Top front-end techniques for OutSystems
Top front-end techniques for OutSystemsTop front-end techniques for OutSystems
Top front-end techniques for OutSystems
 

Mehr von Curtis Poe

A Whirlwind Tour of Test::Class
A Whirlwind Tour of Test::ClassA Whirlwind Tour of Test::Class
A Whirlwind Tour of Test::Class
Curtis Poe
 

Mehr von Curtis Poe (19)

How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
life-off-earth.pptx
life-off-earth.pptxlife-off-earth.pptx
life-off-earth.pptx
 
Corinna-2023.pptx
Corinna-2023.pptxCorinna-2023.pptx
Corinna-2023.pptx
 
Corinna Status 2022.pptx
Corinna Status 2022.pptxCorinna Status 2022.pptx
Corinna Status 2022.pptx
 
Rummaging in the clOOset
Rummaging in the clOOsetRummaging in the clOOset
Rummaging in the clOOset
 
Rescuing a-legacy-codebase
Rescuing a-legacy-codebaseRescuing a-legacy-codebase
Rescuing a-legacy-codebase
 
Perl 6 For Mere Mortals
Perl 6 For Mere MortalsPerl 6 For Mere Mortals
Perl 6 For Mere Mortals
 
Disappearing Managers, YAPC::EU 2014, Bulgaria, Keynote
Disappearing Managers, YAPC::EU 2014, Bulgaria, KeynoteDisappearing Managers, YAPC::EU 2014, Bulgaria, Keynote
Disappearing Managers, YAPC::EU 2014, Bulgaria, Keynote
 
How to Fake a Database Design
How to Fake a Database DesignHow to Fake a Database Design
How to Fake a Database Design
 
Are Managers An Endangered Species?
Are Managers An Endangered Species?Are Managers An Endangered Species?
Are Managers An Endangered Species?
 
The Lies We Tell About Software Testing
The Lies We Tell About Software TestingThe Lies We Tell About Software Testing
The Lies We Tell About Software Testing
 
A Whirlwind Tour of Test::Class
A Whirlwind Tour of Test::ClassA Whirlwind Tour of Test::Class
A Whirlwind Tour of Test::Class
 
Agile Companies Go P.O.P.
Agile Companies Go P.O.P.Agile Companies Go P.O.P.
Agile Companies Go P.O.P.
 
Econ101
Econ101Econ101
Econ101
 
Testing With Test::Class
Testing With Test::ClassTesting With Test::Class
Testing With Test::Class
 
Logic Progamming in Perl
Logic Progamming in PerlLogic Progamming in Perl
Logic Progamming in Perl
 
Inheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth VersionInheritance Versus Roles - The In-Depth Version
Inheritance Versus Roles - The In-Depth Version
 
Inheritance Versus Roles
Inheritance Versus RolesInheritance Versus Roles
Inheritance Versus Roles
 
Turbo Charged Test Suites
Turbo Charged Test SuitesTurbo Charged Test Suites
Turbo Charged Test Suites
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Kürzlich hochgeladen (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Test::Class::Moose

Hinweis der Redaktion

  1. No need to add empty control methods
  2. No need to add empty control methods
  3. No need to add empty control methods
  4. We've skipped some usual Moose boilerplate (namespace::autoclean and make_immutable)
  5. Methods beginning with test_ are test methods.Two objects to every method
  6. This works, but we constructed our object more than once. We don't want duplicated code.