What is Yaml?
-
To test the budget creation wizard's working I create department, program, and activity and perform budget creation using these.
-
I create a department named Test Department 1
-
I create a program named Test Program 1 under Test Department 1
-
I create an activity named Test Activity 1 under Test Program 1
-
I select Test Department 1, Test Program 1, Test Activity 1 and 1991-1995 budget period
-
I create a budget using the previously selected values.
-
I test that the state of the budget is Draft.
-
To test the budget creation wizard's working I create department, program, and activity and perform budget creation using these.
-
I create a department named Test Department 1
-
!record {model: zb.department, id: department_id_0}:
name: "Test Department 1"
-
I create a program named Test Program 1 under Test Department 1
-
!record {model: zb.program, id: program_id_0_0}:
name: "Test Program 1"
department_id: department_id_0
-
I create an activity named Test Activity 1 under Test Program 1
-
!record {model: zb.activity, id: activity_id_0_0_0}:
name: "Test Activity 1"
program_id: program_id_0_0
-
I select Test Department 1, Test Program 1, Test Activity 1 and 1991-1995 budget period
-
!record {model: zb.budget.target, id: budget_wizard_id}:
department_id: department_id_0
program_id: program_id_0_0
activity_id: activity_id_0_0_0
budget_period_id: budget_period_id_0
-
I create a budget using the previously selected values.
-
!python {model: zb.budget.target}: |
result = self.create_budget(cr, uid, [ref('budget_wizard_id')], {})
assert result, 'The budget was not created.'
-
I test that the state of the budget is Draft.
-
!python {model: zb.budget}: |
department_id = ref("department_id_0")
program_id = ref("program_id_0_0")
activity_id = ref("activity_id_0_0_0")
budget_period_id = ref("budget_period_id_0")
ids = self.search(cr, uid, [('department_id', '=', department_id), ('program_id', '=', program_id), ('activity_id', '=', activity_id), ('budget_period_id', '=', budget_period_id)])
assert len(ids) == 1, 'There should only be one budget for a combination of a particular department, program, activity and budget period.'
budget_obj = self.browse(cr, uid, ids, {})[0]
assert budget_obj.budget_state == 'draft', 'The newly created budget must be in Draft.'
'test' : ['test/budget_creation_wizard.yml']
./openerp-server.py --log-level=test
TEST:tests.budget_performance:To test the budget creation wizard's working I create department, program, and activity and perform budget creation using these.
TEST:tests.budget_performance:I create a department named Test Department 1.
TEST:tests.budget_performance:I create a program named Test Program 1 under Test Department 1.
TEST:tests.budget_performance:I create an activity named Test Activity 1 under Test Program 1.
TEST:tests.budget_performance:I select Test Department 1, Test Program 1, Test Activity 1 and 1991-1995 budget period.
TEST:tests.budget_performance:I create a budget using the previously selected values.
TEST:tests.budget_performance:I test that the state of the budget is Draft.
Timothy: Yes, please help on how to check the results of the test. I tried running a test that fails but it doesnt show up on the log: http://stackoverflow.com/questions/14458962/how-do-you-run-openerp-yaml-unit-tests I tried adding a test directory parameter but no luck :(".
Leave a Reply