报错信息:AttributeError: 'TestCase' object has no attribute 'addTests'

#   测试用例执行集

# !/usr/bin/python
# encoding:utf-8
import unittest
from openAndAddTel import test_add
from HTMLTestRunner import HTMLTestRunner

if __name__ == '__main__':
    suite = unittest.TestCase()
    suite.addTests(unittest.TestLoader().loadTestsFromNames(['openAndAddTel.test_add']))# 文件名+类名
    with open('D:/HTMLReport.html', 'wb') as f:#  模式wb
        runner = HTMLTestRunner(stream=f,
                                title=' Test Report',
                                description='generated by HTMLTestRunner----黄亮.',
                                verbosity=2
                                )
        runner.run(suite)

控制台信息:
Traceback (most recent call last):
File "E:/pycharm/run/Appium/addSOS/test_suit.py", line 11, in
suite.addTests(unittest.TestLoader().loadTestsFromNames(['openAndAddTel.test_add']))# 文件名 + 类名
AttributeError: 'TestCase' object has no attribute 'addTests'


↙↙↙阅读原文可查看相关链接,并与作者交流