Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Unit Tests in Odoo

Subscriure's

Get notified when there's activity on this post

This question has been flagged
unitsqaunittest
2 Respostes
9307 Vistes
Avatar
thushfdo

As a QA person, i need to learn about unit testing in Odoo. My idea is to find the areas we need to do unit testing and how to isolate certain codes to perform testing. Please suggest me a good reference or a doc where i can find these info. 

We have simple guideline as below
Step 01 : Learn and Identify what to test in Unit Testing (in the technology)
Step 02 : How to isolate the particular "Code"
Step 03 : Learn How to write a unit testing for Step 02

Stuck in step 01 and 02 for version 13, 14 and 15

0
Avatar
Descartar
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,
Test Cases In Odoo Python

  • Testing of our module function gives the desired output
  • Executing test for fixing the bugs
  • It is the self-testing by the developers itself to check whether the module meets the requirements of the client
  • Use for the Quality assurance of the module
  • Unit Testing - Testing a unit of the module ie a function in the module

Format For The Test Case In Odoo

  •  Need to create a directory named “tests”
  • Inside that create __init__.py file and python files.
  • The format name of the Python file should be “test_file_name.py”

 Example
     
Class TestModel(common.TransactionCase):
def test_action(self):
record = self.env[‘model.name’].create({‘field’:’value’})
record.action()
self.assertEqual(record.field,expected_field_value)

  • Unit Testing will use the model “TransactionCase”
  • In this model, the function will be run manually from top to bottom automatically.
  • And the function needs to start with “test_”
  • The records created by using the test will not be stored in our database

To Run Test
 ./odoo-bin -i module_name –test-enable -c odoo.conf
Python3.8 odoo-bin -c odoo.conf –test-tags path_of_custom_module
NOTE: The above are just the basic of the test case in python
For more please refer the below blogs and documentations

How to Write Test Case in the Odoo 16 ERP

Testing Odoo — Odoo 16.0 documentation

Chapter 12.1 Python Testing - Test Cases | Odoo 15

How to Write Test Case in the Odoo 15 ERP

Hope it helps

0
Avatar
Descartar
Avatar
Paresh Wagh
Best Answer

You may find this section of the documentation useful:  Advanced E: Python Unit Tests — Odoo 15.0 documentation

0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
How to inherit fields_view_get() method when using Form in unittest
unittest
Avatar
0
d’oct. 23
1887
How to make a field visible with optional="hide" when using Form in unittest
unittest
Avatar
0
d’oct. 23
3094
unit test cases for wizard in odoo 10
unittest
Avatar
0
de nov. 20
3606
Is it safe to use assertEqual()? When I try self.assertIs(self.board, wi.board_id) I get AssertionError. (but self.assertEqual() works) Solved
unittest
Avatar
Avatar
1
de maig 17
6341
Is it possible to modify/patch an existing unittest in a custom module?
unittest v14
Avatar
Avatar
2
d’oct. 23
3407
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now