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

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Kürzlich hochgeladen (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

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