标签:unittest class self 失败 setup www span Suite login
import requests
import unittest
class logintest1(unittest.TestCase):
def setUp(self):
self.test_url = "http://www.eebbk.com/"
def testlogin(self):
r = requests.get(self.test_url)
if r.status_code == int(200):
print(str(r.status_code)+" 第一条www.eebbk.com请求成功")
else:
print(str(r.status_code)+" 第一条www.eebbk.com请求失败")
self.assertEqual(r.status_code,200)
def suite():
logintestCase = unittest.TestSuite()
logintestCase.addTest(logintest1("testlogin"))
return logintestCase
if __name__ == "__main__":
unittest.main()
标签:unittest class self 失败 setup www span Suite login
原文地址:https://www.cnblogs.com/zzl112893/p/10171333.html