class Testcase02(unittest.TestCase): @classmethod def setUpClass(cls): Log().info('******************** 业务测试开始 ********************') @classmethod def tearDownClass(cls): Log().info('******************** 业务测试结束 ********************') excel = ExcelUtil() @ddt.data(*excel.next(epath, '业务')) @ddt.unpack def testcase1(self, name, beizhu): '''创建业务''' r = ye_wu().add(name, beizhu) self.assertEqual("业务保存成功", r, "测试失败") Log().info(r) def testcase2(self): '''对业务进行编辑''' r = ye_wu().alter("自动化") self.assertEqual(r, "业务编辑成功", "测试失败") def testcase3(self): '''查询业务''' r = ye_wu().select('test') self.assertIn(r, '1', "测试失败") def testcase4(self): '''对业务进行删除''' r = ye_wu().delete() self.assertEqual(r, "删除成功", "测试失败")
class Testcase03(unittest.TestCase): @classmethod def setUpClass(cls): Log().info('******************** 专网租户测试开始 ********************') @classmethod def tearDownClass(cls): Log().info('******************** 专网租户测试结束********************') excel = ExcelUtil() @ddt.data(*excel.next(epath, '专网租户')) @ddt.unpack def testcase001(self, name, xm, phone, beizhu): '''新建专网租户成功''' r = zu_hu().add(name, xm, phone, beizhu) self.assertEqual(r, "专网租户添加成功", "测试失败") Log().info(r) def testcaose002(self): '''对专网租户信息进行编辑''' r = zu_hu().alter("修改名称", "李", "13150600101", "11") self.assertIn(r, "专网租户编辑成功", "测试失败") def testcase003(self): '''专网详情页页面跳转''' r = zu_hu().swith() self.assertIn(r, "专网配置", "测试失败") def testcase004(self): '''租户专网配置[引用专网等级模版]''' r = zu_hu().peizhi_1() self.assertIn(r, "配置成功", "测试失败") Log().info("租户专网引用专网等级模版配置成功") def testcase005(self): '''租户专网配置[引用模版]''' r = zu_hu().peizhi_2() self.assertIn(r, "配置成功", "测试失败") Log().info("租户专网引用模版配置成功") def testcase006(self): '''专网租户登录''' r = zu_hu().zuhu_login("测试租户001", "18966453111") self.assertEqual(r, "态势感知", "测试失败") def testcase007(self): '''删除租户''' r = zu_hu().delete() self.assertIn(r, "删除成功", '测试失败') def testcase008(self): '''修改配置单状态''' r = zu_hu().state() self.assertEqual(r, '配置成功', '测试失败')
class Testcase08(unittest.TestCase): @classmethod def setUpClass(cls): Log().info("********************系统用户管理测试开始********************") @classmethod def tearDownClass(cls): Log().info("********************系统用户管理测试结束********************") excel = ExcelUtil() @ddt.data(*excel.next(epath, '系统用户')) @ddt.unpack def testcase01(self, name, beizhu): '''新建系统用户成功[运维](冒烟)''' r = system().add(name, beizhu) self.assertIn(r, "添加用户成功", "测试失败") Log().info(r) def testcase02(self): '''对用户列表数据进行编辑[修改用户名,角色和备注]''' r = system().alter("usermame", "1") self.assertIn(r, "编辑用户成功", "测试失败") def testcase03(self): '''验证用户创建后登陆成功[运维人员]''' r = system().login_yw("ubgoill3fbb") self.assertIn(r, "运维管理", "测试失败") def testcase04(self): '''验证用户创建后登陆成功[运营人员]''' r = system().login_yy("username") self.assertEqual(r, "运营概览", "测试失败") def testcase05(self): '''对用户列表数据进行查询[通过角色名]''' r = system().select_juese("运营人员") self.assertIn(r, "编辑", "测试失败") def testcase06(self): '''对用户列表数据进行查询[通过用户名称]''' r = system().select_name("username") self.assertIn(r, "编辑", "测试失败") def testcase07(self): '''删除用户''' r = system().delete() self.assertIn(r, '删除成功', "测试失败") def testcase08(self): '''运维运营登录退出''' r = quit().Logout_('username') self.assertEqual(r, '登录Login', '测试失败')
class Testcase04(unittest.TestCase): @classmethod def setUpClass(cls): Log().info("********************终端用户测试开始********************") @classmethod def tearDownClass(cls): Log().info("********************终端用户测试结束********************") #采用ddt进行数据的多个添加 excel = ExcelUtil() @ddt.data(*excel.next(epath, '终端用户')) @ddt.unpack def testcase01(self, phone, im, beizhu): '''新建单个终端用户''' r = z_d().add(phone, im, beizhu) self.assertIn(r, "添加用户成功", "测试失败") Log().info("添加用户成功") def testcase02(self): '''对终端用户信息进行编辑''' r = z_d().alter() self.assertIn(r, "编辑用户成功", "测试失败") def testcase03(self): '''查找终端用户存在''' r = z_d().select('13888888888') self.assertIn(r, "1", "测试失败") def testcase04(self): '''终端用户模版下载''' r = z_d().pladd() self.assertEqual(r, "下载模板", "测试失败") def testcase05(self): '''批量创建终端用户''' r = z_d().pldaoru(globalparam.impo_path) self.assertIn("导入成功!", r, "测试失败") Log().info(r) def testcase06(self): '''删除终端用户''' r = z_d().delete() self.assertIn(r, '删除成功', '测试失败') def testcase07(self): '''批量删除终端用户''' r = z_d().betch_delete() self.assertEqual(r, '批量删除成功', "测试失败")
class Testcase01(unittest.TestCase): @classmethod def setUpClass(cls): Log().info('******************** 场景测试开始 ********************') # Conn().__init__() @classmethod def tearDownClass(cls): # Conn().drop("user") Log().info('******************** 场景测试结束 ********************') excel = ExcelUtil() @ddt.data(*excel.next(epath, '场景')) @ddt.unpack def testcase01(self, name, beizhu): '''创建场景''' result = CJ().add(name, beizhu) self.assertIn(result, "添加场景成功", "测试失败") Log().info(result) def testcase02(self): '''对场景进行编辑''' result = CJ().alter("自动化") self.assertIn(result, "编辑场景成功", "测试失败") def testcase03(self): '''根据场景名称进行查询''' result = CJ().select_cj('test') self.assertIn(result, "编辑", "测试失败") def testcase04(self): '''根据行业进行查询''' result = CJ().select_hy() self.assertIn(result, "编辑", "测试失败") def testcase05(self): '''对场景进行删除''' result = CJ().delete() self.assertEqual(result, "删除成功", "测试失败")
class Testcase07(unittest.TestCase): @classmethod def setUpClass(cls): Log().info("********************专网等级测试开始********************") @classmethod def tearDownClass(cls): Log().info("********************专网等级测试结束********************") excel = ExcelUtil() @ddt.data(*excel.next(epath, '专网等级')) @ddt.unpack def testcase01(self, name, ip, port): '''手动输入创建专网等级模板''' r = z_w().add01(name, ip, port) self.assertIn(r, "配置成功", "测试失败") Log().info('手动输入创建专网等级模板配置成功') def testcase02(self): '''引用模版创建专网等级模板''' r = z_w().add02("引用模版01") self.assertIn(r, "配置成功", "测试失败") def testcase03(self): '''对专网等级模版进行查询[通过模版名]''' r = z_w().select_1("test") self.assertEqual(r, "详情", "测试失败") def testcase04(self): '''对专网等级模版进行查询[通过行业与等级]''' r = z_w().select_2() self.assertIn(r, "暂无数据", "测试失败") def testcase05(self): '''对专网等级模版进行删除''' r = z_w().delete() self.assertIn(r, "删除成功", "测试失败")
class Testcase05(unittest.TestCase): @classmethod def setUpClass(cls): Log().info("********************切片模版测试开始********************") @classmethod def tearDownClass(cls): Log().info("********************切片模版测试结束********************") excel = ExcelUtil() @ddt.data(*excel.next(epath, '切片模版')) @ddt.unpack def testcase01(self, name, ip, port): '''创建切片模版''' r = qie_pian().add(name, ip, port) self.assertEqual(r, "模板保存成功", "测试失败") def testcase02(self): '''对切片模板信息进行编辑''' r = qie_pian().alter() self.assertIn(r, "模板保存成功", "测试失败") def testcase03(self): '''切片模版根据模版名称进行查询''' r = qie_pian().select1("切片模版一") self.assertIn(r, "编辑", "测试失败") def testcase04(self): '''根据场景/业务条件进行查询''' r = qie_pian().select2() self.assertIn(r, "编辑", "测试失败") def testcase05(self): '''删除切片''' r = qie_pian().delete() self.assertIn(r, '删除成功', '测试失败')