Ir al contenido
Odoo Menú
  • Iniciar sesión
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • PdV para tiendas
    • PdV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en vivo
    • eLearning
    Cadena de suministro
    • Inventario
    • Manufactura
    • PLM
    • Compras
    • Mantenimiento
    • Calidad
    Recursos humanos
    • Empleados
    • Reclutamiento
    • Vacaciones
    • Evaluaciones
    • Referencias
    • Flotilla
    Marketing
    • Redes sociales
    • Marketing por correo
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyectos
    • Registro de horas
    • Servicio externo
    • Soporte al cliente
    • Planeación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Artículos
    • WhatsApp
    Aplicaciones externas Studio de Odoo Plataforma de Odoo en la nube
  • Industrias
    Venta minorista
    • Librería
    • Tienda de ropa
    • Mueblería
    • Tienda de abarrotes
    • Ferretería
    • Juguetería
    Alimentos y hospitalidad
    • Bar y pub
    • Restaurante
    • Comida rápida
    • Casa de huéspedes
    • Distribuidora de bebidas
    • Hotel
    Bienes inmuebles
    • Agencia inmobiliaria
    • Estudio de arquitectura
    • Construcción
    • Gestión de bienes inmuebles
    • Jardinería
    • Asociación de propietarios
    Consultoría
    • Firma contable
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Manufactura
    • Textil
    • Metal
    • Muebles
    • Comida
    • Cervecería
    • Regalos corporativos
    Salud y ejercicio
    • Club deportivo
    • Óptica
    • Gimnasio
    • Especialistas en bienestar
    • Farmacia
    • Peluquería
    Trades
    • Personal de mantenimiento
    • Hardware y soporte de TI
    • Sistemas de energía solar
    • Zapateros y fabricantes de calzado
    • Servicios de limpieza
    • Servicios de calefacción, ventilación y aire acondicionado
    Otros
    • Organización sin fines de lucro
    • Agencia para la protección del medio ambiente
    • Alquiler de anuncios publicitarios
    • Fotografía
    • Alquiler de bicicletas
    • Distribuidor de software
    Descubre todas las industrias
  • Odoo Community
    Aprende
    • Tutoriales
    • Documentación
    • Certificaciones
    • Capacitación
    • Blog
    • Podcast
    Fortalece la educación
    • Programa educativo
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtén el software
    • Descargar
    • Compara ediciones
    • Versiones
    Colabora
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Conviértete en partner
    • Servicios para partners
    • Registra tu firma contable
    Obtén servicios
    • Encuentra un partner
    • Encuentra un contador
    • Contacta a un consultor
    • Servicios de implementación
    • Referencias de clientes
    • Soporte
    • Actualizaciones
    GitHub YouTube Twitter LinkedIn Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicita una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyectos
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

How to run unit test

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
testunit
6 Respuestas
42889 Vistas
Avatar
Veronika Kotovich

I have wrote unit test, that extends unittest2.TestCase (using unittest2 library). But now I cannot understand and find any information how to run. Please, help. OE version is 6.1

3
Avatar
Descartar
Avatar
duh386
Mejor respuesta

I found it! At first, add to __init__ of your module something like

import tests

Next, create package tests in your module. Example of it's __init__:

from . import test_hr

fast_suite = [test_hr, ]

test_hr - module in package with test classes (inherited from openerp.tests.common.TransactionCase)

Next: set in your OE config in [options] section:

test_enable = True

Finally, run tests with the following command:

openerp-server -c /path/to/config.conf -d dbname -u yourmodule --log-level=test

Have fun! Really to much undocumented condition for simple tests! I think OE developers never user it :).

2
Avatar
Descartar
Avatar
DIMITRY D'HONDT
Mejor respuesta

I struggled somewhat myself with running test cases for odoo modules.

I created an open source shell script to run tests inside a docker container, for those interested:

https://github.com/dimitrydhondt/odoutils

It can be used in interactive mode, or in a (CI/CD) script.




0
Avatar
Descartar
Avatar
Devendra Kavthekar
Mejor respuesta
Running tests
Tests are automatically run when installing or updating modules if --test-enable was enabled when starting the Odoo server. 

https://www.odoo.com/documentation/15.0/developer/reference/addons/testing.html

0
Avatar
Descartar
Avatar
Jérôme Thériault
Mejor respuesta

there is a plugin for pytest that can run odoo tests. Check out this SO answer: http://stackoverflow.com/a/41862286/2498426

In short: install the plugin, create a config file, run pytest.

0
Avatar
Descartar
Avatar
Aaron Henriquez
Mejor respuesta

I have a demo database, I run openerp with --test-enable --log-level=test, I have a tests folder with an __init__.py file that import my tests files.  I imported  openerp.tests.common import TransactionCase and created proper tests (the name of the method begins with "test_"). However openerp do not run the tests when installing or updating.

In odoo 8 and newers versions I do the same and tests are run without any problem. What am I missing here?

Thank you!

0
Avatar
Descartar
Avatar
Hannes Smit
Mejor respuesta

have a look at https://www.odoo.com/forum/Help-1/question/How-to-start-with-Testing-Framework-52569

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Registrarse
Publicaciones relacionadas Respuestas Vistas Actividad
Value of field is not being set during unit test
test unit
Avatar
0
dic 15
4556
How to CRUD in Odoo Website through Odoo Studio?
test
Avatar
Avatar
1
ene 23
4886
How can I test opening view?
test
Avatar
0
oct 22
2186
test
test
Avatar
0
ago 22
3
test
test
Avatar
0
dic 21
51
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento en Odoo.sh
  • Soporte
  • Actualizaciones del software
  • Desarrollos personalizados
  • Educación
  • Encuentra un contador
  • Encuentra un partner
  • Conviértete en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contáctanos
  • Empleos
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y estar totalmente integrado.

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