套件运用的问题
来源:7-5 接口自动化测试框架设计开发之模型搭建
慕工程8122668
2019-08-09
老师,完全按照你的代码来的,也import了sys和工程目录,提示我cannot import TastCase02是啥问题呀?找不到原因拜托解答下。
写回答
2回答
-
慕工程8122668
提问者
2019-08-10
#coding=utf-8 import requests import unittest url="http://www.imooc.com" data={ "username":"1111", "password":"22222" } class TestCase02(unittest.TestCase): def setUp(self): print("case开始执行") def tearDown(self): print("case结束执行") @classmethod def setUpClass(cls): print("case类开始执行") @classmethod def tearDownClass(cls): pass def test_07(self): print("执行case07") flag = "adfadfadfadfadsfaqeewr" s = "fads" self.assertIn(s,flag,msg="不包含") def test_01(self): print("执行case01") #res=requests.get(url=url,params=data).json() data1={ "user":"11111" } self.assertDictEqual(data1,data) def test_02(self): print("执行case02") data1={ "username":"1111", "password":"22222" } self.assertDictEqual(data1,data,msg="这两个字典不相等") def test_03(self): print("执行case03") flag = True self.assertFalse(flag,msg="不等于True") def test_04(self): print("执行case04") flag = False self.assertTrue(flag,msg="不等于False") def test_05(self): print("执行case05") flag = "111" flag1="2222" self.assertEqual(flag,flag1,msg="两个str不相等") def test_06(self): print("执行case06") flag = "adfadfadfadfadsfaqeewr" s = "fads" self.assertIn(s,flag,msg="不包含") if __name__ == "__main__": unittest.main() #suite=unittest.TestSuite() #suite.addTest(TestCase01("test_06")) #suite.addTest(TestCase01("test_04")) #suite.addTest(TestCase01("test_02")) #suite.addTest(TestCase01("test_05")) #suite.addTest(TestCase01("test_01")) #suite.addTest(TestCase01("test_07")) #tests = [TestCase01("test_07"),TestCase01("test_02"),TestCase01("test_03"),TestCase01("test_05"),TestCase01("test_01")] #suite.addTests(tests) #runner=unittest.TextTestRunner() #runner.run(suite) (这个是case02的代码,麻烦帮忙看看怎末会报这个错误啊?)
012019-08-16 -
Mushishi
2019-08-09
你是大哥,你能把所有case规范命名么,包命名,我看一眼懵逼,你把你case02的代码发一下
00
相似问题