Continuous testing and deployment in Perl (London.pm Technical Meeting October 2012)

Alex Balhatchet
Alex BalhatchetCTO at Lokku
Continuous
Deployment in Perl
Presentation by Alex Balhatchet (KAORU)
Intro
What is continuous deployment?


Commit Changes




                 Deploy Changes
                                  As quickly as
                                  possible! :-)

 Test Changes
Committing Changes

● Use your favourite VCS

● Push the changes somewhere centralized
  (staging/testing environment)

● This should kick off a "build and test" cycle if
  one is not currently running
Testing Changes

Perl is absolutely fantastic for testing.

● TAP

● TAP::Harness / App::Prove

● Test::Builder / Test::More
Deploying Changes

● Pick your favourite deployment method

● Make it as fast as possible

● Make it as easy as possible
Challenges

● Fast tests

● Reliable tests

● Fast deployment
Challenges

● Fast tests
                    Focus of this talk
● Reliable tests

● Fast deployment
Perl Testing
TAP::Harness
and App::Prove
TAP::Harness and App::Prove

/usr/bin/prove

     uses App::Prove

           uses TAP::Harness
App::Prove features - basics

● Run lots of tests with one command

● Hide non-failure output

● Run tests in parallel

● Show timing information
App::Prove features - basics

alex@karin$ prove -l -r -j 16 t/
t/00-load.t .......... ok
t/01-backup.t ........ ok
t/02-delete_files.t .. ok
All tests successful.
Files=3, Tests=51, 1 wallclock secs ( 0.06 usr
0.01 sys + 0.78 cusr 0.20 csys = 1.05 CPU)
Result: PASS
App::Prove features - advanced

● Load plugins from App::Prove::Plugin::*

● Save the TAP results to a .tgz archive

● Save state between runs and use that state
  to change the order for future runs
App::Prove features - advanced
alex@karin$ prove -l -r --state=hot,all,save t/
No saved state, selection will be empty
t/00-load.t .. ok
t/01-good.t .. ok
t/02-bad.t ... 1/1



alex@karin$ prove -l -r --state=hot,all,save t/
t/02-bad.t ... 1/1   <===== Runs first!
t/00-load.t .. ok
t/01-good.t .. ok
App::Prove features - advanced

Other "state" options:

● slow - very useful with -j N

● fresh - only run the tests you need to

● last - same as last run, even with --shuffle
Test::Aggregate
Test::Aggregate

● Combine multiple .t files into a single file

● Avoids compilation overhead

● Therefore speeds up your tests!
Test::Aggregate::Nested

● Alpha code

● Uses the fairly recently added syntax for
  subtests in TAP

● Works really well for us!
Test::Aggregate caveats

● Breaks BEGIN and END blocks

  (use Scope::Guard instead!)

● exit() is also a bad idea!

● Be aware of Test modules which use these

  (Test::NoWarnings is the most common!)
Parallelisation of Aggregated Tests
Currently closed source - sorry! The logic is:

   i. Split up tests into N groups

  ii. Copy .t files into temporary directory

  iii. Write temporary .t file that uses Test::
       Aggregate::Nested

 iv. Run those tests with prove -j N
TAP::Harness
::Archive
TAP::Harness::Archive

● "isa" TAP::Harness

● Stores the TAP output in a tar archive

● Gives you full TAP even when running in
  parallel

● Allows you to run your tests once and then
  format the results in multiple ways
How we format our TAP

● Process the output from our parallelised
  aggregated test runs

● Match up the failures with the .t files

● Write a summary in Markdown format that's
  later converted to HTML and emailed to us
How you might format your TAP

● TAP::Formatter::JUnit (eg. for Jenkins)

● TAP::Formatter::TeamCity

● TAP::Formatter::HTML
TAP::Formatter::HTML example
TAP::Formatter::HTML example
Putting it all
together
Continuous Deployment at Lokku

    svn commit                         On test success new code is
                                          automatically pushed

                                       Deployment is one command
                                             and very quick


   Perl daemon notices commit

Parallelised and aggregated test run
            starts running

Nicely formatted results are emailed
        on success or failure
What's next?
What's next?

● Test::WWW::Selenium::More

● Faster tests - more unit tests, fewer
  integration tests

● Parallelised deployment
Thanks!
Any questions?
1 of 32

Recommended

Automating Perl deployments with Hudson by
Automating Perl deployments with HudsonAutomating Perl deployments with Hudson
Automating Perl deployments with Hudsonnachbaur
6.2K views24 slides
Managing Modules Without Going Crazy (NPW 2007) by
Managing Modules Without Going Crazy (NPW 2007)Managing Modules Without Going Crazy (NPW 2007)
Managing Modules Without Going Crazy (NPW 2007)brian d foy
1.8K views20 slides
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004) by
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)brian d foy
1.5K views19 slides
Cypress Automation by
Cypress  AutomationCypress  Automation
Cypress AutomationSusantha Pathirana
2.9K views12 slides
Ava unit test by
Ava unit testAva unit test
Ava unit testMohamed Ahmed
85 views9 slides
SKILLWISE_SELENIUM by
SKILLWISE_SELENIUMSKILLWISE_SELENIUM
SKILLWISE_SELENIUMSkillwise Consulting
272 views25 slides

More Related Content

What's hot

Helpful Automation Techniques - Selenium Camp 2014 by
Helpful Automation Techniques - Selenium Camp 2014Helpful Automation Techniques - Selenium Camp 2014
Helpful Automation Techniques - Selenium Camp 2014Justin Ison
1.5K views31 slides
Create an architecture for web test automation by
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automationElias Nogueira
1.2K views26 slides
Cypress e2e automation testing - day1 intor by: Hassan Hameed by
Cypress e2e automation testing -  day1 intor by: Hassan HameedCypress e2e automation testing -  day1 intor by: Hassan Hameed
Cypress e2e automation testing - day1 intor by: Hassan HameedHassan Muhammad
402 views19 slides
Jellyfish, JSCONF 2011 by
Jellyfish, JSCONF 2011Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Adam Christian
17K views21 slides
Selenium Israel Meetup by
Selenium Israel MeetupSelenium Israel Meetup
Selenium Israel MeetupJustin Ison
949 views16 slides
Octopus Deploy @Erie Day of Code by
Octopus Deploy @Erie Day of CodeOctopus Deploy @Erie Day of Code
Octopus Deploy @Erie Day of CodeCassey Lottman
283 views42 slides

What's hot(20)

Helpful Automation Techniques - Selenium Camp 2014 by Justin Ison
Helpful Automation Techniques - Selenium Camp 2014Helpful Automation Techniques - Selenium Camp 2014
Helpful Automation Techniques - Selenium Camp 2014
Justin Ison1.5K views
Create an architecture for web test automation by Elias Nogueira
Create an architecture for web test automationCreate an architecture for web test automation
Create an architecture for web test automation
Elias Nogueira1.2K views
Cypress e2e automation testing - day1 intor by: Hassan Hameed by Hassan Muhammad
Cypress e2e automation testing -  day1 intor by: Hassan HameedCypress e2e automation testing -  day1 intor by: Hassan Hameed
Cypress e2e automation testing - day1 intor by: Hassan Hameed
Hassan Muhammad402 views
Selenium Israel Meetup by Justin Ison
Selenium Israel MeetupSelenium Israel Meetup
Selenium Israel Meetup
Justin Ison949 views
Octopus Deploy @Erie Day of Code by Cassey Lottman
Octopus Deploy @Erie Day of CodeOctopus Deploy @Erie Day of Code
Octopus Deploy @Erie Day of Code
Cassey Lottman283 views
Cypress first impressions by Hans Emmel
Cypress first impressionsCypress first impressions
Cypress first impressions
Hans Emmel219 views
DCAST Meetup - Washington, DC Feb 2016 by Justin Ison
DCAST Meetup - Washington, DC Feb 2016DCAST Meetup - Washington, DC Feb 2016
DCAST Meetup - Washington, DC Feb 2016
Justin Ison241 views
Introducing Ghost Inspector by Neil Mansilla
Introducing Ghost InspectorIntroducing Ghost Inspector
Introducing Ghost Inspector
Neil Mansilla807 views
Deployment taken seriously with Octopus Deploy and TeamCity by Tomas Jansson
Deployment taken seriously with Octopus Deploy and TeamCityDeployment taken seriously with Octopus Deploy and TeamCity
Deployment taken seriously with Octopus Deploy and TeamCity
Tomas Jansson3K views
Serverless in production, an experience report (Going Serverless, 28 Feb 2018) by Domas Lasauskas
Serverless in production, an experience report (Going Serverless, 28 Feb 2018)Serverless in production, an experience report (Going Serverless, 28 Feb 2018)
Serverless in production, an experience report (Going Serverless, 28 Feb 2018)
Domas Lasauskas64 views
Why you should switch to Cypress for modern web testing? by Shivam Bharadwaj
Why you should switch to Cypress for modern web testing?Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?
Shivam Bharadwaj1.1K views
Apache JMeter Introduction by Søren Lund
Apache JMeter IntroductionApache JMeter Introduction
Apache JMeter Introduction
Søren Lund691 views
Belfast Selenium Meetup by Justin Ison
Belfast Selenium MeetupBelfast Selenium Meetup
Belfast Selenium Meetup
Justin Ison461 views
Django strategy-test by Royce Haynes
Django strategy-testDjango strategy-test
Django strategy-test
Royce Haynes439 views
Octopus Deploy Tech Fest 2014 by adriantwright
Octopus Deploy Tech Fest 2014Octopus Deploy Tech Fest 2014
Octopus Deploy Tech Fest 2014
adriantwright1K views

Similar to Continuous testing and deployment in Perl (London.pm Technical Meeting October 2012)

Running and Developing Tests with the Apache::Test Framework by
Running and Developing Tests with the Apache::Test FrameworkRunning and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test Frameworkwebhostingguy
5.6K views60 slides
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive... by
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios
1.1K views69 slides
Into The Box 2018 | Assert control over your legacy applications by
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applicationsOrtus Solutions, Corp
348 views40 slides
Unit Testing and TDD 2017 by
Unit Testing and TDD 2017Unit Testing and TDD 2017
Unit Testing and TDD 2017Xavi Hidalgo
440 views65 slides
Unit testing (eng) by
Unit testing (eng)Unit testing (eng)
Unit testing (eng)Anatoliy Okhotnikov
1.3K views35 slides
Containerize your Blackbox tests by
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox testsKevin Beeman
51 views43 slides

Similar to Continuous testing and deployment in Perl (London.pm Technical Meeting October 2012)(20)

Running and Developing Tests with the Apache::Test Framework by webhostingguy
Running and Developing Tests with the Apache::Test FrameworkRunning and Developing Tests with the Apache::Test Framework
Running and Developing Tests with the Apache::Test Framework
webhostingguy5.6K views
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive... by Nagios
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
Nagios1.1K views
Into The Box 2018 | Assert control over your legacy applications by Ortus Solutions, Corp
Into The Box 2018 | Assert control over your legacy applicationsInto The Box 2018 | Assert control over your legacy applications
Into The Box 2018 | Assert control over your legacy applications
Unit Testing and TDD 2017 by Xavi Hidalgo
Unit Testing and TDD 2017Unit Testing and TDD 2017
Unit Testing and TDD 2017
Xavi Hidalgo440 views
Containerize your Blackbox tests by Kevin Beeman
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
Kevin Beeman51 views
Test Presentation by setitesuk
Test PresentationTest Presentation
Test Presentation
setitesuk2K views
Property-based testing an open-source compiler, pflua (FOSDEM 2015) by Igalia
Property-based testing an open-source compiler, pflua (FOSDEM 2015)Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Igalia476 views
Unit testing legacy code by Lars Thorup
Unit testing legacy codeUnit testing legacy code
Unit testing legacy code
Lars Thorup2K views
Test Driven Development with Sql Server by David P. Moore
Test Driven Development with Sql ServerTest Driven Development with Sql Server
Test Driven Development with Sql Server
David P. Moore224 views
Testing Spark and Scala by datamantra
Testing Spark and ScalaTesting Spark and Scala
Testing Spark and Scala
datamantra2.1K views
POUG2019 - Test your PL/SQL - your database will love you by Jacek Gebal
POUG2019 - Test your PL/SQL - your database will love youPOUG2019 - Test your PL/SQL - your database will love you
POUG2019 - Test your PL/SQL - your database will love you
Jacek Gebal261 views
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08 by Борис Зора
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Continuous Delivery with Jenkins declarative pipeline XPDays-2018-12-08
Test automation principles, terminologies and implementations by Steven Li
Test automation principles, terminologies and implementationsTest automation principles, terminologies and implementations
Test automation principles, terminologies and implementations
Steven Li778 views
Bgoug 2019.11 test your pl sql - not your patience by Jacek Gebal
Bgoug 2019.11   test your pl sql - not your patienceBgoug 2019.11   test your pl sql - not your patience
Bgoug 2019.11 test your pl sql - not your patience
Jacek Gebal68 views
Break through e2e-testing by tameemahmed5
Break through e2e-testingBreak through e2e-testing
Break through e2e-testing
tameemahmed5243 views

More from Alex Balhatchet

Geocoding the World in Perl YAPC::EU 2014 by
Geocoding the World in Perl YAPC::EU 2014Geocoding the World in Perl YAPC::EU 2014
Geocoding the World in Perl YAPC::EU 2014Alex Balhatchet
1.4K views33 slides
Test Kit 2.0 YAPC::EU 2014 Lightning Talk by
Test Kit 2.0 YAPC::EU 2014 Lightning TalkTest Kit 2.0 YAPC::EU 2014 Lightning Talk
Test Kit 2.0 YAPC::EU 2014 Lightning TalkAlex Balhatchet
930 views22 slides
Nestoria Dev Blog YAPC::EU 2014 Lightning Talk by
Nestoria Dev Blog YAPC::EU 2014 Lightning TalkNestoria Dev Blog YAPC::EU 2014 Lightning Talk
Nestoria Dev Blog YAPC::EU 2014 Lightning TalkAlex Balhatchet
1.1K views15 slides
Test::Kit 2.0 (London.pm Technical Meeting July 2014) by
Test::Kit 2.0 (London.pm Technical Meeting July 2014)Test::Kit 2.0 (London.pm Technical Meeting July 2014)
Test::Kit 2.0 (London.pm Technical Meeting July 2014)Alex Balhatchet
1.2K views32 slides
Perl 101 by
Perl 101Perl 101
Perl 101Alex Balhatchet
2.8K views51 slides
App::highlight - a simple grep-like highlighter app by
App::highlight - a simple grep-like highlighter appApp::highlight - a simple grep-like highlighter app
App::highlight - a simple grep-like highlighter appAlex Balhatchet
15.7K views28 slides

More from Alex Balhatchet(10)

Geocoding the World in Perl YAPC::EU 2014 by Alex Balhatchet
Geocoding the World in Perl YAPC::EU 2014Geocoding the World in Perl YAPC::EU 2014
Geocoding the World in Perl YAPC::EU 2014
Alex Balhatchet1.4K views
Test Kit 2.0 YAPC::EU 2014 Lightning Talk by Alex Balhatchet
Test Kit 2.0 YAPC::EU 2014 Lightning TalkTest Kit 2.0 YAPC::EU 2014 Lightning Talk
Test Kit 2.0 YAPC::EU 2014 Lightning Talk
Alex Balhatchet930 views
Nestoria Dev Blog YAPC::EU 2014 Lightning Talk by Alex Balhatchet
Nestoria Dev Blog YAPC::EU 2014 Lightning TalkNestoria Dev Blog YAPC::EU 2014 Lightning Talk
Nestoria Dev Blog YAPC::EU 2014 Lightning Talk
Alex Balhatchet1.1K views
Test::Kit 2.0 (London.pm Technical Meeting July 2014) by Alex Balhatchet
Test::Kit 2.0 (London.pm Technical Meeting July 2014)Test::Kit 2.0 (London.pm Technical Meeting July 2014)
Test::Kit 2.0 (London.pm Technical Meeting July 2014)
Alex Balhatchet1.2K views
App::highlight - a simple grep-like highlighter app by Alex Balhatchet
App::highlight - a simple grep-like highlighter appApp::highlight - a simple grep-like highlighter app
App::highlight - a simple grep-like highlighter app
Alex Balhatchet15.7K views
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version) by Alex Balhatchet
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Introduction to Writing Readable and Maintainable Perl (YAPC::EU 2011 Version)
Alex Balhatchet1.2K views
Introduction to writing readable and maintainable Perl by Alex Balhatchet
Introduction to writing readable and maintainable PerlIntroduction to writing readable and maintainable Perl
Introduction to writing readable and maintainable Perl
Alex Balhatchet4.5K views

Continuous testing and deployment in Perl (London.pm Technical Meeting October 2012)