SlideShare a Scribd company logo
1 of 14
Download to read offline
Testing in Drupal
        An Introduction
Who Am I?

Simon Roberts
IT Consultant,
Taniwha Solutions
Using PHP since ~1996
Using Drupal since 2005
http://drupal.org/user/33667


First used SimpleTest at Drupalcon Szeged
Testing Sprint
Who Am I?

Before the Drupalcon, I’d only had the
most casual of looks at Testing in Drupal
Have used JUnit etc previously
Was able to provide useful tests to
Drupal Core inside a couple of hours!!
You can too!
What was SimpleTest?


PHP Testing Framework
Integrated as a contributed module in
D5 + D6
Integrated in core for Drupal 7 (sortof)
Implements Automated Testing
Why Automated Testing?

Define exactly what the code should do
  Easier development
  Easier to refactor code
  Less debugging
  Less mistakes
  More fun!!
Why Automated Testing?


  Document Bugs
$xss = '<script>alert(quot;xssquot;)</script>';
$edit = array(
  'title' => $xss,
);
$node = $this->drupalCreateNode($edit);
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertNoRaw($xss, t('Harmful tags are escaped.'));
Why Automated Testing?


Document Bugs
  Prevent regressions
  Quality Assurance
  Better Software
Safety net!
Why Automated Testing?

Once a test is written, it will likely be
run many many times
Every time it is run, it verifies that the
code is still working
If it catches even one bug, it has “paid
for itself” - High value
Can be used to help reproduce problems
Testing in Drupal Core
Dries (and Drupal!) has made Testing a high priority
for Drupal 7
http://buytaert.net/drupal-7-timeline
                                                                            The actual Drupal 6 Timeline

Effective Test coverage allows us to compress the “fix”
phase of a Drupal release (code freeze)




            The Drupal 7 timeline assuming that we fully embrace testing.


Note: These dates are going to be delayed anyway - slower migration to Drupal 6
             than expected (eg: CCK, Views, Panels. drupal.org)
Not just for Drupal Core!
so... how does it work?

.test files
    Contain test classes
    Test classes extend the SimpleTest class
        well, not exactly
    Use Helper methods to:
        Simulate user actions
        Check behavior
No, really... how does it work?




 Let me show you...
What’s Left To Do?

Outstanding Testing Issues
http://drupal.org/project/issues?
projects=3060&versions=156281&components=simpletest.module,tests


“We currently have 38 tests taken out of
43 for a test coverage of 88%. This will
change when the misnamed tests are
merged.” http://groups.drupal.org/node/9408
References

Webchick’s presentation “Testing Part 1: Intro to
Testing” (Szeged Drupalcon)
http://drupal.org/simpletest
http://groups.drupal.org/testing-qa
   One SimpleTest template to rule them all
   http://groups.drupal.org/node/7731
   Drupal testing patterns
   http://groups.drupal.org/node/15190

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
 
Automated testing in Drupal
Automated testing in DrupalAutomated testing in Drupal
Automated testing in DrupalArtem Berdishev
 
PHPUnit with CakePHP and Yii
PHPUnit with CakePHP and YiiPHPUnit with CakePHP and Yii
PHPUnit with CakePHP and Yiimadhavi Ghadge
 
Automating Perl deployments with Hudson
Automating Perl deployments with HudsonAutomating Perl deployments with Hudson
Automating Perl deployments with Hudsonnachbaur
 
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...Alex Balhatchet
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in DjangoKevin Harvey
 
Dot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarDot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarGiel Tettelaar
 
Unit testing for WordPress
Unit testing for WordPressUnit testing for WordPress
Unit testing for WordPressHarshad Mane
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8nagpalprachi
 
Test Presentation
Test PresentationTest Presentation
Test Presentationsetitesuk
 
It Sounded Good on Paper - Lessons Learned with Puppet
It Sounded Good on Paper - Lessons Learned with PuppetIt Sounded Good on Paper - Lessons Learned with Puppet
It Sounded Good on Paper - Lessons Learned with PuppetJeffery Smith
 
Art of unittesting in OpenStack - Paris 2014
Art of unittesting in OpenStack - Paris 2014Art of unittesting in OpenStack - Paris 2014
Art of unittesting in OpenStack - Paris 2014chmouel
 
Wix Automation - The False Positive Paradox
Wix Automation - The False Positive ParadoxWix Automation - The False Positive Paradox
Wix Automation - The False Positive ParadoxEfrat Attas
 
Testing the way it should be
Testing the way it should beTesting the way it should be
Testing the way it should beBrian Mann
 
Agile Testing - A quality culture in the company's core business
Agile Testing - A quality culture in the company's core businessAgile Testing - A quality culture in the company's core business
Agile Testing - A quality culture in the company's core businessWalmyr Lima e Silva Filho
 
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.com
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.comAdvanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.com
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.comDevOpsDays Tel Aviv
 

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
 
Automated testing in Drupal
Automated testing in DrupalAutomated testing in Drupal
Automated testing in Drupal
 
PHPUnit with CakePHP and Yii
PHPUnit with CakePHP and YiiPHPUnit with CakePHP and Yii
PHPUnit with CakePHP and Yii
 
Automating Perl deployments with Hudson
Automating Perl deployments with HudsonAutomating Perl deployments with Hudson
Automating Perl deployments with Hudson
 
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
Continuous testing and deployment in Perl (London.pm Technical Meeting Octobe...
 
Continuous Integration Testing in Django
Continuous Integration Testing in DjangoContinuous Integration Testing in Django
Continuous Integration Testing in Django
 
Dot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarDot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel Tettelar
 
Unit testing for WordPress
Unit testing for WordPressUnit testing for WordPress
Unit testing for WordPress
 
Tasting Your First Test Burger
Tasting Your First Test BurgerTasting Your First Test Burger
Tasting Your First Test Burger
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8
 
Test Presentation
Test PresentationTest Presentation
Test Presentation
 
Performance testing locust
Performance testing   locustPerformance testing   locust
Performance testing locust
 
It Sounded Good on Paper - Lessons Learned with Puppet
It Sounded Good on Paper - Lessons Learned with PuppetIt Sounded Good on Paper - Lessons Learned with Puppet
It Sounded Good on Paper - Lessons Learned with Puppet
 
Art of unittesting in OpenStack - Paris 2014
Art of unittesting in OpenStack - Paris 2014Art of unittesting in OpenStack - Paris 2014
Art of unittesting in OpenStack - Paris 2014
 
Wix Automation - The False Positive Paradox
Wix Automation - The False Positive ParadoxWix Automation - The False Positive Paradox
Wix Automation - The False Positive Paradox
 
Laravel Unit Testing
Laravel Unit TestingLaravel Unit Testing
Laravel Unit Testing
 
Testing the way it should be
Testing the way it should beTesting the way it should be
Testing the way it should be
 
Agile Testing - A quality culture in the company's core business
Agile Testing - A quality culture in the company's core businessAgile Testing - A quality culture in the company's core business
Agile Testing - A quality culture in the company's core business
 
Component testing with cypress
Component testing with cypressComponent testing with cypress
Component testing with cypress
 
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.com
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.comAdvanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.com
Advanced A/B Testing at Wix - Aviran Mordo and Sagy Rozman, Wix.com
 

Similar to Drupalcamp Simpletest

Simple test drupal7_presentation_la_drupal_jul21-2010
Simple test drupal7_presentation_la_drupal_jul21-2010Simple test drupal7_presentation_la_drupal_jul21-2010
Simple test drupal7_presentation_la_drupal_jul21-2010Miguel Hernandez
 
Making The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To SwallowMaking The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To SwallowPhilip Norton
 
Howto Test A Patch And Make A Difference!
Howto Test A Patch And Make A Difference!Howto Test A Patch And Make A Difference!
Howto Test A Patch And Make A Difference!Joel Farris
 
2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratiehcderaad
 
Hadoop testing workshop - july 2013
Hadoop testing workshop - july 2013Hadoop testing workshop - july 2013
Hadoop testing workshop - july 2013Ophir Cohen
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Jay Friendly
 
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 Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...Nagios
 
30 days or less: New Features to Production
30 days or less: New Features to Production30 days or less: New Features to Production
30 days or less: New Features to ProductionKarthik Gaekwad
 
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Max De Marzi
 
Testing practicies not only in scala
Testing practicies not only in scalaTesting practicies not only in scala
Testing practicies not only in scalaPaweł Panasewicz
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal infoSynapseindiappsdevelopment
 
Test Driven Development with Sql Server
Test Driven Development with Sql ServerTest Driven Development with Sql Server
Test Driven Development with Sql ServerDavid P. Moore
 
Test Driven Development Introduction
Test Driven Development IntroductionTest Driven Development Introduction
Test Driven Development IntroductionNguyen Hai
 
Simpletest - A beginners guide
Simpletest - A beginners guideSimpletest - A beginners guide
Simpletest - A beginners guideEd Conolly
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroSteven Pignataro
 

Similar to Drupalcamp Simpletest (20)

Simple test drupal7_presentation_la_drupal_jul21-2010
Simple test drupal7_presentation_la_drupal_jul21-2010Simple test drupal7_presentation_la_drupal_jul21-2010
Simple test drupal7_presentation_la_drupal_jul21-2010
 
Making The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To SwallowMaking The Drupal Pill Easier To Swallow
Making The Drupal Pill Easier To Swallow
 
Howto Test A Patch And Make A Difference!
Howto Test A Patch And Make A Difference!Howto Test A Patch And Make A Difference!
Howto Test A Patch And Make A Difference!
 
2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie
 
Hadoop testing workshop - july 2013
Hadoop testing workshop - july 2013Hadoop testing workshop - july 2013
Hadoop testing workshop - july 2013
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8
 
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 Conference 2011 - Nathan Vonnahme - Integrating Nagios With Test Drive...
 
30 days or less: New Features to Production
30 days or less: New Features to Production30 days or less: New Features to Production
30 days or less: New Features to Production
 
Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1Neo4j Stored Procedure Training Part 1
Neo4j Stored Procedure Training Part 1
 
Testing practicies not only in scala
Testing practicies not only in scalaTesting practicies not only in scala
Testing practicies not only in scala
 
SynapseIndia drupal presentation on drupal info
SynapseIndia drupal  presentation on drupal infoSynapseIndia drupal  presentation on drupal info
SynapseIndia drupal presentation on drupal info
 
Hacking core
Hacking coreHacking core
Hacking core
 
Python and test
Python and testPython and test
Python and test
 
Test Driven Development with Sql Server
Test Driven Development with Sql ServerTest Driven Development with Sql Server
Test Driven Development with Sql Server
 
Test Driven Development Introduction
Test Driven Development IntroductionTest Driven Development Introduction
Test Driven Development Introduction
 
Simpletest - A beginners guide
Simpletest - A beginners guideSimpletest - A beginners guide
Simpletest - A beginners guide
 
AvenDATA and Devops
AvenDATA and DevopsAvenDATA and Devops
AvenDATA and Devops
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
 
Testing 101
Testing 101Testing 101
Testing 101
 
Tdd
TddTdd
Tdd
 

Recently uploaded

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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 Servicegiselly40
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
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 MenDelhi Call girls
 
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 productivityPrincipled Technologies
 
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 textsMaria Levchenko
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 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...
 
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
 
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
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

Drupalcamp Simpletest

  • 1. Testing in Drupal An Introduction
  • 2. Who Am I? Simon Roberts IT Consultant, Taniwha Solutions Using PHP since ~1996 Using Drupal since 2005 http://drupal.org/user/33667 First used SimpleTest at Drupalcon Szeged Testing Sprint
  • 3. Who Am I? Before the Drupalcon, I’d only had the most casual of looks at Testing in Drupal Have used JUnit etc previously Was able to provide useful tests to Drupal Core inside a couple of hours!! You can too!
  • 4. What was SimpleTest? PHP Testing Framework Integrated as a contributed module in D5 + D6 Integrated in core for Drupal 7 (sortof) Implements Automated Testing
  • 5. Why Automated Testing? Define exactly what the code should do Easier development Easier to refactor code Less debugging Less mistakes More fun!!
  • 6. Why Automated Testing? Document Bugs $xss = '<script>alert(quot;xssquot;)</script>'; $edit = array( 'title' => $xss, ); $node = $this->drupalCreateNode($edit); $this->drupalGet('node/' . $node->nid . '/edit'); $this->assertNoRaw($xss, t('Harmful tags are escaped.'));
  • 7. Why Automated Testing? Document Bugs Prevent regressions Quality Assurance Better Software Safety net!
  • 8. Why Automated Testing? Once a test is written, it will likely be run many many times Every time it is run, it verifies that the code is still working If it catches even one bug, it has “paid for itself” - High value Can be used to help reproduce problems
  • 9. Testing in Drupal Core Dries (and Drupal!) has made Testing a high priority for Drupal 7 http://buytaert.net/drupal-7-timeline The actual Drupal 6 Timeline Effective Test coverage allows us to compress the “fix” phase of a Drupal release (code freeze) The Drupal 7 timeline assuming that we fully embrace testing. Note: These dates are going to be delayed anyway - slower migration to Drupal 6 than expected (eg: CCK, Views, Panels. drupal.org)
  • 10. Not just for Drupal Core!
  • 11. so... how does it work? .test files Contain test classes Test classes extend the SimpleTest class well, not exactly Use Helper methods to: Simulate user actions Check behavior
  • 12. No, really... how does it work? Let me show you...
  • 13. What’s Left To Do? Outstanding Testing Issues http://drupal.org/project/issues? projects=3060&versions=156281&components=simpletest.module,tests “We currently have 38 tests taken out of 43 for a test coverage of 88%. This will change when the misnamed tests are merged.” http://groups.drupal.org/node/9408
  • 14. References Webchick’s presentation “Testing Part 1: Intro to Testing” (Szeged Drupalcon) http://drupal.org/simpletest http://groups.drupal.org/testing-qa One SimpleTest template to rule them all http://groups.drupal.org/node/7731 Drupal testing patterns http://groups.drupal.org/node/15190