From 1132f8cb5870ca6339e214804ac32949849e92d9 Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Tue, 15 Nov 2011 16:00:28 +0530 Subject: [PATCH 1/5] [IMP] hr: improve test case of process of Job position to open job, to start requirement and close job position bzr revid: jap@tinyerp.com-20111115103028-5zmfzal87kpdicaf --- addons/hr/__openerp__.py | 5 +- addons/hr/test/hr_employee_demo.yml | 55 +++++++ .../test/process/open2recruit2close_job.yml | 39 +++++ addons/hr/test/test_hr.yml | 140 ------------------ 4 files changed, 98 insertions(+), 141 deletions(-) create mode 100644 addons/hr/test/hr_employee_demo.yml create mode 100644 addons/hr/test/process/open2recruit2close_job.yml delete mode 100644 addons/hr/test/test_hr.yml diff --git a/addons/hr/__openerp__.py b/addons/hr/__openerp__.py index 900c689dfbf..b78e9c03916 100644 --- a/addons/hr/__openerp__.py +++ b/addons/hr/__openerp__.py @@ -54,7 +54,10 @@ You can manage: 'hr_demo.xml', 'hr_department_demo.xml', ], - 'test': ['test/test_hr.yml'], + 'test': [ + 'test/hr_employee_demo.yml', + 'test/process/open2recruit2close_job.yml', + ], 'installable': True, 'active': False, 'certificate': '0086710558965', diff --git a/addons/hr/test/hr_employee_demo.yml b/addons/hr/test/hr_employee_demo.yml new file mode 100644 index 00000000000..31cf58c2788 --- /dev/null +++ b/addons/hr/test/hr_employee_demo.yml @@ -0,0 +1,55 @@ +- + !record {model: hr.department, id: hr_department_rd0}: + manager_id: base.user_root + name: 'R & D' +- + !record {model: hr.job, id: hr_job_jea0}: + department_id: 'hr_department_rd0' + description: 'Position of Junior Application Engineer' + expected_employees: 5.0 + name: 'JAE' + no_of_employee: 0.0 + no_of_recruitment: 5.0 + state: open +- + !record {model: hr.job, id: hr_job_jea0}: + employee_ids: + - address_home_id: base.res_partner_address_1 + name: Manuel Lehba + department_id: 'hr_department_rd0' + gender: male + parent_id: hr.employee1 +- + !record {model: hr.employee, id: hr_employee001, view: False}: + address_id: base.main_address + company_id: base.main_company + department_id: hr_department_rd0 + name: smith + parent_id: hr.employee1 + user_id: base.user_demo +- + !record {model: hr.employee, id: hr_employee_edwin0}: + address_home_id: base.res_partner_address_3000 + address_id: base.res_partner_address_rogerpecker0 + department_id: hr.dep_administration + job_id: hr.job_hr_manager + name: Edwin + parent_id: hr.employee2 + resource_type: user + time_efficiency: 1.0 + user_id: base.user_demo +- + !record {model: hr.employee.category, id: hr_employee_category_fresher0}: + name: Fresher +- + !record {model: hr.employee.category, id: hr_employee_category_juniorlevel0}: + name: Junior Level + parent_id: hr_employee_category_fresher0 +- + + + + + + + diff --git a/addons/hr/test/process/open2recruit2close_job.yml b/addons/hr/test/process/open2recruit2close_job.yml new file mode 100644 index 00000000000..aedd2a3d2a1 --- /dev/null +++ b/addons/hr/test/process/open2recruit2close_job.yml @@ -0,0 +1,39 @@ +- + In Order to test process of Job Position, +- + I open Job Postion of "Jr. Application Engineer" Profile. +- + !python {model: hr.job}: | + self.job_open(cr, uid, [ref('hr_job_jea0')]) +- + I check state of Job Position after opened it. +- + !assert {model: hr.job, id: hr_job_jea0}: + - state == 'open' +- + Now, Recruitement is started so I start recruitement of Job Postion of "Jr. Application Engineer" Profile. +- + !python {model: hr.job}: | + self.job_recruitement(cr, uid, [ref('hr_job_jea0')]) +- + I check state and number of Expected in Recruitment in Job Position of "Jr. Application Engineer" Profile. +- + !assert {model: hr.job, id: hr_job_jea0}: + - state == 'recruit' + - no_of_recruitment == 1.0 +- + I hired new employee for the job position so I set Job Position of "Jr. Application Engineer" Profile to new employee. +- + !python {model: hr.employee}: | + self.write(cr, uid, [ref('hr_employee001')], {'job_id':ref('hr_job_jea0')}) +- + Now I don't want to recruit new employee on this position. so I mark it as Old. +- + !python {model: hr.job}: | + self.job_old(cr, uid, [ref('hr_job_jea0')]) +- + I check state of Job position and number of Expected in Recruitment after closed Job position. +- + !assert {model: hr.job, id: hr_job_jea0}: + - state == 'old' + - no_of_recruitment == 0 diff --git a/addons/hr/test/test_hr.yml b/addons/hr/test/test_hr.yml deleted file mode 100644 index 7b4ba82b243..00000000000 --- a/addons/hr/test/test_hr.yml +++ /dev/null @@ -1,140 +0,0 @@ -- - In order to test hr module in OpenERP, I will create new Employee, Department and Job Position. -- - I create "R&D Department" in Department form. -- - !record {model: hr.department, id: hr_department_rd0}: - manager_id: base.user_root - name: 'R & D' -- - Now, I create a new employee “Mark Johnson”, and select department as “R&D Department”. -- - !record {model: hr.employee, id: hr_employee_mark}: - address_home_id: base.res_partner_address_1 - company_id: base.main_company - gender: male - marital: 'single' - name: Mark Johnson -- - I change the company of the employee. -- - !python {model: hr.employee}: | - res = self.onchange_company(cr, uid, [ref('hr_employee_mark')], ref('base.main_company'), None) - values = dict([('company_id', ref('base.main_company'))] + res['value'].items()) - self.write(cr, uid, [ref('hr_employee_mark')], values, None) -- - I assign department for employee “Mark Johnson”. -- - !python {model: hr.employee}: | - res = self.onchange_department_id(cr, uid, [ref('hr_employee_mark')], ref('hr_department_rd0'), None) - assert res['value']['parent_id'] - values = dict([('department_id', ref('hr_department_rd0'))] + res['value'].items()) - self.write(cr, uid, [ref('hr_employee_mark')], values, None) -- - Now I create a user for employee “Mark Johnson”. -- - !record {model: res.users, id: hr_users_markjohnson0}: - context_lang: en_US - groups_id: - - base.group_user - login: markjohnson - name: Mark Johnson - password: markjohnson -- - I assign user to employee “Mark Johnson”. -- - !python {model: hr.employee}: | - res = self.onchange_user(cr, uid, [ref('hr_employee_mark')], ref('hr_users_markjohnson0'), None) - values = dict([('user_id', ref('hr_users_markjohnson0'))] + res['value'].items()) - self.write(cr, uid, [ref('hr_employee_mark')], values, None) -- - In order to check the wizard “Employee Hierarchy” , I will create new employee “Phil Graves” and select “Mark Johnson” as - Manager. -- - !record {model: hr.employee, id: hr_employee_phil}: - address_home_id: base.res_partner_address_3000 - company_id: base.main_company - gender: male - name: Phil Graves - user_id: base.user_demo - parent_id: 'hr_employee_mark' -- - I fill the Working address for Employee. -- - !python {model: hr.employee}: | - res = self.onchange_address_id(cr, uid, ref('hr_employee_phil'), ref('base.res_partner_address_3000'), None) - assert res['value'] - values = dict([('address_id', ref('base.res_partner_address_3000'))] + res['value'].items()) - self.write(cr, uid, [ref('hr_employee_phil')], values, None) -- - I will open up form view of “Mark Johnson” and test the wizard “Employee Hierarchy” so it display the employee - hierarchy starting from “Mark Johnson”. - -- - I will create new Job Position. I will check successful creation of new Job Position by adding the information. -- - !record {model: hr.job, id: hr_job_jea0}: - department_id: 'hr_department_rd0' - description: 'Position of Junior Application Engineer' - expected_employees: 5 - name: 'JAE' -- - I check that Employee form is in "Open" state. -- - !assert {model: hr.job, id: hr_job_jea0}: - - state == 'open' -- - I create Employee for job position. -- - !record {model: hr.job, id: hr_job_jea0}: - employee_ids: - - address_home_id: base.res_partner_address_1 - name: Manuel Lehba - department_id: 'hr_department_rd0' - gender: male - parent_id: 'hr_employee_mark' -- - I check that "Number of Employees" field have some value. -- - !assert {model: hr.job, id: hr_job_jea0}: - - no_of_employee != False -- - As more requirements on the said job position are come, I increase the number of expected employees. -- - !python {model: hr.job}: | - res = self.on_change_expected_employee(cr, uid, [ref('hr_job_jea0')], 6, 3, None) - assert res['value']['expected_employees'] - values = dict([('expected_employees', ref('hr_job_jea0'))] + res['value'].items()) - self.write(cr, uid, [ref('hr_job_jea0')], values, None) -- - I open the job position for recruitment. -- - !python {model: hr.job}: | - self.job_recruitement(cr, uid, [ref('hr_job_jea0')]) -- - I assign the job position to employee and mark the position. -- - !python {model: hr.job}: | - self.job_open(cr, uid, [ref('hr_job_jea0')]) -- - Now the process is over so I don't want to use this position. I mark it as Old. -- - !python {model: hr.job}: | - self.job_old(cr, uid, [ref('hr_job_jea0')]) -- - I create a parent category for the new recruited employees who are Freshers. -- - !record {model: hr.employee.category, id: hr_employee_category_fresher0}: - name: Fresher -- - I create another category for Junior Level freshers. -- - !record {model: hr.employee.category, id: hr_employee_category_juniorlevel0}: - name: Junior Level - parent_id: hr_employee_category_fresher0 -- - I open the tree view of Categories and see the categories in a hierarchical manner. -- - !python {model: hr.employee.category}: | - res = self.name_get(cr, uid, [ref('hr_employee_category_juniorlevel0')], None) - assert res From 376d264fcbae95790c0b6c149bbdbeaa6514f352 Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Thu, 17 Nov 2011 14:01:43 +0530 Subject: [PATCH 2/5] [IMP] hr: improve test case of job process bzr revid: jap@tinyerp.com-20111117083143-rjsfxp8ayx78nryr --- addons/hr/__openerp__.py | 2 +- addons/hr/test/hr_employee_demo.yml | 46 +++---------------- .../{process => }/open2recruit2close_job.yml | 16 +++---- 3 files changed, 15 insertions(+), 49 deletions(-) rename addons/hr/test/{process => }/open2recruit2close_job.yml (70%) diff --git a/addons/hr/__openerp__.py b/addons/hr/__openerp__.py index b78e9c03916..c1a75cbb7f5 100644 --- a/addons/hr/__openerp__.py +++ b/addons/hr/__openerp__.py @@ -56,7 +56,7 @@ You can manage: ], 'test': [ 'test/hr_employee_demo.yml', - 'test/process/open2recruit2close_job.yml', + 'test/open2recruit2close_job.yml', ], 'installable': True, 'active': False, diff --git a/addons/hr/test/hr_employee_demo.yml b/addons/hr/test/hr_employee_demo.yml index 31cf58c2788..846747e9a25 100644 --- a/addons/hr/test/hr_employee_demo.yml +++ b/addons/hr/test/hr_employee_demo.yml @@ -1,10 +1,10 @@ - - !record {model: hr.department, id: hr_department_rd0}: + !record {model: hr.department, id: dep_technical, view: False}: manager_id: base.user_root name: 'R & D' - - !record {model: hr.job, id: hr_job_jea0}: - department_id: 'hr_department_rd0' + !record {model: hr.job, id: job_jr_appli, view: False}: + department_id: 'dep_technical' description: 'Position of Junior Application Engineer' expected_employees: 5.0 name: 'JAE' @@ -12,44 +12,10 @@ no_of_recruitment: 5.0 state: open - - !record {model: hr.job, id: hr_job_jea0}: - employee_ids: - - address_home_id: base.res_partner_address_1 - name: Manuel Lehba - department_id: 'hr_department_rd0' - gender: male - parent_id: hr.employee1 -- - !record {model: hr.employee, id: hr_employee001, view: False}: + !record {model: hr.employee, id: employee1, view: False}: address_id: base.main_address company_id: base.main_company - department_id: hr_department_rd0 + department_id: dep_technical name: smith parent_id: hr.employee1 - user_id: base.user_demo -- - !record {model: hr.employee, id: hr_employee_edwin0}: - address_home_id: base.res_partner_address_3000 - address_id: base.res_partner_address_rogerpecker0 - department_id: hr.dep_administration - job_id: hr.job_hr_manager - name: Edwin - parent_id: hr.employee2 - resource_type: user - time_efficiency: 1.0 - user_id: base.user_demo -- - !record {model: hr.employee.category, id: hr_employee_category_fresher0}: - name: Fresher -- - !record {model: hr.employee.category, id: hr_employee_category_juniorlevel0}: - name: Junior Level - parent_id: hr_employee_category_fresher0 -- - - - - - - - + user_id: base.user_demo \ No newline at end of file diff --git a/addons/hr/test/process/open2recruit2close_job.yml b/addons/hr/test/open2recruit2close_job.yml similarity index 70% rename from addons/hr/test/process/open2recruit2close_job.yml rename to addons/hr/test/open2recruit2close_job.yml index aedd2a3d2a1..597db098a29 100644 --- a/addons/hr/test/process/open2recruit2close_job.yml +++ b/addons/hr/test/open2recruit2close_job.yml @@ -4,36 +4,36 @@ I open Job Postion of "Jr. Application Engineer" Profile. - !python {model: hr.job}: | - self.job_open(cr, uid, [ref('hr_job_jea0')]) + self.job_open(cr, uid, [ref('job_jr_appli')]) - I check state of Job Position after opened it. - - !assert {model: hr.job, id: hr_job_jea0}: + !assert {model: hr.job, id: job_jr_appli}: - state == 'open' - Now, Recruitement is started so I start recruitement of Job Postion of "Jr. Application Engineer" Profile. - !python {model: hr.job}: | - self.job_recruitement(cr, uid, [ref('hr_job_jea0')]) + self.job_recruitement(cr, uid, [ref('job_jr_appli')]) - I check state and number of Expected in Recruitment in Job Position of "Jr. Application Engineer" Profile. - - !assert {model: hr.job, id: hr_job_jea0}: + !assert {model: hr.job, id: job_jr_appli}: - state == 'recruit' - no_of_recruitment == 1.0 - I hired new employee for the job position so I set Job Position of "Jr. Application Engineer" Profile to new employee. - !python {model: hr.employee}: | - self.write(cr, uid, [ref('hr_employee001')], {'job_id':ref('hr_job_jea0')}) + self.write(cr, uid, [ref('employee1')], {'job_id':ref('job_jr_appli')}) - Now I don't want to recruit new employee on this position. so I mark it as Old. - !python {model: hr.job}: | - self.job_old(cr, uid, [ref('hr_job_jea0')]) + self.job_old(cr, uid, [ref('job_jr_appli')]) - I check state of Job position and number of Expected in Recruitment after closed Job position. - - !assert {model: hr.job, id: hr_job_jea0}: + !assert {model: hr.job, id: job_jr_appli}: - state == 'old' - - no_of_recruitment == 0 + - no_of_recruitment == 0 \ No newline at end of file From a4d069349e7f319703417883b6811d90d8a584fd Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Fri, 25 Nov 2011 10:22:11 +0530 Subject: [PATCH 3/5] [IMP] improve test case process of Job bzr revid: jap@tinyerp.com-20111125045211-ixj5bw3ucgo5246d --- addons/hr/test/open2recruit2close_job.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/addons/hr/test/open2recruit2close_job.yml b/addons/hr/test/open2recruit2close_job.yml index a33aaa7e60f..f199160d9fc 100644 --- a/addons/hr/test/open2recruit2close_job.yml +++ b/addons/hr/test/open2recruit2close_job.yml @@ -1,33 +1,34 @@ - In Order to test process of Job Position, - - I open Job Postion of "Jr. Application Engineer" Profile. + I open Job Postion for "Jr. Application Engineer" - !python {model: hr.job}: | self.job_open(cr, uid, [ref('job_jr_appli')]) - - I check state of Job Position after opened it. + I check state of Job Position after opening it. - !assert {model: hr.job, id: job_jr_appli}: - - state == 'open + - state == 'open' + - no_of_recruitment == 0 - Now, Recruitement is started so I start recruitement of Job Postion of "Jr. Application Engineer" Profile. - !python {model: hr.job}: | self.job_recruitement(cr, uid, [ref('job_jr_appli')]) - - I check state and number of Expected in Recruitment in Job Position of "Jr. Application Engineer" Profile. + I check 'state' and number of 'Expected in Recruitment' after initiating the recruitment - !assert {model: hr.job, id: job_jr_appli}: - state == 'recruit' - no_of_recruitment == 1.0 -- - I hired new employee for the job position so I set Job Position of "Jr. Application Engineer" Profile to new employee. +- + I assign the job position to a newly hired employee - !python {model: hr.employee}: | self.write(cr, uid, [ref('employee1')], {'job_id':ref('job_jr_appli')}) - - Now I don't want to recruit new employee on this position. so I mark it as Old. + Now I don't want to recruit new employee for this position. so I mark it as Old. - !python {model: hr.job}: | self.job_old(cr, uid, [ref('job_jr_appli')]) From 2275d445f95fcd7c11fbe59e94bc2f5c1feaf2f8 Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Mon, 28 Nov 2011 10:43:22 +0530 Subject: [PATCH 4/5] [IMP] improve test case process of Job position bzr revid: jap@tinyerp.com-20111128051322-7bweo3pdz1u0g1fi --- addons/hr/test/open2recruit2close_job.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/hr/test/open2recruit2close_job.yml b/addons/hr/test/open2recruit2close_job.yml index f199160d9fc..7647f525146 100644 --- a/addons/hr/test/open2recruit2close_job.yml +++ b/addons/hr/test/open2recruit2close_job.yml @@ -1,14 +1,14 @@ - - In Order to test process of Job Position, + I test the process of Job position in hr module of OpenERP, - - I open Job Postion for "Jr. Application Engineer" + I open Job Postion for "Jr. Application Engineer". - !python {model: hr.job}: | self.job_open(cr, uid, [ref('job_jr_appli')]) - I check state of Job Position after opening it. - - !assert {model: hr.job, id: job_jr_appli}: + !assert {model: hr.job, id: job_jr_appli, string: Job position is in 'open' state and no_of_recruitment = 0}: - state == 'open' - no_of_recruitment == 0 - @@ -19,7 +19,7 @@ - I check 'state' and number of 'Expected in Recruitment' after initiating the recruitment - - !assert {model: hr.job, id: job_jr_appli}: + !assert {model: hr.job, id: job_jr_appli, string: Job position is in 'recruit' state and no_of_recruitment = 1.0}: - state == 'recruit' - no_of_recruitment == 1.0 - @@ -33,8 +33,8 @@ !python {model: hr.job}: | self.job_old(cr, uid, [ref('job_jr_appli')]) - - I check state of Job position and number of Expected in Recruitment after closed Job position. + I check 'state' and number of 'Expected in Recruitment' after closing the Job position. - - !assert {model: hr.job, id: job_jr_appli}: + !assert {model: hr.job, id: job_jr_appli, string: Job position is in 'old' state and no_of_recruitment = 0}: - state == 'old' - no_of_recruitment == 0 \ No newline at end of file From a0f45aedd5c1cd529325bb525f04434d94d12e78 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Mon, 28 Nov 2011 11:16:05 +0530 Subject: [PATCH 5/5] [REVIEW] HR: testing cases of Human Resource Management bzr revid: hmo@tinyerp.com-20111128054605-8wb7xpf3fn9ntiea --- addons/hr/__openerp__.py | 2 +- addons/hr/test/hr_demo.yml | 10 ++++++++++ addons/hr/test/hr_employee_demo.yml | 21 --------------------- addons/hr/test/open2recruit2close_job.yml | 6 ++---- 4 files changed, 13 insertions(+), 26 deletions(-) create mode 100644 addons/hr/test/hr_demo.yml delete mode 100644 addons/hr/test/hr_employee_demo.yml diff --git a/addons/hr/__openerp__.py b/addons/hr/__openerp__.py index c1a75cbb7f5..4c99d0d5231 100644 --- a/addons/hr/__openerp__.py +++ b/addons/hr/__openerp__.py @@ -55,8 +55,8 @@ You can manage: 'hr_department_demo.xml', ], 'test': [ - 'test/hr_employee_demo.yml', 'test/open2recruit2close_job.yml', + 'test/hr_demo.yml', ], 'installable': True, 'active': False, diff --git a/addons/hr/test/hr_demo.yml b/addons/hr/test/hr_demo.yml new file mode 100644 index 00000000000..6dee06d5eb3 --- /dev/null +++ b/addons/hr/test/hr_demo.yml @@ -0,0 +1,10 @@ +- + !record {model: hr.job, id: job_jr_appli, view: False}: + no_of_employee: 0.0 + no_of_recruitment: 5.0 +- + !record {model: hr.employee, id: employee1, view: False}: + address_id: base.main_address + company_id: base.main_company + department_id: dep_technical + user_id: base.user_demo diff --git a/addons/hr/test/hr_employee_demo.yml b/addons/hr/test/hr_employee_demo.yml deleted file mode 100644 index 846747e9a25..00000000000 --- a/addons/hr/test/hr_employee_demo.yml +++ /dev/null @@ -1,21 +0,0 @@ -- - !record {model: hr.department, id: dep_technical, view: False}: - manager_id: base.user_root - name: 'R & D' -- - !record {model: hr.job, id: job_jr_appli, view: False}: - department_id: 'dep_technical' - description: 'Position of Junior Application Engineer' - expected_employees: 5.0 - name: 'JAE' - no_of_employee: 0.0 - no_of_recruitment: 5.0 - state: open -- - !record {model: hr.employee, id: employee1, view: False}: - address_id: base.main_address - company_id: base.main_company - department_id: dep_technical - name: smith - parent_id: hr.employee1 - user_id: base.user_demo \ No newline at end of file diff --git a/addons/hr/test/open2recruit2close_job.yml b/addons/hr/test/open2recruit2close_job.yml index 7647f525146..0e618f87a3d 100644 --- a/addons/hr/test/open2recruit2close_job.yml +++ b/addons/hr/test/open2recruit2close_job.yml @@ -1,8 +1,6 @@ - - I test the process of Job position in hr module of OpenERP, + In order to test the process of Human Resource Management, I open Job Postion for "Jr. Application Engineer". - - I open Job Postion for "Jr. Application Engineer". -- !python {model: hr.job}: | self.job_open(cr, uid, [ref('job_jr_appli')]) - @@ -37,4 +35,4 @@ - !assert {model: hr.job, id: job_jr_appli, string: Job position is in 'old' state and no_of_recruitment = 0}: - state == 'old' - - no_of_recruitment == 0 \ No newline at end of file + - no_of_recruitment == 0