SlideShare une entreprise Scribd logo
1  sur  24
Télécharger pour lire hors ligne
OpenERP Testing Tools
Unittest, YAML, OERPScenario
Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
2/24www.camptocamp.com /
Manual testing
■ Is boring
■ Is error prone
■ Is repetitive
■ Is boring
■ Is tedious
■ Is repetitive
3/24www.camptocamp.com /
What is automated testing?
■ Our job as software developers is to teach the
computer how to do the boring, tedious, repetitive
stuff
■ And then watch the computer do it for us
○ Again
○ And again
○ And again
4/24www.camptocamp.com /
What is this talk not about?
■ Exploratory testing
■ QA
■ Arguing about what is unit testing vs. integration
testing vs. behavior testing vs. Younameit testing
■ Arguing about all the bad reasons you come up with
imagine for not writing tests
5/24www.camptocamp.com /
So what is it about?
■ Testing as part of the process of writing and
maintaining code
■ Convince you of the importance of writing automated
tests
■ Show you tools that will help you write and run tests
■ Help you enhance the quality of your development
with tests
6/24www.camptocamp.com /
Your duty as a software developer
■ Write maintainable code
■ Write tests for that code
○ Tests help understand the intent of a piece of code
○ Tests help understand the impact of a modification
■ Even better: write the test for a feature / bug first, and then
the code that makes the test pass, TDD style
■ Write automated tests for bugs you see
■ Ensure your code fixes the tests
7/24www.camptocamp.com /
TDD rhythm
■ Write new test : Red
■ Make test pass : Green
■ Refactor : Green
■ Start again !
Image source:
http://www.peterprovost.org/blog/2012/05/02/kata-the-only-way-to-learn-tdd
8/24www.camptocamp.com /
Testing tools : unittest
■ Written in Python, using the well known unittest2 stdlib module
■ Extensions to unittest2 available in openerp.test.common
○ new base test case class TransactionCase:
- self.cr, self.uid
- rollbacks between each tests method
○ new base test case class SingleTransactionTestCase:
- self.cr, self.uid
- one big transaction for all the test methods (caution there)
■ Write the setUp method (don't forget to call super(YourClass, self).setUp()
■ Write the different tests methods you want on the objects created in setUp
■ Don't forget to add your test module in tests/__init__.py, generally in the checks suite
■ Lots of information available on https://doc.openerp.com/trunk/server/05_test_framework/
9/24www.camptocamp.com /
Unittest example
lunch/tests/test_lunch.py
10/24www.camptocamp.com /
Testing tools : YAML tests
■ Written in YAML
■ YAML node shortcuts provided by OpenERP to:
○ create records (!record), with support for refering to
other models by XML ID
○ send workflow messages (!workflow)
○ make testing assertions (!assert)
○ write raw Python in YAML blocks (!python)
11/24www.camptocamp.com /
YAML test example
sale_stock/test/picking_order_policy.yml
12/24www.camptocamp.com /
Testing tools : BDD (behave / OERPScenario)
■ Behavior Driven Development style
■ Possible to decouple the behavior of the test from
the implementation
■ Reusable DSL for common operations
■ Interface between the end user and the developer
13/24www.camptocamp.com /
Behave
■ Behave is a Python project bringing the Gherkin language (used by Ruby
project Cucumber to express test features) to the Python world
■ Features:
○ Implementation of Gherkin (Feature, Scenario, tags...)
○ Tabular data
○ Text blocks
○ Test feature discovery
○ Step definition helpers (Python decorators)
○ Test runner, with scenario selection using tags in the Feature definitions, optional
syntax coloring, reports...
14/24www.camptocamp.com /
OERPScenario
■ OERPScenario is a project by Camptocamp to help write BDD features for OpenERP,
○ Original version written in Ruby + OOoR (OpenObject on Rails) for Cucumber
○ Ported to Python using ERPPeek as the low level layer for interacting with OpenERP
○ Port got inspiration from openobject-mirliton project
https://github.com/florentx/openobject-mirliton
■ Can use run OpenERP inside the test process
○ Or connect to remote instance
■ Extensible library of steps / phrases for use in tests and instance configuration
■ Helpers to refer to other records by name or by xml id
15/24www.camptocamp.com /
BDD example : feature definition
16/24www.camptocamp.com /
BDD example : step definition
17/24www.camptocamp.com /
Choosing the right tool
Use unittest when:
■ you want to test a specific method of a model
■ your testing needs the full flexibility of Python
■ you need to see that the test pass on
http://runbot.openerp.com
18/24www.camptocamp.com /
Choosing the right tool
Use YAML tests when:
■ you need to create a complex setup, with different objects
■ you need to test workflows
■ the size of !python blocks you need to write is manageable
■ you need to see that the test pass on
http://runbot.openerp.com
19/24www.camptocamp.com /
Choosing the right tool
Use behave/OERPScenario tests when:
■ you need to validate a feature with your customer
■ you want to capture customer requirements
○ possibly long before implementation is starts
■ you want to write cross module tests
■ you need to abstract the implementation away from
the test specification
20/24www.camptocamp.com /
Current state of testing in OpenERP 7
■ There is an existing test base in the framework and the addons
○ The runbot ensures that they pass
○ Caution: the presence of YAML tests files in the sources of an addon does not
mean that the tests are run
○ There are some unittests (less than 20 standard addons)
○ Hard to get an idea of the coverage
■ The state of community addons is alarming!
○ Almost no YAML tests or unittests
○ Some behave tests available
○ No support of runbot for community addons
21/24www.camptocamp.com /
Bug reports, patches and tests
■ In an ideal world, each bug fix comes with one or more tests that the developer added
to reproduce the bug, and then check that the bug was fixed
○ When you report a bug against openobject­server or openobject­addons, try to
include in addition to the "steps to reproduce" an automated test, to help the support team
reproduce your issue
○ Same thing for community addons
■ When you submit a patch, please make sure your patch includes a test showing what
you are fixing
○ This greatly eases the work of the reviewers, and the backporting to the OCB branches
■ When you submit new community modules, try to provide some tests
■ When you submit patches to community modules, tests are appreciated too
22/24www.camptocamp.com /
How MP without tests should be handled
Message:
Please add at least one automated
test showing the code works as intended
Review: needs fixing
23/24www.camptocamp.com /
URLs
■ Projects
○ http://launchpad.net/oerpscenario
○ https://pypi.python.org/pypi/unittest2
○ https://doc.openerp.com/trunk/server/05_test_framework/
○ https://pypi.python.org/pypi/behave
○ https://pypi.python.org/pypi/anybox.recipe.openerp/
■ Development philosophies
○ http://en.wikipedia.org/wiki/Test_Driven_Development
○ http://en.wikipedia.org/wiki/Behavior_driven_development
■ Testing
○ http://tap.szabgab.com/
○ http://en.wikipedia.org/wiki/Exploratory_testing
24/24www.camptocamp.com /
Questions
■ If time allows...

Contenu connexe

Tendances

Improving the performance of Odoo deployments
Improving the performance of Odoo deploymentsImproving the performance of Odoo deployments
Improving the performance of Odoo deploymentsOdoo
 
New Framework - ORM
New Framework - ORMNew Framework - ORM
New Framework - ORMOdoo
 
Impact of the New ORM on Your Modules
Impact of the New ORM on Your ModulesImpact of the New ORM on Your Modules
Impact of the New ORM on Your ModulesOdoo
 
Load Testing - How to Stress Your Odoo with Locust
Load Testing - How to Stress Your Odoo with LocustLoad Testing - How to Stress Your Odoo with Locust
Load Testing - How to Stress Your Odoo with LocustOdoo
 
Best Tools for first time Odoo Development
Best Tools for first time Odoo DevelopmentBest Tools for first time Odoo Development
Best Tools for first time Odoo DevelopmentOdoo
 
An in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORMAn in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORMOdoo
 
Simple Odoo ERP auto scaling on AWS
Simple Odoo ERP auto scaling on AWSSimple Odoo ERP auto scaling on AWS
Simple Odoo ERP auto scaling on AWSJulien Lecadou,MSc.
 
Discover GraphQL with Python, Graphene and Odoo
Discover GraphQL with Python, Graphene and OdooDiscover GraphQL with Python, Graphene and Odoo
Discover GraphQL with Python, Graphene and OdooOdoo
 
Common Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsCommon Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsOdoo
 
Domino OSGi Development
Domino OSGi DevelopmentDomino OSGi Development
Domino OSGi DevelopmentPaul Fiore
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and pythonChetan Giridhar
 
Getting started with Svelte Presentation
Getting started with Svelte PresentationGetting started with Svelte Presentation
Getting started with Svelte PresentationKnoldus Inc.
 
Monolith vs Microservices with Golang at practice - Ivan Kutuzov
Monolith vs Microservices with Golang at practice  -  Ivan Kutuzov Monolith vs Microservices with Golang at practice  -  Ivan Kutuzov
Monolith vs Microservices with Golang at practice - Ivan Kutuzov Kuberton
 
Product Configurator: Advanced Use Case
Product Configurator: Advanced Use CaseProduct Configurator: Advanced Use Case
Product Configurator: Advanced Use CaseOdoo
 
Simple callcenter platform with PHP
Simple callcenter platform with PHPSimple callcenter platform with PHP
Simple callcenter platform with PHPMorten Amundsen
 
Clean pragmatic architecture @ devflix
Clean pragmatic architecture @ devflixClean pragmatic architecture @ devflix
Clean pragmatic architecture @ devflixVictor Rentea
 
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMUSFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMULinaro
 
Asynchronous JS in Odoo
Asynchronous JS in OdooAsynchronous JS in Odoo
Asynchronous JS in OdooOdoo
 
Practical Operation Automation with StackStorm
Practical Operation Automation with StackStormPractical Operation Automation with StackStorm
Practical Operation Automation with StackStormShu Sugimoto
 

Tendances (20)

Improving the performance of Odoo deployments
Improving the performance of Odoo deploymentsImproving the performance of Odoo deployments
Improving the performance of Odoo deployments
 
New Framework - ORM
New Framework - ORMNew Framework - ORM
New Framework - ORM
 
Impact of the New ORM on Your Modules
Impact of the New ORM on Your ModulesImpact of the New ORM on Your Modules
Impact of the New ORM on Your Modules
 
Load Testing - How to Stress Your Odoo with Locust
Load Testing - How to Stress Your Odoo with LocustLoad Testing - How to Stress Your Odoo with Locust
Load Testing - How to Stress Your Odoo with Locust
 
Best Tools for first time Odoo Development
Best Tools for first time Odoo DevelopmentBest Tools for first time Odoo Development
Best Tools for first time Odoo Development
 
An in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORMAn in Depth Journey into Odoo's ORM
An in Depth Journey into Odoo's ORM
 
Simple Odoo ERP auto scaling on AWS
Simple Odoo ERP auto scaling on AWSSimple Odoo ERP auto scaling on AWS
Simple Odoo ERP auto scaling on AWS
 
Discover GraphQL with Python, Graphene and Odoo
Discover GraphQL with Python, Graphene and OdooDiscover GraphQL with Python, Graphene and Odoo
Discover GraphQL with Python, Graphene and Odoo
 
Common Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo appsCommon Performance Pitfalls in Odoo apps
Common Performance Pitfalls in Odoo apps
 
Domino OSGi Development
Domino OSGi DevelopmentDomino OSGi Development
Domino OSGi Development
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and python
 
Getting started with Svelte Presentation
Getting started with Svelte PresentationGetting started with Svelte Presentation
Getting started with Svelte Presentation
 
Monolith vs Microservices with Golang at practice - Ivan Kutuzov
Monolith vs Microservices with Golang at practice  -  Ivan Kutuzov Monolith vs Microservices with Golang at practice  -  Ivan Kutuzov
Monolith vs Microservices with Golang at practice - Ivan Kutuzov
 
Product Configurator: Advanced Use Case
Product Configurator: Advanced Use CaseProduct Configurator: Advanced Use Case
Product Configurator: Advanced Use Case
 
Simple callcenter platform with PHP
Simple callcenter platform with PHPSimple callcenter platform with PHP
Simple callcenter platform with PHP
 
Clean pragmatic architecture @ devflix
Clean pragmatic architecture @ devflixClean pragmatic architecture @ devflix
Clean pragmatic architecture @ devflix
 
libSQL
libSQLlibSQL
libSQL
 
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMUSFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
 
Asynchronous JS in Odoo
Asynchronous JS in OdooAsynchronous JS in Odoo
Asynchronous JS in Odoo
 
Practical Operation Automation with StackStorm
Practical Operation Automation with StackStormPractical Operation Automation with StackStorm
Practical Operation Automation with StackStorm
 

Similaire à Why and how to develop OpenERP test scenarios (in python and using OERPScenario), Alexandre Fayolle, Camptocamp

How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...Max Barrass
 
Write unit test from scratch
Write unit test from scratchWrite unit test from scratch
Write unit test from scratchWen-Shih Chao
 
Continuous Integration In Php
Continuous Integration In PhpContinuous Integration In Php
Continuous Integration In PhpWilco Jansen
 
[SRD UGM] Sharing Session - Software Testing
[SRD UGM] Sharing Session - Software Testing[SRD UGM] Sharing Session - Software Testing
[SRD UGM] Sharing Session - Software TestingAhmad Widardi
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Sam Becker
 
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
 
HKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHGHKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHGLinaro
 
Boosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedbackBoosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedbackAntonio García-Domínguez
 
Best practices for JavaScript RIAs
Best practices for JavaScript RIAsBest practices for JavaScript RIAs
Best practices for JavaScript RIAsCarlos Ble
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox testsKevin Beeman
 
Tips and Tricks for Testing Lambda Expressions in Android
Tips and Tricks for Testing Lambda Expressions in AndroidTips and Tricks for Testing Lambda Expressions in Android
Tips and Tricks for Testing Lambda Expressions in AndroidDavid Carver
 
Lessons learned on software testing automation
Lessons learned on software testing automationLessons learned on software testing automation
Lessons learned on software testing automationgaoliang641
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Engineor
 
Software Testing & Debugging
Software Testing & DebuggingSoftware Testing & Debugging
Software Testing & DebuggingComputing Cage
 

Similaire à Why and how to develop OpenERP test scenarios (in python and using OERPScenario), Alexandre Fayolle, Camptocamp (20)

How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...How to establish ways of working that allows shifting-left of the automation ...
How to establish ways of working that allows shifting-left of the automation ...
 
Write unit test from scratch
Write unit test from scratchWrite unit test from scratch
Write unit test from scratch
 
Unit testing (eng)
Unit testing (eng)Unit testing (eng)
Unit testing (eng)
 
Evolve with laravel
Evolve with laravelEvolve with laravel
Evolve with laravel
 
Continuous Integration In Php
Continuous Integration In PhpContinuous Integration In Php
Continuous Integration In Php
 
[SRD UGM] Sharing Session - Software Testing
[SRD UGM] Sharing Session - Software Testing[SRD UGM] Sharing Session - Software Testing
[SRD UGM] Sharing Session - Software Testing
 
Software Testing and Debugging
Software Testing and DebuggingSoftware Testing and Debugging
Software Testing and Debugging
 
Automated testing
Automated testingAutomated testing
Automated testing
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
 
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
 
HKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHGHKG15-411: Browser Testing Framework for LHG
HKG15-411: Browser Testing Framework for LHG
 
Boosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedbackBoosting individual feedback with AutoFeedback
Boosting individual feedback with AutoFeedback
 
Best practices for JavaScript RIAs
Best practices for JavaScript RIAsBest practices for JavaScript RIAs
Best practices for JavaScript RIAs
 
UPC Plone Testing Talk
UPC Plone Testing TalkUPC Plone Testing Talk
UPC Plone Testing Talk
 
Containerize your Blackbox tests
Containerize your Blackbox testsContainerize your Blackbox tests
Containerize your Blackbox tests
 
Tips and Tricks for Testing Lambda Expressions in Android
Tips and Tricks for Testing Lambda Expressions in AndroidTips and Tricks for Testing Lambda Expressions in Android
Tips and Tricks for Testing Lambda Expressions in Android
 
Lessons learned on software testing automation
Lessons learned on software testing automationLessons learned on software testing automation
Lessons learned on software testing automation
 
Testing Spring Applications
Testing Spring ApplicationsTesting Spring Applications
Testing Spring Applications
 
Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)Codeception: introduction to php testing (v2 - Aberdeen php)
Codeception: introduction to php testing (v2 - Aberdeen php)
 
Software Testing & Debugging
Software Testing & DebuggingSoftware Testing & Debugging
Software Testing & Debugging
 

Plus de Odoo

Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!Odoo
 
Odoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-ViewerOdoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-ViewerOdoo
 
Keynote - Vision & Strategy
Keynote - Vision & StrategyKeynote - Vision & Strategy
Keynote - Vision & StrategyOdoo
 
Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14Odoo
 
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting CapabilityExtending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting CapabilityOdoo
 
Managing Multi-channel Selling with Odoo
Managing Multi-channel Selling with OdooManaging Multi-channel Selling with Odoo
Managing Multi-channel Selling with OdooOdoo
 
Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?Odoo
 
Rock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced OperationsRock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced OperationsOdoo
 
Transition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organizationTransition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organizationOdoo
 
Synchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the CrisisSynchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the CrisisOdoo
 
Running a University with Odoo
Running a University with OdooRunning a University with Odoo
Running a University with OdooOdoo
 
Down Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in OdooDown Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in OdooOdoo
 
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach foodOdoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach foodOdoo
 
Migration from Salesforce to Odoo
Migration from Salesforce to OdooMigration from Salesforce to Odoo
Migration from Salesforce to OdooOdoo
 
Preventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine LearningPreventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine LearningOdoo
 
Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification Odoo
 
Instant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping LabelInstant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping LabelOdoo
 
How Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 FoldHow Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 FoldOdoo
 
From Shopify to Odoo
From Shopify to OdooFrom Shopify to Odoo
From Shopify to OdooOdoo
 
Digital Transformation at Old MacDonald Farms: A Personal Story
Digital Transformation at Old MacDonald Farms: A Personal StoryDigital Transformation at Old MacDonald Farms: A Personal Story
Digital Transformation at Old MacDonald Farms: A Personal StoryOdoo
 

Plus de Odoo (20)

Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!Timesheet Workshop: The Timesheet App People Love!
Timesheet Workshop: The Timesheet App People Love!
 
Odoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-ViewerOdoo 3D Product View with Google Model-Viewer
Odoo 3D Product View with Google Model-Viewer
 
Keynote - Vision & Strategy
Keynote - Vision & StrategyKeynote - Vision & Strategy
Keynote - Vision & Strategy
 
Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14Opening Keynote - Unveilling Odoo 14
Opening Keynote - Unveilling Odoo 14
 
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting CapabilityExtending Odoo with a Comprehensive Budgeting and Forecasting Capability
Extending Odoo with a Comprehensive Budgeting and Forecasting Capability
 
Managing Multi-channel Selling with Odoo
Managing Multi-channel Selling with OdooManaging Multi-channel Selling with Odoo
Managing Multi-channel Selling with Odoo
 
Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?Accounting Automation: How Much Money We Saved and How?
Accounting Automation: How Much Money We Saved and How?
 
Rock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced OperationsRock Your Logistics with Advanced Operations
Rock Your Logistics with Advanced Operations
 
Transition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organizationTransition from a cost to a flow-centric organization
Transition from a cost to a flow-centric organization
 
Synchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the CrisisSynchronization: The Supply Chain Response to Overcome the Crisis
Synchronization: The Supply Chain Response to Overcome the Crisis
 
Running a University with Odoo
Running a University with OdooRunning a University with Odoo
Running a University with Odoo
 
Down Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in OdooDown Payments on Purchase Orders in Odoo
Down Payments on Purchase Orders in Odoo
 
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach foodOdoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
Odoo Implementation in Phases - Success Story of a Retail Chain 3Sach food
 
Migration from Salesforce to Odoo
Migration from Salesforce to OdooMigration from Salesforce to Odoo
Migration from Salesforce to Odoo
 
Preventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine LearningPreventing User Mistakes by Using Machine Learning
Preventing User Mistakes by Using Machine Learning
 
Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification Becoming an Odoo Expert: How to Prepare for the Certification
Becoming an Odoo Expert: How to Prepare for the Certification
 
Instant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping LabelInstant Printing of any Odoo Report or Shipping Label
Instant Printing of any Odoo Report or Shipping Label
 
How Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 FoldHow Odoo helped an Organization Grow 3 Fold
How Odoo helped an Organization Grow 3 Fold
 
From Shopify to Odoo
From Shopify to OdooFrom Shopify to Odoo
From Shopify to Odoo
 
Digital Transformation at Old MacDonald Farms: A Personal Story
Digital Transformation at Old MacDonald Farms: A Personal StoryDigital Transformation at Old MacDonald Farms: A Personal Story
Digital Transformation at Old MacDonald Farms: A Personal Story
 

Dernier

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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
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
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
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
 
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
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 

Dernier (20)

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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
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?
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
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
 
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!
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 

Why and how to develop OpenERP test scenarios (in python and using OERPScenario), Alexandre Fayolle, Camptocamp

  • 1. OpenERP Testing Tools Unittest, YAML, OERPScenario Alexandre Fayolle <alexandre.fayolle@camptocamp.com>
  • 2. 2/24www.camptocamp.com / Manual testing ■ Is boring ■ Is error prone ■ Is repetitive ■ Is boring ■ Is tedious ■ Is repetitive
  • 3. 3/24www.camptocamp.com / What is automated testing? ■ Our job as software developers is to teach the computer how to do the boring, tedious, repetitive stuff ■ And then watch the computer do it for us ○ Again ○ And again ○ And again
  • 4. 4/24www.camptocamp.com / What is this talk not about? ■ Exploratory testing ■ QA ■ Arguing about what is unit testing vs. integration testing vs. behavior testing vs. Younameit testing ■ Arguing about all the bad reasons you come up with imagine for not writing tests
  • 5. 5/24www.camptocamp.com / So what is it about? ■ Testing as part of the process of writing and maintaining code ■ Convince you of the importance of writing automated tests ■ Show you tools that will help you write and run tests ■ Help you enhance the quality of your development with tests
  • 6. 6/24www.camptocamp.com / Your duty as a software developer ■ Write maintainable code ■ Write tests for that code ○ Tests help understand the intent of a piece of code ○ Tests help understand the impact of a modification ■ Even better: write the test for a feature / bug first, and then the code that makes the test pass, TDD style ■ Write automated tests for bugs you see ■ Ensure your code fixes the tests
  • 7. 7/24www.camptocamp.com / TDD rhythm ■ Write new test : Red ■ Make test pass : Green ■ Refactor : Green ■ Start again ! Image source: http://www.peterprovost.org/blog/2012/05/02/kata-the-only-way-to-learn-tdd
  • 8. 8/24www.camptocamp.com / Testing tools : unittest ■ Written in Python, using the well known unittest2 stdlib module ■ Extensions to unittest2 available in openerp.test.common ○ new base test case class TransactionCase: - self.cr, self.uid - rollbacks between each tests method ○ new base test case class SingleTransactionTestCase: - self.cr, self.uid - one big transaction for all the test methods (caution there) ■ Write the setUp method (don't forget to call super(YourClass, self).setUp() ■ Write the different tests methods you want on the objects created in setUp ■ Don't forget to add your test module in tests/__init__.py, generally in the checks suite ■ Lots of information available on https://doc.openerp.com/trunk/server/05_test_framework/
  • 10. 10/24www.camptocamp.com / Testing tools : YAML tests ■ Written in YAML ■ YAML node shortcuts provided by OpenERP to: ○ create records (!record), with support for refering to other models by XML ID ○ send workflow messages (!workflow) ○ make testing assertions (!assert) ○ write raw Python in YAML blocks (!python)
  • 11. 11/24www.camptocamp.com / YAML test example sale_stock/test/picking_order_policy.yml
  • 12. 12/24www.camptocamp.com / Testing tools : BDD (behave / OERPScenario) ■ Behavior Driven Development style ■ Possible to decouple the behavior of the test from the implementation ■ Reusable DSL for common operations ■ Interface between the end user and the developer
  • 13. 13/24www.camptocamp.com / Behave ■ Behave is a Python project bringing the Gherkin language (used by Ruby project Cucumber to express test features) to the Python world ■ Features: ○ Implementation of Gherkin (Feature, Scenario, tags...) ○ Tabular data ○ Text blocks ○ Test feature discovery ○ Step definition helpers (Python decorators) ○ Test runner, with scenario selection using tags in the Feature definitions, optional syntax coloring, reports...
  • 14. 14/24www.camptocamp.com / OERPScenario ■ OERPScenario is a project by Camptocamp to help write BDD features for OpenERP, ○ Original version written in Ruby + OOoR (OpenObject on Rails) for Cucumber ○ Ported to Python using ERPPeek as the low level layer for interacting with OpenERP ○ Port got inspiration from openobject-mirliton project https://github.com/florentx/openobject-mirliton ■ Can use run OpenERP inside the test process ○ Or connect to remote instance ■ Extensible library of steps / phrases for use in tests and instance configuration ■ Helpers to refer to other records by name or by xml id
  • 17. 17/24www.camptocamp.com / Choosing the right tool Use unittest when: ■ you want to test a specific method of a model ■ your testing needs the full flexibility of Python ■ you need to see that the test pass on http://runbot.openerp.com
  • 18. 18/24www.camptocamp.com / Choosing the right tool Use YAML tests when: ■ you need to create a complex setup, with different objects ■ you need to test workflows ■ the size of !python blocks you need to write is manageable ■ you need to see that the test pass on http://runbot.openerp.com
  • 19. 19/24www.camptocamp.com / Choosing the right tool Use behave/OERPScenario tests when: ■ you need to validate a feature with your customer ■ you want to capture customer requirements ○ possibly long before implementation is starts ■ you want to write cross module tests ■ you need to abstract the implementation away from the test specification
  • 20. 20/24www.camptocamp.com / Current state of testing in OpenERP 7 ■ There is an existing test base in the framework and the addons ○ The runbot ensures that they pass ○ Caution: the presence of YAML tests files in the sources of an addon does not mean that the tests are run ○ There are some unittests (less than 20 standard addons) ○ Hard to get an idea of the coverage ■ The state of community addons is alarming! ○ Almost no YAML tests or unittests ○ Some behave tests available ○ No support of runbot for community addons
  • 21. 21/24www.camptocamp.com / Bug reports, patches and tests ■ In an ideal world, each bug fix comes with one or more tests that the developer added to reproduce the bug, and then check that the bug was fixed ○ When you report a bug against openobject­server or openobject­addons, try to include in addition to the "steps to reproduce" an automated test, to help the support team reproduce your issue ○ Same thing for community addons ■ When you submit a patch, please make sure your patch includes a test showing what you are fixing ○ This greatly eases the work of the reviewers, and the backporting to the OCB branches ■ When you submit new community modules, try to provide some tests ■ When you submit patches to community modules, tests are appreciated too
  • 22. 22/24www.camptocamp.com / How MP without tests should be handled Message: Please add at least one automated test showing the code works as intended Review: needs fixing
  • 23. 23/24www.camptocamp.com / URLs ■ Projects ○ http://launchpad.net/oerpscenario ○ https://pypi.python.org/pypi/unittest2 ○ https://doc.openerp.com/trunk/server/05_test_framework/ ○ https://pypi.python.org/pypi/behave ○ https://pypi.python.org/pypi/anybox.recipe.openerp/ ■ Development philosophies ○ http://en.wikipedia.org/wiki/Test_Driven_Development ○ http://en.wikipedia.org/wiki/Behavior_driven_development ■ Testing ○ http://tap.szabgab.com/ ○ http://en.wikipedia.org/wiki/Exploratory_testing