SlideShare a Scribd company logo
1 of 21
Download to read offline
Introduction                      Test::DBIx::Class::Schema       Future        Finally




                           Mostly Lazy DBIx::Class Testing

                                                Chisel Wright

                                                   Net-A-Porter


                                                       2011




Mostly Lazy DBIx::Class Testing                                            Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




In A Nutshell




                            DBIx::Class schema sanity checking tests




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




Why?




                          Ongoing Quest To Be As LAZY As Possible




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




Non-Lazy



       # are specific columns defined?

       my $thingy = $model->resultset(’BigBagOfFail’);

       my @columns = qw/id name department/);

       can_ok($thingy, @columns);




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




Non-Lazy


       foreach my $column (@columns) {
         try {
           $thingy->$column();
           ok("called $column()");
         }
         catch($e) {
           diag $e;
           fail("$column() failed");
         }
       }



Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




Non-Lazy




       What about . . . ?
               relationships
               custom methods




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




Non-Lazy




               Decide to test something new?
               How many .t files do you need to edit?
               More than zero?
               Too much work!!




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema      Future        Finally




Getting Lazy




                                     Test::DBIx::Class::Schema




Mostly Lazy DBIx::Class Testing                                           Net-A-Porter
Introduction                      Test::DBIx::Class::Schema     Future        Finally




Test::DBIx::Class::Schema




                                       My Attempt At Laziness




Mostly Lazy DBIx::Class Testing                                          Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future         Finally




An example (setup)



       my $schematest              = Test::DBIx::Class::Schema->new({
         # required
         dsn        =>             ’dbi:Pg:dbname=mydb’,
         namespace =>              ’MyDB::Schema’,
         moniker    =>             ’SomeTable’,
         # optional
         username =>               ’some_user’,
         password =>               ’opensesame’,
       });




Mostly Lazy DBIx::Class Testing                                         Net-A-Porter
Introduction                       Test::DBIx::Class::Schema   Future        Finally




An example (config)


       # tell it what to test
       $schematest->methods({
         columns    => [ qw( id name ) ],

           relations              => [ qw( foo ) ],

           custom                 => [ qw( some_method ) ],

         resultsets => [ qw( ) ],
       });



Mostly Lazy DBIx::Class Testing                                         Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




An example (running)




       $schematest->run_tests();




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




You get. . .




               can ok( @columns )
               can ok( @relations )
               can ok( @customs ) # row subs
               can ok( @resultsets ) # rs subs




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




You also get. . .



               $thing->$column called ok
               $thing->$relation called ok
               test that $column exists in the database
               ensure related-source exists
               test self.* and foreign.* columns for relationships
               test proxied relationships
               PASS/FAIL for relationship validity




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




You don’t get




                             Functional Testing



Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




Benefits




               only maintaining a list (or three)
               lots of sanity checking
               find out if someone deletes columns from the database
               upgrading ’TDCS’ improves *.t files for free




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




Recommendations




               Test one table/class per file
               Use Test::Aggregate
               Factor out ->new call for $schema




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema     Future        Finally




In The Real World




               on the CPAN since 2008
               used in production code since 2009
               recent burst of improvements
                      never used to test empty tables - OOPS!
                      used to be quite basic




Mostly Lazy DBIx::Class Testing                                          Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




Did It Work?




                                                  YES!
                                                   IMNSHO




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                      Test::DBIx::Class::Schema   Future        Finally




What Next?




       Wishlist
               relationship reciprocity
               relationships that are coderefs
               db columns that aren’t in the schema?
               tie-in with DBIx::Class::Schema::Loader




Mostly Lazy DBIx::Class Testing                                        Net-A-Porter
Introduction                       Test::DBIx::Class::Schema   Future        Finally




End Credits



                                   QUESTIONS?
       Me:
               chisel.wright@net-a-porter.com
               CPANID: CHISEL
               github:            github.com/chiselwright
       Module:
               metacpan.org/release/Test-DBIx-Class-Schema
               github.com/chiselwright/test-dbix-class-schema


Mostly Lazy DBIx::Class Testing                                         Net-A-Porter

More Related Content

What's hot

Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updatesVinay H G
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapDave Orme
 
OOP with Java - Abstract Classes and Interfaces
OOP with Java - Abstract Classes and InterfacesOOP with Java - Abstract Classes and Interfaces
OOP with Java - Abstract Classes and InterfacesHitesh-Java
 
Session 02 - Elements of Java Language
Session 02 - Elements of Java LanguageSession 02 - Elements of Java Language
Session 02 - Elements of Java LanguagePawanMM
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaDerek Chen-Becker
 
Exception Handling - Continued
Exception Handling - Continued Exception Handling - Continued
Exception Handling - Continued Hitesh-Java
 
Scala in practice
Scala in practiceScala in practice
Scala in practiceTomer Gabel
 
Session 09 - OOP with Java - Part 3
Session 09 - OOP with Java - Part 3Session 09 - OOP with Java - Part 3
Session 09 - OOP with Java - Part 3PawanMM
 
Review Session and Attending Java Interviews
Review Session and Attending Java Interviews Review Session and Attending Java Interviews
Review Session and Attending Java Interviews Hitesh-Java
 
Session 01 - Introduction to Java
Session 01 - Introduction to JavaSession 01 - Introduction to Java
Session 01 - Introduction to JavaPawanMM
 
Session 10 - OOP with Java - Abstract Classes and Interfaces
Session 10 - OOP with Java - Abstract Classes and InterfacesSession 10 - OOP with Java - Abstract Classes and Interfaces
Session 10 - OOP with Java - Abstract Classes and InterfacesPawanMM
 
Core Java Basics
Core Java BasicsCore Java Basics
Core Java BasicsFayis-QA
 
From code to pattern, part one
From code to pattern, part oneFrom code to pattern, part one
From code to pattern, part oneBingfeng Zhao
 
Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsRapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsSimobo
 

What's hot (17)

Java 8 selected updates
Java 8 selected updatesJava 8 selected updates
Java 8 selected updates
 
Refactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 RecapRefactoring to Scala DSLs and LiftOff 2009 Recap
Refactoring to Scala DSLs and LiftOff 2009 Recap
 
OOP with Java - Abstract Classes and Interfaces
OOP with Java - Abstract Classes and InterfacesOOP with Java - Abstract Classes and Interfaces
OOP with Java - Abstract Classes and Interfaces
 
Oop lecture3
Oop lecture3Oop lecture3
Oop lecture3
 
Session 02 - Elements of Java Language
Session 02 - Elements of Java LanguageSession 02 - Elements of Java Language
Session 02 - Elements of Java Language
 
Java OOPs
Java OOPs Java OOPs
Java OOPs
 
A Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to ScalaA Brief, but Dense, Intro to Scala
A Brief, but Dense, Intro to Scala
 
Exception Handling - Continued
Exception Handling - Continued Exception Handling - Continued
Exception Handling - Continued
 
Scala in practice
Scala in practiceScala in practice
Scala in practice
 
Session 09 - OOP with Java - Part 3
Session 09 - OOP with Java - Part 3Session 09 - OOP with Java - Part 3
Session 09 - OOP with Java - Part 3
 
Review Session and Attending Java Interviews
Review Session and Attending Java Interviews Review Session and Attending Java Interviews
Review Session and Attending Java Interviews
 
Session 01 - Introduction to Java
Session 01 - Introduction to JavaSession 01 - Introduction to Java
Session 01 - Introduction to Java
 
Session 10 - OOP with Java - Abstract Classes and Interfaces
Session 10 - OOP with Java - Abstract Classes and InterfacesSession 10 - OOP with Java - Abstract Classes and Interfaces
Session 10 - OOP with Java - Abstract Classes and Interfaces
 
Core Java Basics
Core Java BasicsCore Java Basics
Core Java Basics
 
From code to pattern, part one
From code to pattern, part oneFrom code to pattern, part one
From code to pattern, part one
 
Rapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on RailsRapid Application Development using Ruby on Rails
Rapid Application Development using Ruby on Rails
 
Viva file
Viva fileViva file
Viva file
 

Viewers also liked

Frezza_Christine_Macy’s_classification_of_costume_jewelry
Frezza_Christine_Macy’s_classification_of_costume_jewelryFrezza_Christine_Macy’s_classification_of_costume_jewelry
Frezza_Christine_Macy’s_classification_of_costume_jewelryChristine Frezza
 
Fashion Marketing Week 2
Fashion Marketing Week 2Fashion Marketing Week 2
Fashion Marketing Week 2janemonkey
 
BLSTK Replay n°152 - la revue luxe et digitale 25.02 au 02.03.16
BLSTK Replay n°152 - la revue luxe et digitale 25.02 au 02.03.16BLSTK Replay n°152 - la revue luxe et digitale 25.02 au 02.03.16
BLSTK Replay n°152 - la revue luxe et digitale 25.02 au 02.03.16Balistik Art
 
Fashion Brand Managment - Marchesa
Fashion Brand Managment - MarchesaFashion Brand Managment - Marchesa
Fashion Brand Managment - MarchesaShirley, Yan Yu Tin
 
[NET-A-PORTER] 9 Persuasive Principle Used by NET-A-PORTER to Boost their Con...
[NET-A-PORTER] 9 Persuasive Principle Used by NET-A-PORTER to Boost their Con...[NET-A-PORTER] 9 Persuasive Principle Used by NET-A-PORTER to Boost their Con...
[NET-A-PORTER] 9 Persuasive Principle Used by NET-A-PORTER to Boost their Con...Convertize
 
Fashion Marketing Ch 2
Fashion Marketing Ch 2Fashion Marketing Ch 2
Fashion Marketing Ch 2Msotter
 
hallu - Japanese Fashion Brand Pitch May 2015
hallu - Japanese Fashion Brand Pitch May 2015hallu - Japanese Fashion Brand Pitch May 2015
hallu - Japanese Fashion Brand Pitch May 2015Daisuke Ishii
 
Fashion marketing : Marketing statement, object,Marketing plan, Marketing str...
Fashion marketing : Marketing statement, object,Marketing plan, Marketing str...Fashion marketing : Marketing statement, object,Marketing plan, Marketing str...
Fashion marketing : Marketing statement, object,Marketing plan, Marketing str...BGMEA University of Fashion & Technology
 
NET-A-PORTER - DIGITAL MEDIA STRATEGY
NET-A-PORTER - DIGITAL MEDIA STRATEGYNET-A-PORTER - DIGITAL MEDIA STRATEGY
NET-A-PORTER - DIGITAL MEDIA STRATEGYXue Kang
 
Fashion marketing basics
Fashion marketing basicsFashion marketing basics
Fashion marketing basicsranjan trivedy
 
Versace fashion Brand Analyses presentation
Versace fashion Brand Analyses presentationVersace fashion Brand Analyses presentation
Versace fashion Brand Analyses presentationHimel Hawlader
 
Building elements and experiences at Net-A-Porter
Building elements and experiences at Net-A-PorterBuilding elements and experiences at Net-A-Porter
Building elements and experiences at Net-A-PorterRobin Glen
 
Assortment ss 2015 Stella McCartney
Assortment ss 2015 Stella McCartneyAssortment ss 2015 Stella McCartney
Assortment ss 2015 Stella McCartneyvibber
 
How to Design Compelling Content Experiences
How to Design Compelling Content ExperiencesHow to Design Compelling Content Experiences
How to Design Compelling Content ExperiencesUberflip
 

Viewers also liked (20)

Frezza_Christine_Macy’s_classification_of_costume_jewelry
Frezza_Christine_Macy’s_classification_of_costume_jewelryFrezza_Christine_Macy’s_classification_of_costume_jewelry
Frezza_Christine_Macy’s_classification_of_costume_jewelry
 
Phoenix Fashion Week 2016 Digital Program
Phoenix Fashion Week 2016 Digital ProgramPhoenix Fashion Week 2016 Digital Program
Phoenix Fashion Week 2016 Digital Program
 
Fashion Marketing Week 2
Fashion Marketing Week 2Fashion Marketing Week 2
Fashion Marketing Week 2
 
BLSTK Replay n°152 - la revue luxe et digitale 25.02 au 02.03.16
BLSTK Replay n°152 - la revue luxe et digitale 25.02 au 02.03.16BLSTK Replay n°152 - la revue luxe et digitale 25.02 au 02.03.16
BLSTK Replay n°152 - la revue luxe et digitale 25.02 au 02.03.16
 
Fashion Brand Managment - Marchesa
Fashion Brand Managment - MarchesaFashion Brand Managment - Marchesa
Fashion Brand Managment - Marchesa
 
[NET-A-PORTER] 9 Persuasive Principle Used by NET-A-PORTER to Boost their Con...
[NET-A-PORTER] 9 Persuasive Principle Used by NET-A-PORTER to Boost their Con...[NET-A-PORTER] 9 Persuasive Principle Used by NET-A-PORTER to Boost their Con...
[NET-A-PORTER] 9 Persuasive Principle Used by NET-A-PORTER to Boost their Con...
 
Fashion Marketing Ch 2
Fashion Marketing Ch 2Fashion Marketing Ch 2
Fashion Marketing Ch 2
 
hallu - Japanese Fashion Brand Pitch May 2015
hallu - Japanese Fashion Brand Pitch May 2015hallu - Japanese Fashion Brand Pitch May 2015
hallu - Japanese Fashion Brand Pitch May 2015
 
Fashion marketing : Marketing statement, object,Marketing plan, Marketing str...
Fashion marketing : Marketing statement, object,Marketing plan, Marketing str...Fashion marketing : Marketing statement, object,Marketing plan, Marketing str...
Fashion marketing : Marketing statement, object,Marketing plan, Marketing str...
 
Fashion Marketing (Branding)
Fashion Marketing (Branding)Fashion Marketing (Branding)
Fashion Marketing (Branding)
 
Vietnamese fashion brand recognition survey
Vietnamese fashion brand recognition surveyVietnamese fashion brand recognition survey
Vietnamese fashion brand recognition survey
 
NET-A-PORTER - DIGITAL MEDIA STRATEGY
NET-A-PORTER - DIGITAL MEDIA STRATEGYNET-A-PORTER - DIGITAL MEDIA STRATEGY
NET-A-PORTER - DIGITAL MEDIA STRATEGY
 
Fashion market studies_thailand_22042015
Fashion market studies_thailand_22042015Fashion market studies_thailand_22042015
Fashion market studies_thailand_22042015
 
Fashion marketing basics
Fashion marketing basicsFashion marketing basics
Fashion marketing basics
 
Versace fashion Brand Analyses presentation
Versace fashion Brand Analyses presentationVersace fashion Brand Analyses presentation
Versace fashion Brand Analyses presentation
 
Chapter 1 Fashion Marketing
Chapter   1 Fashion MarketingChapter   1 Fashion Marketing
Chapter 1 Fashion Marketing
 
Building elements and experiences at Net-A-Porter
Building elements and experiences at Net-A-PorterBuilding elements and experiences at Net-A-Porter
Building elements and experiences at Net-A-Porter
 
Assortment ss 2015 Stella McCartney
Assortment ss 2015 Stella McCartneyAssortment ss 2015 Stella McCartney
Assortment ss 2015 Stella McCartney
 
How to Design Compelling Content Experiences
How to Design Compelling Content ExperiencesHow to Design Compelling Content Experiences
How to Design Compelling Content Experiences
 
Net-a-Porter Social Media
Net-a-Porter Social MediaNet-a-Porter Social Media
Net-a-Porter Social Media
 

Similar to YAPC::EU::2011 - Mostly Lazy DBIx::Class Testing

Test::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTest::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTokuhiro Matsuno
 
WebNano - Ideas for Web Frameworks
WebNano - Ideas for Web FrameworksWebNano - Ideas for Web Frameworks
WebNano - Ideas for Web Frameworksguestf89f9cb
 
Modernizing Legacy Applications in PHP, por Paul Jones
Modernizing Legacy Applications in PHP, por Paul JonesModernizing Legacy Applications in PHP, por Paul Jones
Modernizing Legacy Applications in PHP, por Paul JonesiMasters
 
Ruby On Rails Overview
Ruby On Rails OverviewRuby On Rails Overview
Ruby On Rails Overviewjonkinney
 
How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)Felix Geisendörfer
 
2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD WorkshopWolfram Arnold
 
Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»e-Legion
 
Making friends with TDD
Making friends with TDDMaking friends with TDD
Making friends with TDDJohn Cleary
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Workhorse Computing
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011tobiascrawley
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyNick Sieger
 
Liquibase - Open Source version control for your database
Liquibase - Open Source version control for your databaseLiquibase - Open Source version control for your database
Liquibase - Open Source version control for your databaseBlaine Carter
 
JRuby e DSL
JRuby e DSLJRuby e DSL
JRuby e DSLjodosha
 
Ruby: Beyond the Basics
Ruby: Beyond the BasicsRuby: Beyond the Basics
Ruby: Beyond the BasicsMichael Koby
 
First adoption hackathon at BGJUG
First adoption hackathon at BGJUGFirst adoption hackathon at BGJUG
First adoption hackathon at BGJUGIvan Ivanov
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for RubyHiroshi SHIBATA
 

Similar to YAPC::EU::2011 - Mostly Lazy DBIx::Class Testing (20)

Test::Kantan - Perl and Testing
Test::Kantan - Perl and TestingTest::Kantan - Perl and Testing
Test::Kantan - Perl and Testing
 
WebNano - Ideas for Web Frameworks
WebNano - Ideas for Web FrameworksWebNano - Ideas for Web Frameworks
WebNano - Ideas for Web Frameworks
 
Sanity on Rails
Sanity on RailsSanity on Rails
Sanity on Rails
 
Modernizing Legacy Applications in PHP, por Paul Jones
Modernizing Legacy Applications in PHP, por Paul JonesModernizing Legacy Applications in PHP, por Paul Jones
Modernizing Legacy Applications in PHP, por Paul Jones
 
Scalax
ScalaxScalax
Scalax
 
Testing con spock
Testing con spockTesting con spock
Testing con spock
 
Ruby On Rails Overview
Ruby On Rails OverviewRuby On Rails Overview
Ruby On Rails Overview
 
How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)How to Test Asynchronous Code (v2)
How to Test Asynchronous Code (v2)
 
2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop2011-02-03 LA RubyConf Rails3 TDD Workshop
2011-02-03 LA RubyConf Rails3 TDD Workshop
 
Intro to J Ruby
Intro to J RubyIntro to J Ruby
Intro to J Ruby
 
Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»Rafael Bagmanov «Scala in a wild enterprise»
Rafael Bagmanov «Scala in a wild enterprise»
 
Making friends with TDD
Making friends with TDDMaking friends with TDD
Making friends with TDD
 
Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.Object Trampoline: Why having not the object you want is what you need.
Object Trampoline: Why having not the object you want is what you need.
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 
Liquibase - Open Source version control for your database
Liquibase - Open Source version control for your databaseLiquibase - Open Source version control for your database
Liquibase - Open Source version control for your database
 
JRuby e DSL
JRuby e DSLJRuby e DSL
JRuby e DSL
 
Ruby: Beyond the Basics
Ruby: Beyond the BasicsRuby: Beyond the Basics
Ruby: Beyond the Basics
 
First adoption hackathon at BGJUG
First adoption hackathon at BGJUGFirst adoption hackathon at BGJUG
First adoption hackathon at BGJUG
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 

Recently uploaded

Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...FIDO Alliance
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTopCSSGallery
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Skynet Technologies
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 

Recently uploaded (20)

Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 

YAPC::EU::2011 - Mostly Lazy DBIx::Class Testing

  • 1. Introduction Test::DBIx::Class::Schema Future Finally Mostly Lazy DBIx::Class Testing Chisel Wright Net-A-Porter 2011 Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 2. Introduction Test::DBIx::Class::Schema Future Finally In A Nutshell DBIx::Class schema sanity checking tests Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 3. Introduction Test::DBIx::Class::Schema Future Finally Why? Ongoing Quest To Be As LAZY As Possible Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 4. Introduction Test::DBIx::Class::Schema Future Finally Non-Lazy # are specific columns defined? my $thingy = $model->resultset(’BigBagOfFail’); my @columns = qw/id name department/); can_ok($thingy, @columns); Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 5. Introduction Test::DBIx::Class::Schema Future Finally Non-Lazy foreach my $column (@columns) { try { $thingy->$column(); ok("called $column()"); } catch($e) { diag $e; fail("$column() failed"); } } Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 6. Introduction Test::DBIx::Class::Schema Future Finally Non-Lazy What about . . . ? relationships custom methods Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 7. Introduction Test::DBIx::Class::Schema Future Finally Non-Lazy Decide to test something new? How many .t files do you need to edit? More than zero? Too much work!! Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 8. Introduction Test::DBIx::Class::Schema Future Finally Getting Lazy Test::DBIx::Class::Schema Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 9. Introduction Test::DBIx::Class::Schema Future Finally Test::DBIx::Class::Schema My Attempt At Laziness Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 10. Introduction Test::DBIx::Class::Schema Future Finally An example (setup) my $schematest = Test::DBIx::Class::Schema->new({ # required dsn => ’dbi:Pg:dbname=mydb’, namespace => ’MyDB::Schema’, moniker => ’SomeTable’, # optional username => ’some_user’, password => ’opensesame’, }); Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 11. Introduction Test::DBIx::Class::Schema Future Finally An example (config) # tell it what to test $schematest->methods({ columns => [ qw( id name ) ], relations => [ qw( foo ) ], custom => [ qw( some_method ) ], resultsets => [ qw( ) ], }); Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 12. Introduction Test::DBIx::Class::Schema Future Finally An example (running) $schematest->run_tests(); Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 13. Introduction Test::DBIx::Class::Schema Future Finally You get. . . can ok( @columns ) can ok( @relations ) can ok( @customs ) # row subs can ok( @resultsets ) # rs subs Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 14. Introduction Test::DBIx::Class::Schema Future Finally You also get. . . $thing->$column called ok $thing->$relation called ok test that $column exists in the database ensure related-source exists test self.* and foreign.* columns for relationships test proxied relationships PASS/FAIL for relationship validity Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 15. Introduction Test::DBIx::Class::Schema Future Finally You don’t get Functional Testing Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 16. Introduction Test::DBIx::Class::Schema Future Finally Benefits only maintaining a list (or three) lots of sanity checking find out if someone deletes columns from the database upgrading ’TDCS’ improves *.t files for free Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 17. Introduction Test::DBIx::Class::Schema Future Finally Recommendations Test one table/class per file Use Test::Aggregate Factor out ->new call for $schema Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 18. Introduction Test::DBIx::Class::Schema Future Finally In The Real World on the CPAN since 2008 used in production code since 2009 recent burst of improvements never used to test empty tables - OOPS! used to be quite basic Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 19. Introduction Test::DBIx::Class::Schema Future Finally Did It Work? YES! IMNSHO Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 20. Introduction Test::DBIx::Class::Schema Future Finally What Next? Wishlist relationship reciprocity relationships that are coderefs db columns that aren’t in the schema? tie-in with DBIx::Class::Schema::Loader Mostly Lazy DBIx::Class Testing Net-A-Porter
  • 21. Introduction Test::DBIx::Class::Schema Future Finally End Credits QUESTIONS? Me: chisel.wright@net-a-porter.com CPANID: CHISEL github: github.com/chiselwright Module: metacpan.org/release/Test-DBIx-Class-Schema github.com/chiselwright/test-dbix-class-schema Mostly Lazy DBIx::Class Testing Net-A-Porter