SlideShare una empresa de Scribd logo
1 de 41
Descargar para leer sin conexión
Testing: Python, Java, Groovy, etc.

                                 Prof Russel Winder
                                  http://www.russel.org.uk

                                  email: russel@winder.org.uk
                                 xmpp: russel@winder.org.uk
                                    twitter: @russel_winder




Copyright © 2012 Russel Winder                                  1
Aims, Goals and Objects
     ●   Look at some practical aspects of testing with
         Python, Java, and Groovy.
     ●   Consider some of the practical positives and
         negatives of using test-driven development.
                          †
     ●   Possibly look at coverage as a useful tool for
         programmers‡.


         †
             If time permits.           ‡
                                         And a dangerous weapon in
                                        the hands of ignorant managers.
Copyright © 2012 Russel Winder                                            2
Structure


                                 Introduction.
                                   First part.
                                  Short break.
                                  Second part.
                                  Conclusion.

Copyright © 2012 Russel Winder                   3
Protocol
     ●   Questions or short comments during the sessions
         are entirely in order.
     ●   Let me know you have an interjection by raising
         your hand, and when I come to an appropriate
         pause, I'll pass you the token.


                                 Questions, answers, comments, etc. appearing
                                 to get too long as interjections may get stacked
                                 to be unstacked at a break.


Copyright © 2012 Russel Winder                                                      4
Introduction




Copyright © 2012 Russel Winder                  5
Russel Winder
     ●   Theoretical Physicist: quarks, strangeness, and charm.
     ●   UNIX systems programmer.
     ●   Academic at UCL: parallel programming, HCI, psychology
         of programming.
     ●   Professor of Computing Science at KCL: health
         informatics, parallel programming. Head of Department.
     ●   Starter of start-ups.
     ●   Independent consultant, analyst, author, expert witness,
         trainer.

Copyright © 2012 Russel Winder                                      6
Interstitial Advertisement




Copyright © 2012 Russel Winder                        7
Projects
     ●   Gant                        ●    GroovyBalls
     ●   GPars                       ●    GFontBrowser
     ●   SCons                       ●    Pi_Quadrature
     ●   GroovyFX                    ●    Sleeping_Barber
     ●   Groovy
     ●   Gradle

                                         OK, so it's all open source.


Copyright © 2012 Russel Winder                                          8
Testing RW Historically
     ●   The FORTRAN years.
     ●   The C years.
     ●   Early Smalltalk and C++ years.
                                             eXtreme Programming
     ●   The Fortran years.
     ●   Early Java years.
     ●   Test-driven Development (TDD) hegemony.
     ●   Feature-Driven Development (FDD).
     ●   Behaviour-driven Development (BDD).
Copyright © 2012 Russel Winder                                     9
A Personal Epiphany
     ●   C codes needs testing.
     ●   C is very difficult re testing.

     ●   Use Python – as long as the C is in a dynamically
         linked library (aka shared object).




Copyright © 2012 Russel Winder                               10
The Two Parts




Copyright © 2012 Russel Winder                   11
The Terms
     ●   Unit test.
     ●   Integration test.
     ●   System test.
     ●   Acceptance test.


                                   Smoke test.



                                                 Mutation test.
Copyright © 2012 Russel Winder                                    12
Unit Test
     ●   Test the functions and methods for correct
         behaviour.



                                 May well require use of mocks.




Copyright © 2012 Russel Winder                                    13
Integration Test
     ●   Test that combination of bits of the system
         collaborate in correct ways.



                                  Probably needs some use of mocks.




Copyright © 2012 Russel Winder                                        14
System Test
     ●   Test that the system as a whole works as expected.




                                 No mocks at all.




                                      Smoke test – a pre-test to ensure it is
                                      worth running all the tests.
Copyright © 2012 Russel Winder                                                  15
Acceptance Test
     ●   Test that the “purchaser” makes to be happy with
         the system as delivered.



                             Used to be crucial, now contracts are usually
                             not for one-off items, but for annual support.




Copyright © 2012 Russel Winder                                                16
Code under Test




Copyright © 2012 Russel Winder                     17
The Tools
     ●   Test frameworks:
           ●   Unit testing                Programming language
           ●   Integration testing         specific.
           ●   System testing.




                                 Acceptance testing usually uses
                                 a different sort of tool, FitNesse
                                 for example.
                                                   http://fitnesse.org/
Copyright © 2012 Russel Winder                                            18
Testing: A Backdrop
     ●   Testing as we know it today has its roots in eXtreme
         Programming.
           ●   Smalltalk → sUnit
           ●   Python → PyUnit (aka unittest)
           ●   C++ → cppUnit,…
           ●   Java → JUnit

                                         Every language created one or many
                                         xUnit variants on the assumption it was
                                         The right thing to do…

                                         …even when it wasn't.
Copyright © 2012 Russel Winder                                                     19
The xUnit Legacy
     ●   xUnit is fundamentally grounded in dynamic
         languages – reflection required.
     ●   Static languages like C++ need a very different
         approach, hence CUTE, Catch,… using template
         meta-programming (aka compile time reflection).
     ●   Static languages like Java, can use annotations – still
         reflection based but better.




Copyright © 2012 Russel Winder                                     20
In the Python-sphere
     ●   PyUnit, aka unittest
     ●   py.test, aka PyTest
     ●   Nose, aka nose




                                       There are many others but the above
                                       are the ones that matter.


Copyright © 2012 Russel Winder                                               21
In the JVM-sphere
     ●   Java:                               ●   Groovy
          ●    JUnit3                            ●   GroovyTestCase
          ●    JUnit4                                 –   JUnit3 in disguise
          ●    TestNG                            ●   Spock
     ●   Scala                               ●   Clojure
          ●    ScalaTest                         ●   clojure.test
          ●    ScalaCheck                        ●   Midje
          ●    Specs2                            ●   lazytest

                                    Kotlin, Ceylon, Jython, JRuby,…
Copyright © 2012 Russel Winder                                                 22
Being In Control
     ●   For all software developments always use a version
         control system.
                                 †
     ●   Given DVCSs such as Git, Mercurial, Bazaar, there are
         no excuses for not managing development with a
         version control system.




                                           †
                                           Distributed version control system.
Copyright © 2012 Russel Winder                                               23
Individuals / Teams
     ●   Single developer projects need no other tools.
     ●   Multi-developer projects need more infrastructure.




Copyright © 2012 Russel Winder                                24
Continuous Integration
     ●   A process via which all tests are run for all commits
         to the mainline repository.
     ●   A continuous integration server monitors the
         mainline repository.




Copyright © 2012 Russel Winder                                   25
Team Workflow

                                                                Continuous delivery
                                            Deployment Server   Continuous deployment




            Developer
                                                                System Test Server
                                     Mainline Repository
       Developer

              Developer
                                                                Continuous Integration
                                          Developer
                         Developer


Copyright © 2012 Russel Winder                                                           26
Buildbot
     ●    FOSS continuous integration framework written in
          Python:
           ●   Single master.             http://trac.buildbot.net/
           ●   Multiple slaves.



         http://www.scons.org/

                                     http://buildbot.scons.org/


Copyright © 2012 Russel Winder                                        27
Atlassian Bamboo
     ●   Commercial continuous integration server, free to
         FOSS organizations, e.g. Codehaus

                                          http://www.atlassian.com/
             http://www.codehaus.org/




                                         http://gant.codehaus.org/
Copyright © 2012 Russel Winder                                        28
JetBrains TeamCity
     ●   Commercial continuous integration server.
     ●   Free support for FOSS projects.
     ●   Cloudy.

                                     http://www.jetbrains.com/




               http://gpars.codehaus.org/


Copyright © 2012 Russel Winder                                   29
The Process


                                     Green
               Fix CUT


                                               Refactor
                                   New Test
                     Red
Copyright © 2012 Russel Winder                            30
Test-driven Development
     ●   Never amend your code unless you have a failing
         test.
     ●   Unless the change is a refactoring.




                                  Run all your tests often.


Copyright © 2012 Russel Winder                                31
Refactoring
     ●   Ensure there are no pending commits prior to a
         refactoring.
     ●   Run all the tests immediately before a refactoring –
         ensure you get a green.
     ●   Run all the tests immediately after a refactoring –
         ensure you get a green.
     ●   If a refactoring leads to a red, back out of all the
         changes.
     ●   Run the tests and ensure you get a green.

Copyright © 2012 Russel Winder                                  32
Unit Testing and Mocks
     ●   System testing done within a constrained real
         system not live.
     ●   Unit and integration testing needs to disconnect
         from some resources.




Copyright © 2012 Russel Winder                              33
A short
                                 Monty Python
                                  moment…




Copyright © 2012 Russel Winder                  34
Copyright © 2012 Russel Winder   35
A Short Coding Dojo




Copyright © 2012 Russel Winder                         36
Conclusion




Copyright © 2012 Russel Winder                37
Testing
     ●   It's what programmers do.




Copyright © 2012 Russel Winder             38
Version Control
     ●   It's the way programmers work.




Copyright © 2012 Russel Winder                     39
Interstitial Advertisement




Copyright © 2012 Russel Winder                        40
Testing: Python, Java, Groovy, etc.

                                 Prof Russel Winder
                                  http://www.russel.org.uk

                                  email: russel@winder.org.uk
                                 xmpp: russel@winder.org.uk
                                    twitter: @russel_winder




Copyright © 2012 Russel Winder                                  41

Más contenido relacionado

Similar a Testing: Python, Java, Groovy, etc.

Gant, the lightweight and Groovy targeted scripting framework
Gant, the lightweight and Groovy targeted scripting frameworkGant, the lightweight and Groovy targeted scripting framework
Gant, the lightweight and Groovy targeted scripting frameworkSkills Matter
 
Just Keep Passing the Messages from Groovy and Grails eXchange 2011
Just Keep Passing the Messages from Groovy and Grails eXchange 2011Just Keep Passing the Messages from Groovy and Grails eXchange 2011
Just Keep Passing the Messages from Groovy and Grails eXchange 2011Russel Winder
 
Just Keep Sending The Messages
Just Keep Sending The MessagesJust Keep Sending The Messages
Just Keep Sending The MessagesRussel Winder
 
Java Tech & Tools | Just Keep Passing the Message | Russel Winder
Java Tech & Tools | Just Keep Passing the Message | Russel WinderJava Tech & Tools | Just Keep Passing the Message | Russel Winder
Java Tech & Tools | Just Keep Passing the Message | Russel WinderJAX London
 
Just Keep Passing The Messages
Just Keep Passing The MessagesJust Keep Passing The Messages
Just Keep Passing The MessagesRussel Winder
 
It's all about processes communicating - Russel Winder
It's all about processes communicating - Russel WinderIt's all about processes communicating - Russel Winder
It's all about processes communicating - Russel WinderJAX London
 
It's All About Processes Communicating
It's All About Processes CommunicatingIt's All About Processes Communicating
It's All About Processes CommunicatingRussel Winder
 
Design for Testability
Design for Testability Design for Testability
Design for Testability Pawel Kalbrun
 
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12Puppet
 
Building infrastructure for Big Data
Building infrastructure for Big DataBuilding infrastructure for Big Data
Building infrastructure for Big DataPromptCloud
 
Closures, the next "Big Thing" in Java: Russel Winder
Closures, the next "Big Thing" in Java: Russel WinderClosures, the next "Big Thing" in Java: Russel Winder
Closures, the next "Big Thing" in Java: Russel WinderJAX London
 
Closures: The Next "Big Thing" In Java
Closures: The Next "Big Thing" In JavaClosures: The Next "Big Thing" In Java
Closures: The Next "Big Thing" In JavaRussel Winder
 
Introduction_to_Scrum_Agile_Values
Introduction_to_Scrum_Agile_ValuesIntroduction_to_Scrum_Agile_Values
Introduction_to_Scrum_Agile_ValuesLaszlo Szalvay
 
Big datalittletests heintz
Big datalittletests heintzBig datalittletests heintz
Big datalittletests heintzdrewz lin
 
Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Gustavo Fuentes Zurita
 
Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Gustavo Fuentes Zurita
 
Test Driven Development presentation delhi meetup
Test Driven Development presentation delhi meetupTest Driven Development presentation delhi meetup
Test Driven Development presentation delhi meetupNaveen Kumar Singh
 

Similar a Testing: Python, Java, Groovy, etc. (20)

Gant, the lightweight and Groovy targeted scripting framework
Gant, the lightweight and Groovy targeted scripting frameworkGant, the lightweight and Groovy targeted scripting framework
Gant, the lightweight and Groovy targeted scripting framework
 
Just Keep Passing the Messages from Groovy and Grails eXchange 2011
Just Keep Passing the Messages from Groovy and Grails eXchange 2011Just Keep Passing the Messages from Groovy and Grails eXchange 2011
Just Keep Passing the Messages from Groovy and Grails eXchange 2011
 
Just Keep Sending The Messages
Just Keep Sending The MessagesJust Keep Sending The Messages
Just Keep Sending The Messages
 
Java Tech & Tools | Just Keep Passing the Message | Russel Winder
Java Tech & Tools | Just Keep Passing the Message | Russel WinderJava Tech & Tools | Just Keep Passing the Message | Russel Winder
Java Tech & Tools | Just Keep Passing the Message | Russel Winder
 
Just Keep Passing The Messages
Just Keep Passing The MessagesJust Keep Passing The Messages
Just Keep Passing The Messages
 
It's all about processes communicating - Russel Winder
It's all about processes communicating - Russel WinderIt's all about processes communicating - Russel Winder
It's all about processes communicating - Russel Winder
 
It's All About Processes Communicating
It's All About Processes CommunicatingIt's All About Processes Communicating
It's All About Processes Communicating
 
Design for Testability
Design for Testability Design for Testability
Design for Testability
 
Functional testing patterns
Functional testing patternsFunctional testing patterns
Functional testing patterns
 
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
Continuous Development with Jenkins - Stephen Connolly at PuppetCamp Dublin '12
 
Building infrastructure for Big Data
Building infrastructure for Big DataBuilding infrastructure for Big Data
Building infrastructure for Big Data
 
Closures, the next "Big Thing" in Java: Russel Winder
Closures, the next "Big Thing" in Java: Russel WinderClosures, the next "Big Thing" in Java: Russel Winder
Closures, the next "Big Thing" in Java: Russel Winder
 
Closures: The Next "Big Thing" In Java
Closures: The Next "Big Thing" In JavaClosures: The Next "Big Thing" In Java
Closures: The Next "Big Thing" In Java
 
Introduction_to_Scrum_Agile_Values
Introduction_to_Scrum_Agile_ValuesIntroduction_to_Scrum_Agile_Values
Introduction_to_Scrum_Agile_Values
 
GPars Workshop
GPars WorkshopGPars Workshop
GPars Workshop
 
Big datalittletests heintz
Big datalittletests heintzBig datalittletests heintz
Big datalittletests heintz
 
Testing on Android
Testing on AndroidTesting on Android
Testing on Android
 
Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02
 
Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02Testingonandroid v2-091203161835-phpapp02
Testingonandroid v2-091203161835-phpapp02
 
Test Driven Development presentation delhi meetup
Test Driven Development presentation delhi meetupTest Driven Development presentation delhi meetup
Test Driven Development presentation delhi meetup
 

Más de Russel Winder

On Concurrency and Parallelism in the JVMverse
On Concurrency and Parallelism in the JVMverseOn Concurrency and Parallelism in the JVMverse
On Concurrency and Parallelism in the JVMverseRussel Winder
 
The Case for Kotlin and Ceylon
The Case for Kotlin and CeylonThe Case for Kotlin and Ceylon
The Case for Kotlin and CeylonRussel Winder
 
On the Architectures of Microservices: the next layer
On the Architectures of Microservices: the next layerOn the Architectures of Microservices: the next layer
On the Architectures of Microservices: the next layerRussel Winder
 
Fast Python? Don't Bother
Fast Python? Don't BotherFast Python? Don't Bother
Fast Python? Don't BotherRussel Winder
 
Making Python computations fast
Making Python computations fastMaking Python computations fast
Making Python computations fastRussel Winder
 
Tales from the Workshops
Tales from the WorkshopsTales from the Workshops
Tales from the WorkshopsRussel Winder
 
Making Computations Execute Very Quickly
Making Computations Execute Very QuicklyMaking Computations Execute Very Quickly
Making Computations Execute Very QuicklyRussel Winder
 
Java is Dead, Long Live Ceylon, Kotlin, etc
Java is Dead,  Long Live Ceylon, Kotlin, etcJava is Dead,  Long Live Ceylon, Kotlin, etc
Java is Dead, Long Live Ceylon, Kotlin, etcRussel Winder
 
Java is dead, long live Scala, Kotlin, Ceylon, etc.
Java is dead, long live Scala, Kotlin, Ceylon, etc.Java is dead, long live Scala, Kotlin, Ceylon, etc.
Java is dead, long live Scala, Kotlin, Ceylon, etc.Russel Winder
 
Spocktacular testing
Spocktacular testingSpocktacular testing
Spocktacular testingRussel Winder
 
Spocktacular Testing
Spocktacular TestingSpocktacular Testing
Spocktacular TestingRussel Winder
 
Is Groovy static or dynamic
Is Groovy static or dynamicIs Groovy static or dynamic
Is Groovy static or dynamicRussel Winder
 
Java is dead, long live Scala Kotlin Ceylon etc.
Java is dead, long live Scala Kotlin Ceylon etc.Java is dead, long live Scala Kotlin Ceylon etc.
Java is dead, long live Scala Kotlin Ceylon etc.Russel Winder
 
Dataflow: the concurrency/parallelism architecture you need
Dataflow: the concurrency/parallelism architecture you needDataflow: the concurrency/parallelism architecture you need
Dataflow: the concurrency/parallelism architecture you needRussel Winder
 
Are Go and D threats to Python
Are Go and D threats to PythonAre Go and D threats to Python
Are Go and D threats to PythonRussel Winder
 
Is Groovy as fast as Java
Is Groovy as fast as JavaIs Groovy as fast as Java
Is Groovy as fast as JavaRussel Winder
 
Who needs C++ when you have D and Go
Who needs C++ when you have D and GoWho needs C++ when you have D and Go
Who needs C++ when you have D and GoRussel Winder
 
Java 8: a New Beginning
Java 8: a New BeginningJava 8: a New Beginning
Java 8: a New BeginningRussel Winder
 

Más de Russel Winder (20)

On Concurrency and Parallelism in the JVMverse
On Concurrency and Parallelism in the JVMverseOn Concurrency and Parallelism in the JVMverse
On Concurrency and Parallelism in the JVMverse
 
The Case for Kotlin and Ceylon
The Case for Kotlin and CeylonThe Case for Kotlin and Ceylon
The Case for Kotlin and Ceylon
 
On the Architectures of Microservices: the next layer
On the Architectures of Microservices: the next layerOn the Architectures of Microservices: the next layer
On the Architectures of Microservices: the next layer
 
Fast Python? Don't Bother
Fast Python? Don't BotherFast Python? Don't Bother
Fast Python? Don't Bother
 
Making Python computations fast
Making Python computations fastMaking Python computations fast
Making Python computations fast
 
Tales from the Workshops
Tales from the WorkshopsTales from the Workshops
Tales from the Workshops
 
Making Computations Execute Very Quickly
Making Computations Execute Very QuicklyMaking Computations Execute Very Quickly
Making Computations Execute Very Quickly
 
Java is Dead, Long Live Ceylon, Kotlin, etc
Java is Dead,  Long Live Ceylon, Kotlin, etcJava is Dead,  Long Live Ceylon, Kotlin, etc
Java is Dead, Long Live Ceylon, Kotlin, etc
 
GPars Remoting
GPars RemotingGPars Remoting
GPars Remoting
 
Java is dead, long live Scala, Kotlin, Ceylon, etc.
Java is dead, long live Scala, Kotlin, Ceylon, etc.Java is dead, long live Scala, Kotlin, Ceylon, etc.
Java is dead, long live Scala, Kotlin, Ceylon, etc.
 
GPars 2014
GPars 2014GPars 2014
GPars 2014
 
Spocktacular testing
Spocktacular testingSpocktacular testing
Spocktacular testing
 
Spocktacular Testing
Spocktacular TestingSpocktacular Testing
Spocktacular Testing
 
Is Groovy static or dynamic
Is Groovy static or dynamicIs Groovy static or dynamic
Is Groovy static or dynamic
 
Java is dead, long live Scala Kotlin Ceylon etc.
Java is dead, long live Scala Kotlin Ceylon etc.Java is dead, long live Scala Kotlin Ceylon etc.
Java is dead, long live Scala Kotlin Ceylon etc.
 
Dataflow: the concurrency/parallelism architecture you need
Dataflow: the concurrency/parallelism architecture you needDataflow: the concurrency/parallelism architecture you need
Dataflow: the concurrency/parallelism architecture you need
 
Are Go and D threats to Python
Are Go and D threats to PythonAre Go and D threats to Python
Are Go and D threats to Python
 
Is Groovy as fast as Java
Is Groovy as fast as JavaIs Groovy as fast as Java
Is Groovy as fast as Java
 
Who needs C++ when you have D and Go
Who needs C++ when you have D and GoWho needs C++ when you have D and Go
Who needs C++ when you have D and Go
 
Java 8: a New Beginning
Java 8: a New BeginningJava 8: a New Beginning
Java 8: a New Beginning
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
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
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
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
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 

Último (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
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...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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 ...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 

Testing: Python, Java, Groovy, etc.

  • 1. Testing: Python, Java, Groovy, etc. Prof Russel Winder http://www.russel.org.uk email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: @russel_winder Copyright © 2012 Russel Winder 1
  • 2. Aims, Goals and Objects ● Look at some practical aspects of testing with Python, Java, and Groovy. ● Consider some of the practical positives and negatives of using test-driven development. † ● Possibly look at coverage as a useful tool for programmers‡. † If time permits. ‡ And a dangerous weapon in the hands of ignorant managers. Copyright © 2012 Russel Winder 2
  • 3. Structure Introduction. First part. Short break. Second part. Conclusion. Copyright © 2012 Russel Winder 3
  • 4. Protocol ● Questions or short comments during the sessions are entirely in order. ● Let me know you have an interjection by raising your hand, and when I come to an appropriate pause, I'll pass you the token. Questions, answers, comments, etc. appearing to get too long as interjections may get stacked to be unstacked at a break. Copyright © 2012 Russel Winder 4
  • 6. Russel Winder ● Theoretical Physicist: quarks, strangeness, and charm. ● UNIX systems programmer. ● Academic at UCL: parallel programming, HCI, psychology of programming. ● Professor of Computing Science at KCL: health informatics, parallel programming. Head of Department. ● Starter of start-ups. ● Independent consultant, analyst, author, expert witness, trainer. Copyright © 2012 Russel Winder 6
  • 8. Projects ● Gant ● GroovyBalls ● GPars ● GFontBrowser ● SCons ● Pi_Quadrature ● GroovyFX ● Sleeping_Barber ● Groovy ● Gradle OK, so it's all open source. Copyright © 2012 Russel Winder 8
  • 9. Testing RW Historically ● The FORTRAN years. ● The C years. ● Early Smalltalk and C++ years. eXtreme Programming ● The Fortran years. ● Early Java years. ● Test-driven Development (TDD) hegemony. ● Feature-Driven Development (FDD). ● Behaviour-driven Development (BDD). Copyright © 2012 Russel Winder 9
  • 10. A Personal Epiphany ● C codes needs testing. ● C is very difficult re testing. ● Use Python – as long as the C is in a dynamically linked library (aka shared object). Copyright © 2012 Russel Winder 10
  • 11. The Two Parts Copyright © 2012 Russel Winder 11
  • 12. The Terms ● Unit test. ● Integration test. ● System test. ● Acceptance test. Smoke test. Mutation test. Copyright © 2012 Russel Winder 12
  • 13. Unit Test ● Test the functions and methods for correct behaviour. May well require use of mocks. Copyright © 2012 Russel Winder 13
  • 14. Integration Test ● Test that combination of bits of the system collaborate in correct ways. Probably needs some use of mocks. Copyright © 2012 Russel Winder 14
  • 15. System Test ● Test that the system as a whole works as expected. No mocks at all. Smoke test – a pre-test to ensure it is worth running all the tests. Copyright © 2012 Russel Winder 15
  • 16. Acceptance Test ● Test that the “purchaser” makes to be happy with the system as delivered. Used to be crucial, now contracts are usually not for one-off items, but for annual support. Copyright © 2012 Russel Winder 16
  • 17. Code under Test Copyright © 2012 Russel Winder 17
  • 18. The Tools ● Test frameworks: ● Unit testing Programming language ● Integration testing specific. ● System testing. Acceptance testing usually uses a different sort of tool, FitNesse for example. http://fitnesse.org/ Copyright © 2012 Russel Winder 18
  • 19. Testing: A Backdrop ● Testing as we know it today has its roots in eXtreme Programming. ● Smalltalk → sUnit ● Python → PyUnit (aka unittest) ● C++ → cppUnit,… ● Java → JUnit Every language created one or many xUnit variants on the assumption it was The right thing to do… …even when it wasn't. Copyright © 2012 Russel Winder 19
  • 20. The xUnit Legacy ● xUnit is fundamentally grounded in dynamic languages – reflection required. ● Static languages like C++ need a very different approach, hence CUTE, Catch,… using template meta-programming (aka compile time reflection). ● Static languages like Java, can use annotations – still reflection based but better. Copyright © 2012 Russel Winder 20
  • 21. In the Python-sphere ● PyUnit, aka unittest ● py.test, aka PyTest ● Nose, aka nose There are many others but the above are the ones that matter. Copyright © 2012 Russel Winder 21
  • 22. In the JVM-sphere ● Java: ● Groovy ● JUnit3 ● GroovyTestCase ● JUnit4 – JUnit3 in disguise ● TestNG ● Spock ● Scala ● Clojure ● ScalaTest ● clojure.test ● ScalaCheck ● Midje ● Specs2 ● lazytest Kotlin, Ceylon, Jython, JRuby,… Copyright © 2012 Russel Winder 22
  • 23. Being In Control ● For all software developments always use a version control system. † ● Given DVCSs such as Git, Mercurial, Bazaar, there are no excuses for not managing development with a version control system. † Distributed version control system. Copyright © 2012 Russel Winder 23
  • 24. Individuals / Teams ● Single developer projects need no other tools. ● Multi-developer projects need more infrastructure. Copyright © 2012 Russel Winder 24
  • 25. Continuous Integration ● A process via which all tests are run for all commits to the mainline repository. ● A continuous integration server monitors the mainline repository. Copyright © 2012 Russel Winder 25
  • 26. Team Workflow Continuous delivery Deployment Server Continuous deployment Developer System Test Server Mainline Repository Developer Developer Continuous Integration Developer Developer Copyright © 2012 Russel Winder 26
  • 27. Buildbot ● FOSS continuous integration framework written in Python: ● Single master. http://trac.buildbot.net/ ● Multiple slaves. http://www.scons.org/ http://buildbot.scons.org/ Copyright © 2012 Russel Winder 27
  • 28. Atlassian Bamboo ● Commercial continuous integration server, free to FOSS organizations, e.g. Codehaus http://www.atlassian.com/ http://www.codehaus.org/ http://gant.codehaus.org/ Copyright © 2012 Russel Winder 28
  • 29. JetBrains TeamCity ● Commercial continuous integration server. ● Free support for FOSS projects. ● Cloudy. http://www.jetbrains.com/ http://gpars.codehaus.org/ Copyright © 2012 Russel Winder 29
  • 30. The Process Green Fix CUT Refactor New Test Red Copyright © 2012 Russel Winder 30
  • 31. Test-driven Development ● Never amend your code unless you have a failing test. ● Unless the change is a refactoring. Run all your tests often. Copyright © 2012 Russel Winder 31
  • 32. Refactoring ● Ensure there are no pending commits prior to a refactoring. ● Run all the tests immediately before a refactoring – ensure you get a green. ● Run all the tests immediately after a refactoring – ensure you get a green. ● If a refactoring leads to a red, back out of all the changes. ● Run the tests and ensure you get a green. Copyright © 2012 Russel Winder 32
  • 33. Unit Testing and Mocks ● System testing done within a constrained real system not live. ● Unit and integration testing needs to disconnect from some resources. Copyright © 2012 Russel Winder 33
  • 34. A short Monty Python moment… Copyright © 2012 Russel Winder 34
  • 35. Copyright © 2012 Russel Winder 35
  • 36. A Short Coding Dojo Copyright © 2012 Russel Winder 36
  • 37. Conclusion Copyright © 2012 Russel Winder 37
  • 38. Testing ● It's what programmers do. Copyright © 2012 Russel Winder 38
  • 39. Version Control ● It's the way programmers work. Copyright © 2012 Russel Winder 39
  • 41. Testing: Python, Java, Groovy, etc. Prof Russel Winder http://www.russel.org.uk email: russel@winder.org.uk xmpp: russel@winder.org.uk twitter: @russel_winder Copyright © 2012 Russel Winder 41