# coding=utf-8
import unittest
import HTMLTestRunner

class CaseTest(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        print("this is class method\n")

    def setUp(self):
        print("this is setup")

    def test01(self):
        # flag = False
        print("this is test01")
        self.assertEqual('1', '2', '数据错误')
        # self.assertNotEqual(1, 2)
        # self.assertTrue(flag)

    # @unittest.skip("CaseTest")  # 用这个方法跳过下面的测试案例

    def test02(self):
        print("this is test02")

    def tearDown(self):
        print("this is teardown")

    @classmethod
    def tearDownClass(cls):
        print("this is tearDownClass")

if __name__ == '__main__':

    # unittest.main()
    suite = unittest.TestSuite()
    suite.addTest(CaseTest("test02"))
    suite.addTest(CaseTest("test01"))
    # unittest.TextTestRunner().run(suite)
    html_file = r"D:/AppTest/report/report.html"
    fp = open(html_file, "wb")
    HTMLTestRunner.HTMLTestRunner(stream=fp).run(suite)