SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Splat: Simple Python
Lazy Automated Tester
                          tiny.cc/lwy08

       Lee Wei Yeong
     lwy08@doc.ic.ac.uk
Introduction



     2
Motivation

• writing unit tests
 ‣ crucial
 ‣ costly but invisible
 ‣ can be automated


                          3
• dynamically typed
• clean, concise & elegant syntax
• builtin introspection & reflection facility


                             4
Why bytecode?

• “Growing numbers of... closed source applications...
  using...Python...” (Smith, 2010)
• simple
• fast

                              5
Background



    6
Existing tools

• Pythoscope
• Pytestsgenerator
• ...but neither works!


                          7
Existing tools

•    Ruby Test case Generator (RuTeG)
    ‣ structural testing
    ‣ evolutionary search
    ‣ tests object-oriented programs


                             8
Software testing




       9
Sample test target




        10
Sample unit test




       11
SPLAT



  12
Lazy instantiation

• technique inspired by IRULAN
• initially: None proxy metaclass wrapper
• test data only generated for active variables




                            13
Lazy instantiation




        14
Lazy instantiation


LOAD_GLOBAL       (A)
CALL_FUNCTION      0
STORE_FAST      (arg1)
LOAD_CONST      (‘arg1’)
LOAD_FAST       (arg1)
STORE_ATTR      (attr1)
LOAD_FAST       (arg1)
RETURN_VALUE
                           15
Lazy instantiation
                                function1
                                (
                                  Param1(None),
                                  Param2(None),
LOAD_GLOBAL       (A)
                                  Param3(None)
CALL_FUNCTION      0
                                  )
STORE_FAST      (arg1)
LOAD_CONST      (‘arg1’)
LOAD_FAST       (arg1)
STORE_ATTR      (attr1)
LOAD_FAST       (arg1)
RETURN_VALUE
                           16
Lazy instantiation
                                function1
                                (
                                  Param1(None),
                                  Param2(None),
LOAD_GLOBAL       (A)
                                  ‘default’
CALL_FUNCTION      0
                                  )
STORE_FAST      (arg1)
LOAD_CONST      (‘arg1’)
LOAD_FAST       (arg1)
STORE_ATTR      (attr1)
LOAD_FAST       (arg1)
RETURN_VALUE
                           17
Lazy instantiation
                                function1
                                (
                                  Param1(None),
                                  Param2(None),
LOAD_GLOBAL       (A)
                                  ‘default’
CALL_FUNCTION      0
                                  )
STORE_FAST      (arg1)
LOAD_CONST      (‘arg1’)
LOAD_FAST       (arg1)
STORE_ATTR      (attr1)
LOAD_FAST       (arg1)
RETURN_VALUE
                           18
Lazy instantiation


                                TypeError!
LOAD_GLOBAL       (A)
CALL_FUNCTION      0
STORE_FAST      (arg1)
LOAD_CONST      (‘arg1’)
LOAD_FAST       (arg1)
STORE_ATTR      (attr1)
LOAD_FAST       (arg1)
RETURN_VALUE
                           19
Lazy instantiation
                                function1
                                (
                                  {
                                    ‘attr1’:
                                     Param1_attr1(None)
LOAD_GLOBAL       (A)             },
CALL_FUNCTION      0              Param2(None),
STORE_FAST      (arg1)            ‘default’
LOAD_CONST      (‘arg1’)          )
LOAD_FAST       (arg1)
STORE_ATTR      (attr1)
LOAD_FAST       (arg1)
RETURN_VALUE
                           20
Lazy instantiation
                                function1
                                (
                                  {
                                    ‘attr1’:
                                     Param1_attr1(None)
LOAD_GLOBAL       (A)             },
CALL_FUNCTION      0              None,
STORE_FAST      (arg1)            ‘default’
LOAD_CONST      (‘arg1’)          )
LOAD_FAST       (arg1)
STORE_ATTR      (attr1)
LOAD_FAST       (arg1)
RETURN_VALUE
                           21
Demonstration



    22
Architecture




     23
Challenges

• Vague error messages
• Lack of existing tool support
• Test program contains imports


                          24
Challenges

• Relationship between input arguments
• Various programming constructs
• Range of test data values


                          25
Limitations

• Custom Exceptions, e.g. InvalidGraphType
• Random functions
• Generators




                        26
Evaluation



    27
Criteria

• Quality
• Performance
• Generality


                   28
Results
        Python package




#




       29
Results



Mean number of iterations to achieve 100% coverage = 497




         30
Conclusion



    31
Future work

• improve tool sophistication
• optimise using PyPy
• more comprehensive benchmarks


                           32
evandrix.github.com/Splat

Weitere ähnliche Inhalte

Was ist angesagt?

GC in C++0x [eng]
GC in C++0x [eng]GC in C++0x [eng]
GC in C++0x [eng]yak1ex
 
The Ring programming language version 1.5.4 book - Part 80 of 185
The Ring programming language version 1.5.4 book - Part 80 of 185The Ring programming language version 1.5.4 book - Part 80 of 185
The Ring programming language version 1.5.4 book - Part 80 of 185Mahmoud Samir Fayed
 
Safe navigation in OCL
Safe navigation in OCLSafe navigation in OCL
Safe navigation in OCLEdward Willink
 
Harnessing asynchronicity callbacks, promises, generators, and coroutines
Harnessing asynchronicity   callbacks, promises, generators, and coroutinesHarnessing asynchronicity   callbacks, promises, generators, and coroutines
Harnessing asynchronicity callbacks, promises, generators, and coroutinesHaokang Den
 
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaRuntime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaJuan Fumero
 
VHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESVHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESkarthik kadava
 
The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189Mahmoud Samir Fayed
 
What's New about Java SE 8
What's New about Java SE 8What's New about Java SE 8
What's New about Java SE 8Yuichi Sakuraba
 
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Miguel Arroyo
 
The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015craig lehmann
 
The Ring programming language version 1.5.1 book - Part 76 of 180
The Ring programming language version 1.5.1 book - Part 76 of 180The Ring programming language version 1.5.1 book - Part 76 of 180
The Ring programming language version 1.5.1 book - Part 76 of 180Mahmoud Samir Fayed
 
JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020Joseph Kuo
 
Tech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic AnalysisTech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic AnalysisAdaCore
 

Was ist angesagt? (19)

OCL 2.4. (... 2.5)
OCL 2.4. (... 2.5)OCL 2.4. (... 2.5)
OCL 2.4. (... 2.5)
 
Yacf
YacfYacf
Yacf
 
GC in C++0x [eng]
GC in C++0x [eng]GC in C++0x [eng]
GC in C++0x [eng]
 
The Ring programming language version 1.5.4 book - Part 80 of 185
The Ring programming language version 1.5.4 book - Part 80 of 185The Ring programming language version 1.5.4 book - Part 80 of 185
The Ring programming language version 1.5.4 book - Part 80 of 185
 
Safe navigation in OCL
Safe navigation in OCLSafe navigation in OCL
Safe navigation in OCL
 
Harnessing asynchronicity callbacks, promises, generators, and coroutines
Harnessing asynchronicity   callbacks, promises, generators, and coroutinesHarnessing asynchronicity   callbacks, promises, generators, and coroutines
Harnessing asynchronicity callbacks, promises, generators, and coroutines
 
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in JavaRuntime Code Generation and Data Management for Heterogeneous Computing in Java
Runtime Code Generation and Data Management for Heterogeneous Computing in Java
 
Advance ROP Attacks
Advance ROP AttacksAdvance ROP Attacks
Advance ROP Attacks
 
VHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLESVHDL PROGRAMS FEW EXAMPLES
VHDL PROGRAMS FEW EXAMPLES
 
The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189The Ring programming language version 1.6 book - Part 83 of 189
The Ring programming language version 1.6 book - Part 83 of 189
 
oojs
oojsoojs
oojs
 
What's New about Java SE 8
What's New about Java SE 8What's New about Java SE 8
What's New about Java SE 8
 
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
Go Go Gadget! - An Intro to Return Oriented Programming (ROP)
 
The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015The OMR GC talk - Ruby Kaigi 2015
The OMR GC talk - Ruby Kaigi 2015
 
Scala to assembly
Scala to assemblyScala to assembly
Scala to assembly
 
Svelte
SvelteSvelte
Svelte
 
The Ring programming language version 1.5.1 book - Part 76 of 180
The Ring programming language version 1.5.1 book - Part 76 of 180The Ring programming language version 1.5.1 book - Part 76 of 180
The Ring programming language version 1.5.1 book - Part 76 of 180
 
JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020JCConf 2020 - New Java Features Released in 2020
JCConf 2020 - New Java Features Released in 2020
 
Tech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic AnalysisTech Days 2015: Dynamic Analysis
Tech Days 2015: Dynamic Analysis
 

Mehr von Lee Wei Yeong

CERTIFICATE-OF-COMPLETION
CERTIFICATE-OF-COMPLETIONCERTIFICATE-OF-COMPLETION
CERTIFICATE-OF-COMPLETIONLee Wei Yeong
 
RSA: Security Analytics Architecture for APT
RSA: Security Analytics Architecture for APTRSA: Security Analytics Architecture for APT
RSA: Security Analytics Architecture for APTLee Wei Yeong
 

Mehr von Lee Wei Yeong (6)

evandrix-SNCK2016
evandrix-SNCK2016evandrix-SNCK2016
evandrix-SNCK2016
 
CERTIFICATE-OF-COMPLETION
CERTIFICATE-OF-COMPLETIONCERTIFICATE-OF-COMPLETION
CERTIFICATE-OF-COMPLETION
 
Dive into ROP
Dive into ROPDive into ROP
Dive into ROP
 
RSA: Security Analytics Architecture for APT
RSA: Security Analytics Architecture for APTRSA: Security Analytics Architecture for APT
RSA: Security Analytics Architecture for APT
 
Finding a Way Out
Finding a Way OutFinding a Way Out
Finding a Way Out
 
Simple made easy
Simple made easySimple made easy
Simple made easy
 

Kürzlich hochgeladen

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
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
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
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
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
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
 
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
 
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
 
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
 
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
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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
 
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
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
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...
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
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
 
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
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Splat

Hinweis der Redaktion

  1. \n
  2. \n
  3. essential to guarantee confidence in bug-free solution delivery\naccounts for almost half of software development cost; yet not present in final product shipped\n\n
  4. rapid prototyping; clearly expose the underlying algorithm\n
  5. simple:instruction set of one-byte opcodes, followed by optional parameter\nfast:in terms of execution (beneficial for iterations)\n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. # Demo 1\n# figure out shape of function input arguments\ncd /Users/lwy08/Dropbox/FYP/fyp/fyp; python main.py trivial\ncd trivial-tests; nosetests; cd ..\n\n# Demo 2a\n# test for branch coverage using (random) range of values\n# open absolute.py\ncd /Users/lwy08/Dropbox/FYP/fyp/fyp; python all_paths.py absolute.pyc\n# open test_absolute.py\npython test_absolute.py\n\n# Demo 2b\n# graphic visualisation script\ncd /Users/lwy08/Dropbox/FYP/fyp/fyp; python gui.py\n\n
  23. - tracer\n- also supports recursive function testing\n\n
  24. \n
  25. \n
  26. \n
  27. \n
  28. Performance - Runtime complexity + space efficiency\nlimits imposed on recursion depth, generating test data values & #iterations for type inference\n
  29. CC measures #linearly independent paths through the source code\n
  30. \n
  31. \n
  32. \n
  33. \n