SlideShare a Scribd company logo
1 of 31
Download to read offline
Test   automatici2
                 per
  applicazioni Web
 Stefano Rodighiero - larsen@perl.it
Scrivere software
           =
Gestire la complessità
Complessità

You might think of this as mental juggling - the more mental
balls the program requires you to keep in the air at once, the
more likely you’ll drop one of the balls, leading to a design or
                         coding error.
                                             -- Steve McConnell
Gestire la complessità

• Loose coupling
• Tecniche standard
• KISS
• Test?
Test?

    «Testing by itself does not improve software quality. [...]
Trying to improve software by increasing the amount of testing
 is like trying to lose weight by weighting yourself more often»
                                              -- Steve McConnell
Test!
• Aumenta indirettamente la qualità del
  software
• Design for testing
• Refactoring
• Wishful thinking
• Confidenza con il proprio codice
Esempio

#!/usr/bin/perl -w

use Test::Simple tests => 2;
use Date::ICal;

my $ical = Date::ICal->new;     # make an object
ok( defined $ical );            # check we got something
ok( $ical->isa('Date::ICal') ); # and it's the right class
Gradualmente

• prova.pl → t/01_base.t
• diag()
• Usare gli occhi
• map <F8> :! prove        %<C-M>
• YMMV :)
Applicazioni web
Paradigma MVC

    Presentazione   Model




      Controllo
Test di videogame


• Situazioni difficili da riprodurre
• Grande complessità
• Chi effettua il test non è il programmatore
?
Test di applicazioni web


• Workflow complessi
• Quello che non è automatico tende a non
  essere fatto
WWW::Mechanize
#!/usr/bin/perl

use strict;
use warnings;

use WWW::Mechanize;

my $agent = WWW::Mechanize->new();
$agent->get( 'http://www.google.com' );
print $agent->content();
Test::WWW::Mechanize
#!/usr/bin/perl

use strict;
use warnings;

use Test::More qw/ no_plan /;
use Test::WWW::Mechanize;

my $agent = Test::WWW::Mechanize->new();
$agent->get_ok( 'http://www.google.com' );
$agent->title_is( 'Google' );
WWW::Mechanize::Shell

calvin:~ larsen$ perl -MWWW::Mechanize::Shell -e shell
>g http://www.google.com
Retrieving http://www.google.com(200)
http://www.google.com>script mech3.pl
http://www.google.com>quit
calvin:~ larsen$
WWW::Mechanize::Shell
 #!perl -w
 use strict;
 use WWW::Mechanize;
 use WWW::Mechanize::FormFiller;
 use URI::URL;

 my $agent = WWW::Mechanize->new( autocheck => 1 );
 my $formfiller = WWW::Mechanize::FormFiller->new();
 $agent->env_proxy();

 $agent->get('http://www.google.com');
 $agent->form(1) if $agent->forms
                and scalar @{$agent->forms};
                        mech3.pl
HTTP::Recorder
proxy.pl
#!/usr/bin/perl

use strict;
use warnings;

use HTTP::Proxy qw/ :log /;
use HTTP::Recorder;

my $proxy = HTTP::Proxy->new;
my $agent = HTTP::Recorder->new( file => quot;/tmp/tmpfilequot;
                               , showwindow => 1
                               );

$proxy->logmask( STATUS | PROCESS | HEADERS );
$proxy->port( 3128 );
$proxy->host( '' );
$proxy->agent( $agent );
$proxy->start();
Demo
Idee

• Usare proxy.pl con un sistema di bugtracking
  (il ticket contiene il codice per riprodurre
  l’errore)
• Testare applicazioni non scritte in Perl
• Screenscraping
Conclusioni

• Integrate le pratiche di testing nel vostro
  workflow lavorativo
• Gradualmente!
• Sono pratiche che pagano da subito
• Come posso progettare il codice per
  facilitarne il test?
Monday, I could wait till Tuesday
If I make up my mind
Wednesday would be fine, Thursday’s on my mind
Friday’d give me time, Saturday could wait
But Sunday’d be too late
-- Sting
Grazie :)

      larsen@perl.it
http://larsen.perlmonk.org/blog
Riferimenti
• Web Testing with HTTP::Recorder
  http://www.perl.com/pub/a/2004/06/04/recorder.html
• Test di applicazioni web
  http://www.perl.it/blog/archives/000036.html
• A Perl Testing Tutorial (PDF)
  http://www.wgz.org/chromatic/perl/IntroTestMore.pdf
• Migliorare la navigazione sul web con Perl
  http://www.perl.it/blog/archives/000076.html
• Documentazione dei vari moduli menzionati
  http://search.cpan.org/

More Related Content

What's hot

DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in DjangoDjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in DjangoCasey Kinsey
 
Managing Modules Without Going Crazy (NPW 2007)
Managing Modules Without Going Crazy (NPW 2007)Managing Modules Without Going Crazy (NPW 2007)
Managing Modules Without Going Crazy (NPW 2007)brian d foy
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CIMartin de Keijzer
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in DjangoKevin Harvey
 
Audit your reactive applications
Audit your reactive applicationsAudit your reactive applications
Audit your reactive applicationsOCTO Technology
 
Improve Development Process with Open Source Software
Improve Development Process with Open Source SoftwareImprove Development Process with Open Source Software
Improve Development Process with Open Source Softwareelliando dias
 
About performance testing with NanoCloud
About performance testing with NanoCloudAbout performance testing with NanoCloud
About performance testing with NanoCloudartem_panasyuk
 
Building high-performance web applications with Preact
Building high-performance web applications with PreactBuilding high-performance web applications with Preact
Building high-performance web applications with PreactMaurice De Beijer [MVP]
 
Just kill it
Just kill itJust kill it
Just kill itpwhitdog
 
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)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)brian d foy
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUGslandelle
 
Cypress first impressions
Cypress first impressionsCypress first impressions
Cypress first impressionsHans Emmel
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Alin Pandichi
 

What's hot (20)

DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in DjangoDjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
 
Vorlon.js
Vorlon.jsVorlon.js
Vorlon.js
 
Managing Modules Without Going Crazy (NPW 2007)
Managing Modules Without Going Crazy (NPW 2007)Managing Modules Without Going Crazy (NPW 2007)
Managing Modules Without Going Crazy (NPW 2007)
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CI
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
 
Testing In Django
Testing In DjangoTesting In Django
Testing In Django
 
Audit your reactive applications
Audit your reactive applicationsAudit your reactive applications
Audit your reactive applications
 
Improve Development Process with Open Source Software
Improve Development Process with Open Source SoftwareImprove Development Process with Open Source Software
Improve Development Process with Open Source Software
 
About performance testing with NanoCloud
About performance testing with NanoCloudAbout performance testing with NanoCloud
About performance testing with NanoCloud
 
Building high-performance web applications with Preact
Building high-performance web applications with PreactBuilding high-performance web applications with Preact
Building high-performance web applications with Preact
 
React performance
React performanceReact performance
React performance
 
Just kill it
Just kill itJust kill it
Just kill it
 
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)
Automating Software Releases (Dallas/Ft. Worth Perl Mongers 2004)
 
How do we do it
How do we do itHow do we do it
How do we do it
 
Gatling - Bordeaux JUG
Gatling - Bordeaux JUGGatling - Bordeaux JUG
Gatling - Bordeaux JUG
 
Cypress first impressions
Cypress first impressionsCypress first impressions
Cypress first impressions
 
Tasting Your First Test Burger
Tasting Your First Test BurgerTasting Your First Test Burger
Tasting Your First Test Burger
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)
 
AdminBits & codequack.com
AdminBits & codequack.comAdminBits & codequack.com
AdminBits & codequack.com
 
Distributed Development
Distributed DevelopmentDistributed Development
Distributed Development
 

Viewers also liked

Viewers also liked (9)

Mead Five Star Binder1564
Mead Five Star Binder1564Mead Five Star Binder1564
Mead Five Star Binder1564
 
Democracyandcapitalism
DemocracyandcapitalismDemocracyandcapitalism
Democracyandcapitalism
 
Scatole Nere
Scatole NereScatole Nere
Scatole Nere
 
O Gerente
O Gerente O Gerente
O Gerente
 
Perl, musica automagica
Perl, musica automagicaPerl, musica automagica
Perl, musica automagica
 
POE
POEPOE
POE
 
On the most excellent theory of time travel, poetic revolutions, and dynamic ...
On the most excellent theory of time travel, poetic revolutions, and dynamic ...On the most excellent theory of time travel, poetic revolutions, and dynamic ...
On the most excellent theory of time travel, poetic revolutions, and dynamic ...
 
Perl101 - Italian Perl Workshop 2011
Perl101 - Italian Perl Workshop 2011Perl101 - Italian Perl Workshop 2011
Perl101 - Italian Perl Workshop 2011
 
Perl101
Perl101Perl101
Perl101
 

Similar to Test Automatici^2 per applicazioni Web

How the JDeveloper team test JDeveloper at UKOUG'08
How the JDeveloper team test JDeveloper at UKOUG'08How the JDeveloper team test JDeveloper at UKOUG'08
How the JDeveloper team test JDeveloper at UKOUG'08kingsfleet
 
Secure Programming With Static Analysis
Secure Programming With Static AnalysisSecure Programming With Static Analysis
Secure Programming With Static AnalysisConSanFrancisco123
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven DevelopmentZendCon
 
PHX Session #1: Development Best Practices And How Microsoft Helps
PHX Session #1: Development  Best  Practices And  How  Microsoft  HelpsPHX Session #1: Development  Best  Practices And  How  Microsoft  Helps
PHX Session #1: Development Best Practices And How Microsoft HelpsSteve Lange
 
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestStatic Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestDenim Group
 
Just Java2007 - Daniel Wildt - Tools For Java Test Automation
Just Java2007 - Daniel Wildt - Tools For Java Test AutomationJust Java2007 - Daniel Wildt - Tools For Java Test Automation
Just Java2007 - Daniel Wildt - Tools For Java Test AutomationDaniel Wildt
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integrationdrluckyspin
 
Quality Assurance in PHP projects - Sebastian Bergmann
Quality Assurance in PHP projects - Sebastian BergmannQuality Assurance in PHP projects - Sebastian Bergmann
Quality Assurance in PHP projects - Sebastian Bergmanndpc
 
Web 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web AppsWeb 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web Appsadunne
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And MavenPerconaPerformance
 
Better Perl Practices
Better Perl PracticesBetter Perl Practices
Better Perl PracticesJay Shirley
 
TDD super mondays-june-2014
TDD super mondays-june-2014TDD super mondays-june-2014
TDD super mondays-june-2014Alex Kavanagh
 
Presentations Unusual Java Bugs And Detecting Them Using Foss Tools
Presentations Unusual Java Bugs And Detecting Them Using Foss ToolsPresentations Unusual Java Bugs And Detecting Them Using Foss Tools
Presentations Unusual Java Bugs And Detecting Them Using Foss ToolsGanesh Samarthyam
 
Extracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails AppsExtracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails AppsJosh Nichols
 

Similar to Test Automatici^2 per applicazioni Web (20)

Test
TestTest
Test
 
How the JDeveloper team test JDeveloper at UKOUG'08
How the JDeveloper team test JDeveloper at UKOUG'08How the JDeveloper team test JDeveloper at UKOUG'08
How the JDeveloper team test JDeveloper at UKOUG'08
 
Secure Programming With Static Analysis
Secure Programming With Static AnalysisSecure Programming With Static Analysis
Secure Programming With Static Analysis
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
CI
CICI
CI
 
PHX Session #1: Development Best Practices And How Microsoft Helps
PHX Session #1: Development  Best  Practices And  How  Microsoft  HelpsPHX Session #1: Development  Best  Practices And  How  Microsoft  Helps
PHX Session #1: Development Best Practices And How Microsoft Helps
 
Getting It Done
Getting It DoneGetting It Done
Getting It Done
 
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech FestStatic Analysis Techniques For Testing Application Security - Houston Tech Fest
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
 
Becoming A Php Ninja
Becoming A Php NinjaBecoming A Php Ninja
Becoming A Php Ninja
 
Just Java2007 - Daniel Wildt - Tools For Java Test Automation
Just Java2007 - Daniel Wildt - Tools For Java Test AutomationJust Java2007 - Daniel Wildt - Tools For Java Test Automation
Just Java2007 - Daniel Wildt - Tools For Java Test Automation
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
Quality Assurance in PHP projects - Sebastian Bergmann
Quality Assurance in PHP projects - Sebastian BergmannQuality Assurance in PHP projects - Sebastian Bergmann
Quality Assurance in PHP projects - Sebastian Bergmann
 
Web 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web AppsWeb 2.0 Performance and Reliability: How to Run Large Web Apps
Web 2.0 Performance and Reliability: How to Run Large Web Apps
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
 
Better Perl Practices
Better Perl PracticesBetter Perl Practices
Better Perl Practices
 
TDD super mondays-june-2014
TDD super mondays-june-2014TDD super mondays-june-2014
TDD super mondays-june-2014
 
Presentations Unusual Java Bugs And Detecting Them Using Foss Tools
Presentations Unusual Java Bugs And Detecting Them Using Foss ToolsPresentations Unusual Java Bugs And Detecting Them Using Foss Tools
Presentations Unusual Java Bugs And Detecting Them Using Foss Tools
 
Extracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails AppsExtracting Plugins And Gems From Rails Apps
Extracting Plugins And Gems From Rails Apps
 
Os Alrubaie
Os AlrubaieOs Alrubaie
Os Alrubaie
 
Os Alrubaie
Os AlrubaieOs Alrubaie
Os Alrubaie
 

Recently uploaded

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 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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 Takeoffsammart93
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

Test Automatici^2 per applicazioni Web

  • 1. Test automatici2 per applicazioni Web Stefano Rodighiero - larsen@perl.it
  • 2. Scrivere software = Gestire la complessità
  • 3.
  • 4.
  • 5.
  • 6. Complessità You might think of this as mental juggling - the more mental balls the program requires you to keep in the air at once, the more likely you’ll drop one of the balls, leading to a design or coding error. -- Steve McConnell
  • 7. Gestire la complessità • Loose coupling • Tecniche standard • KISS • Test?
  • 8. Test? «Testing by itself does not improve software quality. [...] Trying to improve software by increasing the amount of testing is like trying to lose weight by weighting yourself more often» -- Steve McConnell
  • 9. Test! • Aumenta indirettamente la qualità del software • Design for testing • Refactoring • Wishful thinking • Confidenza con il proprio codice
  • 10. Esempio #!/usr/bin/perl -w use Test::Simple tests => 2; use Date::ICal; my $ical = Date::ICal->new; # make an object ok( defined $ical ); # check we got something ok( $ical->isa('Date::ICal') ); # and it's the right class
  • 11. Gradualmente • prova.pl → t/01_base.t • diag() • Usare gli occhi • map <F8> :! prove %<C-M> • YMMV :)
  • 13. Paradigma MVC Presentazione Model Controllo
  • 14.
  • 15. Test di videogame • Situazioni difficili da riprodurre • Grande complessità • Chi effettua il test non è il programmatore
  • 16. ?
  • 17.
  • 18. Test di applicazioni web • Workflow complessi • Quello che non è automatico tende a non essere fatto
  • 19. WWW::Mechanize #!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $agent = WWW::Mechanize->new(); $agent->get( 'http://www.google.com' ); print $agent->content();
  • 20. Test::WWW::Mechanize #!/usr/bin/perl use strict; use warnings; use Test::More qw/ no_plan /; use Test::WWW::Mechanize; my $agent = Test::WWW::Mechanize->new(); $agent->get_ok( 'http://www.google.com' ); $agent->title_is( 'Google' );
  • 21. WWW::Mechanize::Shell calvin:~ larsen$ perl -MWWW::Mechanize::Shell -e shell >g http://www.google.com Retrieving http://www.google.com(200) http://www.google.com>script mech3.pl http://www.google.com>quit calvin:~ larsen$
  • 22. WWW::Mechanize::Shell #!perl -w use strict; use WWW::Mechanize; use WWW::Mechanize::FormFiller; use URI::URL; my $agent = WWW::Mechanize->new( autocheck => 1 ); my $formfiller = WWW::Mechanize::FormFiller->new(); $agent->env_proxy(); $agent->get('http://www.google.com'); $agent->form(1) if $agent->forms and scalar @{$agent->forms}; mech3.pl
  • 23.
  • 25. proxy.pl #!/usr/bin/perl use strict; use warnings; use HTTP::Proxy qw/ :log /; use HTTP::Recorder; my $proxy = HTTP::Proxy->new; my $agent = HTTP::Recorder->new( file => quot;/tmp/tmpfilequot; , showwindow => 1 ); $proxy->logmask( STATUS | PROCESS | HEADERS ); $proxy->port( 3128 ); $proxy->host( '' ); $proxy->agent( $agent ); $proxy->start();
  • 26. Demo
  • 27. Idee • Usare proxy.pl con un sistema di bugtracking (il ticket contiene il codice per riprodurre l’errore) • Testare applicazioni non scritte in Perl • Screenscraping
  • 28. Conclusioni • Integrate le pratiche di testing nel vostro workflow lavorativo • Gradualmente! • Sono pratiche che pagano da subito • Come posso progettare il codice per facilitarne il test?
  • 29. Monday, I could wait till Tuesday If I make up my mind Wednesday would be fine, Thursday’s on my mind Friday’d give me time, Saturday could wait But Sunday’d be too late -- Sting
  • 30. Grazie :) larsen@perl.it http://larsen.perlmonk.org/blog
  • 31. Riferimenti • Web Testing with HTTP::Recorder http://www.perl.com/pub/a/2004/06/04/recorder.html • Test di applicazioni web http://www.perl.it/blog/archives/000036.html • A Perl Testing Tutorial (PDF) http://www.wgz.org/chromatic/perl/IntroTestMore.pdf • Migliorare la navigazione sul web con Perl http://www.perl.it/blog/archives/000076.html • Documentazione dei vari moduli menzionati http://search.cpan.org/