class TestAddressBook: data = BasePage.yaml_load('../data/member_manage.data.yaml') step = BasePage.yaml_load('../data/member_manage.step.yaml') def setup_class(self): self.dx = Index() # self.dx.driver.implicitly_wait(3) def teardown_class(self): self.dx.driver.close() @pytest.mark.parametrize('name, acct_id, phone, mail, expect', data['test_add_member']) def test_add_member(self, name, acct_id, phone, mail, expect): res = self.dx.address_book().member_manage().add_member( name, acct_id, phone, mail) assert res == expect @pytest.mark.parametrize('name, expect', data['test_delete_member']) def test_delete_member(self, name, expect): res = self.dx.address_book().member_manage().delete_member('杜宁') assert res == expect @pytest.mark.parametrize('name, acct_id, phone, mail, expect', data['test_add_member']) def test_add_member_step(self, name, acct_id, phone, mail, expect): BasePage.params = { 'name': name, 'acct_id': acct_id, 'phone': phone, 'mail': mail } self.dx.address_book().member_manage().steps(self.step['add_member'])
class TestDepartmentManage: data = BasePage.yaml_load('../data/department_manage.data.yaml') def setup_class(self): self.dx = Index() def teardown_class(self): self.dx.driver.close() @pytest.mark.parametrize('name, p_name, expect', data['test_add_dept']) def test_add_dept(self, name, p_name, expect): res = self.dx.address_book().department_manager().add_dept( name, p_name) assert res == expect @pytest.mark.skip(reason="不执行该用例") @pytest.mark.parametrize('name, expect', data['test_delete_dept']) def test_delete_dept(self, name, expect): res = self.dx.address_book().department_manager().delete_dept(name) assert res == expect