SlideShare a Scribd company logo
1 of 19
Download to read offline
Record automated
integration tests through
the UI
Stanislas SOBIESKI • Client Solution Developer
2019
EXPERIENCE
Why a custom tool to
record integration
tests?
1
● Avoid regression with new development
● Miss time to write your own unit tests
Why testing your code ?
● Meaningful for end users
● End user manage the business part
and you handle the techy one
Why an integration test tool ?
● Tests don’t need to be changed after a smallest
change in a view
● Creates server Odoo python code
● Use of our CI tool:
○ Runbot
○ Odoo.sh dev environment
Yet another custom Odoo tool
Our tool: an Odoo module
● Module Available on
https://github.com/odoo/ps-runbot-testing, for version 10.0,
11.0, 12.0, 13.0
● Add the repository to your addons path
● Add it on your custom runbot environment or Odoo.sh or
locally
● Make sure runbot_testing_recording is installed
● Warning:
○ use it only on a testing environment
○ Does not cover use cases that uses controller (website)
How to create test ?
The UI side2
1. Record your flow
2. Flag it in the UI when
a test should be
needed, to check a
value, or something
else.
The tool automatically catches
errors and suggests to record
them
All the test is stored in the
database
How to create test ?
the Dark side3
Add the custom code to the module you want to test using
the unit test framework of Odoo
# -*- coding: utf-8 -*-
from odoo.tests import common
class DoMyTest(common.TransactionCase):
def test_do_my_test(self):
'''
here is a description of my test
'''
uid = self.env.ref('base.user_admin').id
record = self.env['sale.order'].with_context({
'lang': 'en_US',
'search_default_my_quotation': 1,
'tz': 'Europe/Brussels',
'uid': uid
- The module tries to create external id dynamically
- When referencing other records in method like create
or write, the module tries to find the external id or the
smallest link to a record previously used
- A manual pass is required to fix the unfound ids, and to
create the actual tests to be made within the recorded
business flow
# TODO: Check or Find record_ids link (external id or otherwise)
record_ids = [
10,
]
active_id =
self.env.ref('sale_management.hereismytest_sale_advance_payment_inv_4').id
active_ids = [
self.env.ref('sale_management.hereismytest_sale_advance_payment_inv_4').id,
]
uid = self.env.ref('base.user_admin').id
self.env['account.move].browse(record_ids).with_context({
'active_id': active_id,
'active_ids': active_ids,
'active_model': 'sale.advance.payment.inv',
'type': 'out_invoice',
'uid': uid
}).with_user(uid).action_invoice_open()
'''TODO: DO A TEST HERE:
Here check amount due on invoice is 160 dollars
'''
● Fix some
references to
something that
can be
reproduce based
on a record
created earlier
● Add tests to
match with
textual
description
● Make sure the integrated
test passes a fresh install
with --test-enable on your CI
tool such as the runbot
● Use those test to make sure
you avoid regression in
future development
Demo4
Conclusions5
Conclusions
● Use the unit test to test server side integration
tests
● Write a 1000 lines of code test in a few hours
● Involve end user in your testing process
● Ensure robustness for continuous development as
well as migration of custom code
Any questions?
#odooexperience
2018
2019
EXPERIENCE

More Related Content

Similar to Record Automated Integration Tests through the UI

TangoWithDjango - ch8
TangoWithDjango - ch8TangoWithDjango - ch8
TangoWithDjango - ch8
Asika Kuo
 
Inventory your network and clients with PowerShell
Inventory your network and clients with PowerShellInventory your network and clients with PowerShell
Inventory your network and clients with PowerShell
Concentrated Technology
 
STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
Anna Russo
 

Similar to Record Automated Integration Tests through the UI (20)

Moodle Development Best Pracitces
Moodle Development Best PracitcesMoodle Development Best Pracitces
Moodle Development Best Pracitces
 
Advanced Coded UI Testing
Advanced Coded UI TestingAdvanced Coded UI Testing
Advanced Coded UI Testing
 
Dolibarr - information for developers and partners - devcamp lyon 2019
Dolibarr - information for developers and partners - devcamp lyon 2019Dolibarr - information for developers and partners - devcamp lyon 2019
Dolibarr - information for developers and partners - devcamp lyon 2019
 
Android open source project build system phi innovations - android summit 2015
Android open source project build system   phi innovations - android summit 2015Android open source project build system   phi innovations - android summit 2015
Android open source project build system phi innovations - android summit 2015
 
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
Creating a Smooth Development Workflow for High-Quality Modular Open-Source P...
 
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code TestingBinary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code Testing
 
Drupal 7 ci and testing
Drupal 7 ci and testingDrupal 7 ci and testing
Drupal 7 ci and testing
 
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
Deep Dive Modern Apps Lifecycle with Visual Studio 2012: How to create cross ...
 
NET Code Testing
NET Code TestingNET Code Testing
NET Code Testing
 
TangoWithDjango - ch8
TangoWithDjango - ch8TangoWithDjango - ch8
TangoWithDjango - ch8
 
Inventory your network and clients with PowerShell
Inventory your network and clients with PowerShellInventory your network and clients with PowerShell
Inventory your network and clients with PowerShell
 
Introduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceIntroduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe Commerce
 
Introduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe CommerceIntroduction to Integration Tests in Magento / Adobe Commerce
Introduction to Integration Tests in Magento / Adobe Commerce
 
Python and test
Python and testPython and test
Python and test
 
Unit Testing Using N Unit
Unit Testing Using N UnitUnit Testing Using N Unit
Unit Testing Using N Unit
 
Odoo Experience 2018 - Odoo.sh for Developers
Odoo Experience 2018 - Odoo.sh for DevelopersOdoo Experience 2018 - Odoo.sh for Developers
Odoo Experience 2018 - Odoo.sh for Developers
 
Why Browser Debugger is a Developer's Best Friend
Why Browser Debugger is a Developer's Best FriendWhy Browser Debugger is a Developer's Best Friend
Why Browser Debugger is a Developer's Best Friend
 
STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
 
Test Driven Development (TDD) with Windows PowerShell
Test Driven Development (TDD) with Windows PowerShellTest Driven Development (TDD) with Windows PowerShell
Test Driven Development (TDD) with Windows PowerShell
 
Tutorial: extending the zend server ui and web api
Tutorial: extending the zend server ui and web apiTutorial: extending the zend server ui and web api
Tutorial: extending the zend server ui and web api
 

More from Odoo

More from 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
 
Product Configurator: Advanced Use Case
Product Configurator: Advanced Use CaseProduct Configurator: Advanced Use Case
Product Configurator: Advanced Use Case
 
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
 

Recently uploaded

Structuring and Writing DRL Mckinsey (1).pdf
Structuring and Writing DRL Mckinsey (1).pdfStructuring and Writing DRL Mckinsey (1).pdf
Structuring and Writing DRL Mckinsey (1).pdf
laloo_007
 
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
DUBAI (+971)581248768 BUY ABORTION PILLS IN ABU dhabi...Qatar
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
daisycvs
 
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in OmanMifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
instagramfab782445
 
Mckinsey foundation level Handbook for Viewing
Mckinsey foundation level Handbook for ViewingMckinsey foundation level Handbook for Viewing
Mckinsey foundation level Handbook for Viewing
Nauman Safdar
 

Recently uploaded (20)

Structuring and Writing DRL Mckinsey (1).pdf
Structuring and Writing DRL Mckinsey (1).pdfStructuring and Writing DRL Mckinsey (1).pdf
Structuring and Writing DRL Mckinsey (1).pdf
 
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAIGetting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
Getting Real with AI - Columbus DAW - May 2024 - Nick Woo from AlignAI
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1
 
Falcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business GrowthFalcon Invoice Discounting: Empowering Your Business Growth
Falcon Invoice Discounting: Empowering Your Business Growth
 
Cracking the 'Career Pathing' Slideshare
Cracking the 'Career Pathing' SlideshareCracking the 'Career Pathing' Slideshare
Cracking the 'Career Pathing' Slideshare
 
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
!~+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUD...
 
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai KuwaitThe Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
The Abortion pills for sale in Qatar@Doha [+27737758557] []Deira Dubai Kuwait
 
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All TimeCall 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
Call 7737669865 Vadodara Call Girls Service at your Door Step Available All Time
 
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in OmanMifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
Mifepristone Available in Muscat +918761049707^^ €€ Buy Abortion Pills in Oman
 
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
Lundin Gold - Q1 2024 Conference Call Presentation (Revised)
 
joint cost.pptx COST ACCOUNTING Sixteenth Edition ...
joint cost.pptx  COST ACCOUNTING  Sixteenth Edition                          ...joint cost.pptx  COST ACCOUNTING  Sixteenth Edition                          ...
joint cost.pptx COST ACCOUNTING Sixteenth Edition ...
 
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165Lucknow Housewife Escorts  by Sexy Bhabhi Service 8250092165
Lucknow Housewife Escorts by Sexy Bhabhi Service 8250092165
 
New 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck TemplateNew 2024 Cannabis Edibles Investor Pitch Deck Template
New 2024 Cannabis Edibles Investor Pitch Deck Template
 
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow ChallengesFalcon Invoice Discounting: Aviate Your Cash Flow Challenges
Falcon Invoice Discounting: Aviate Your Cash Flow Challenges
 
BeMetals Investor Presentation_May 3, 2024.pdf
BeMetals Investor Presentation_May 3, 2024.pdfBeMetals Investor Presentation_May 3, 2024.pdf
BeMetals Investor Presentation_May 3, 2024.pdf
 
Arti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdfArti Languages Pre Seed Teaser Deck 2024.pdf
Arti Languages Pre Seed Teaser Deck 2024.pdf
 
Buy Verified TransferWise Accounts From Seosmmearth
Buy Verified TransferWise Accounts From SeosmmearthBuy Verified TransferWise Accounts From Seosmmearth
Buy Verified TransferWise Accounts From Seosmmearth
 
Power point presentation on enterprise performance management
Power point presentation on enterprise performance managementPower point presentation on enterprise performance management
Power point presentation on enterprise performance management
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 
Mckinsey foundation level Handbook for Viewing
Mckinsey foundation level Handbook for ViewingMckinsey foundation level Handbook for Viewing
Mckinsey foundation level Handbook for Viewing
 

Record Automated Integration Tests through the UI

  • 1. Record automated integration tests through the UI Stanislas SOBIESKI • Client Solution Developer 2019 EXPERIENCE
  • 2. Why a custom tool to record integration tests? 1
  • 3. ● Avoid regression with new development ● Miss time to write your own unit tests Why testing your code ?
  • 4. ● Meaningful for end users ● End user manage the business part and you handle the techy one Why an integration test tool ?
  • 5. ● Tests don’t need to be changed after a smallest change in a view ● Creates server Odoo python code ● Use of our CI tool: ○ Runbot ○ Odoo.sh dev environment Yet another custom Odoo tool
  • 6. Our tool: an Odoo module ● Module Available on https://github.com/odoo/ps-runbot-testing, for version 10.0, 11.0, 12.0, 13.0 ● Add the repository to your addons path ● Add it on your custom runbot environment or Odoo.sh or locally ● Make sure runbot_testing_recording is installed ● Warning: ○ use it only on a testing environment ○ Does not cover use cases that uses controller (website)
  • 7. How to create test ? The UI side2
  • 8. 1. Record your flow 2. Flag it in the UI when a test should be needed, to check a value, or something else.
  • 9. The tool automatically catches errors and suggests to record them
  • 10. All the test is stored in the database
  • 11. How to create test ? the Dark side3
  • 12. Add the custom code to the module you want to test using the unit test framework of Odoo # -*- coding: utf-8 -*- from odoo.tests import common class DoMyTest(common.TransactionCase): def test_do_my_test(self): ''' here is a description of my test ''' uid = self.env.ref('base.user_admin').id record = self.env['sale.order'].with_context({ 'lang': 'en_US', 'search_default_my_quotation': 1, 'tz': 'Europe/Brussels', 'uid': uid
  • 13. - The module tries to create external id dynamically - When referencing other records in method like create or write, the module tries to find the external id or the smallest link to a record previously used - A manual pass is required to fix the unfound ids, and to create the actual tests to be made within the recorded business flow
  • 14. # TODO: Check or Find record_ids link (external id or otherwise) record_ids = [ 10, ] active_id = self.env.ref('sale_management.hereismytest_sale_advance_payment_inv_4').id active_ids = [ self.env.ref('sale_management.hereismytest_sale_advance_payment_inv_4').id, ] uid = self.env.ref('base.user_admin').id self.env['account.move].browse(record_ids).with_context({ 'active_id': active_id, 'active_ids': active_ids, 'active_model': 'sale.advance.payment.inv', 'type': 'out_invoice', 'uid': uid }).with_user(uid).action_invoice_open() '''TODO: DO A TEST HERE: Here check amount due on invoice is 160 dollars ''' ● Fix some references to something that can be reproduce based on a record created earlier ● Add tests to match with textual description
  • 15. ● Make sure the integrated test passes a fresh install with --test-enable on your CI tool such as the runbot ● Use those test to make sure you avoid regression in future development
  • 16. Demo4
  • 18. Conclusions ● Use the unit test to test server side integration tests ● Write a 1000 lines of code test in a few hours ● Involve end user in your testing process ● Ensure robustness for continuous development as well as migration of custom code