“添加单元测试”的版本间的差异

来自Odoo大V社-odoo中文开发手册
跳转至: 导航搜索
(创建页面,内容为“ 上一节:单元测试 下一节:写测试用例”)
 
 
(未显示同一用户的8个中间版本)
第1行: 第1行:
 +
 +
 +
测试todo_wizard插件存在于tests/test_wizard.py文件中。
 +
我们需要添加tests/__init__.py 文件。内容如下:
 +
    # -*- coding: utf-8 -*-
 +
    from . import test_wizard
 +
 +
创建文件:tests/test_wizard.py:
 +
    # -*- coding: utf-8 -*-
 +
    from odoo.tests.common import TransactionCase
 +
    class TestWizard(TransactionCase):
 +
    def setup(self, *args, **kwargs):
 +
        super(TestWizard, self). setup(*args, **kwargs)
 +
    #Add test setup code here...
 +
    def test_populate_tasks(self):
 +
        "populate tasks buttons should add two tasks"
 +
    #Add test code
  
 
上一节:[[单元测试]]  下一节:[[写测试用例]]
 
上一节:[[单元测试]]  下一节:[[写测试用例]]

2018年3月30日 (五) 16:45的最新版本


测试todo_wizard插件存在于tests/test_wizard.py文件中。 我们需要添加tests/__init__.py 文件。内容如下:

   # -*- coding: utf-8 -*-
   from . import test_wizard 

创建文件:tests/test_wizard.py:

   # -*- coding: utf-8 -*-
   from odoo.tests.common import TransactionCase
   class TestWizard(TransactionCase):
   def setup(self, *args, **kwargs):
       super(TestWizard, self). setup(*args, **kwargs)
   #Add test setup code here...
   def test_populate_tasks(self):
       "populate tasks buttons should add two tasks"
   #Add test code

上一节:单元测试 下一节:写测试用例