# coding=utf-8
'''created:2018/3/29
author:star
project:test report'''
# import time,os
# from selenium import webdriver
# import unittest
# import HTMLTestRunner
# #方法一:discover
# list="C:\\Users\\Administrator\\PycharmProjects\\untitled\\testcase"
# discover=unittest.defaultTestLoader.discover(list,pattern="test_*.py",top_level_dir=None)
# if __name__ == '__main__':
# fp=open("d:\\testreport.html",'wb')
# runner=HTMLTestRunner.HTMLTestRunner(stream=fp,title=u"测试报告",description=u"用例执行情况")
# runner.run(discover)
# import time,os,unittest
# import HTMLTestRunner
# from selenium import webdriver
# list="C:\\Users\\Administrator\\PycharmProjects\\untitled\\testcase"
# discover=unittest.defaultTestLoader.discover(list,pattern="test_*.py",top_level_dir=None)
# if __name__ == '__main__':
# fp=open("d:\\report.html","wb")
# runner=HTMLTestRunner.HTMLTestRunner(stream=fp,title=u"测试报告",description=u"用例执行情况")
# runner.run(discover)
import time,os,unittest
import HTMLTestRunner
from selenium import webdriver
#方法二:suite
from baidu import test_baidu
from youdao import test_youdao
suite=unittest.TestSuite()
suite.addTest(test_baidu.baidu("test_baidu"))
suite.addTest(test_youdao.youdao("test_youdao")) if __name__ == '__main__':
fp=open("d:\\report.html","wb")
runner=HTMLTestRunner.HTMLTestRunner(stream=fp,title=u"测试报告",description=u"用例执行情况")
runner.run(suite)
05-22 15:18