Beispiel #1
0
"""
============================
Author:luli
Time:2020/3/10
Company:Happy
============================
"""
import os
import unittest
from BeautifulReport import BeautifulReport
from common.handlepath import CASEDIR, REPORTDIR
from common.handle_email import send_email

# 创建测试套件
suite = unittest.TestSuite()

# 将测试用例加载到套件
loader = unittest.TestLoader()
suite.addTest(loader.discover(CASEDIR))

br = BeautifulReport(suite)
br.report("前程贷项目用例", filename="report.html", report_dir=REPORTDIR)

report_file = os.path.join(REPORTDIR, 'report.html')
send_email(report_file, '接口测试报告')
Beispiel #2
0
        now = time.strftime('%Y-%m-%d-%H-%M-%S')
        filename = REPORTDIR + "\\" + str(now) + '_api_report.html'
        discover = unittest.defaultTestLoader.discover(CASEDIR1,"test_*.py")
        f = open(filename,'wb')
        runner = HTMLTestRunner(stream=f,
                                title='resful接口自动化测试报告',
                                description='用例执行情况如下:',
                                tester='叶子源')
        runner.run(discover)

        f.close()
        # return {'报告路径': REPORTDIR, '报告名称': now + '_api_report.html'}
        return {'测试结果': '执行完毕了!!!', '报告名称': now + '_api_report.html'}
    except Exception as e:
        log.error("执行失败,错误原因为:{}".format(e))

if __name__ == '__main__':
    auto_run()
    send_email(filename,'resful接口自动化测试报告')











Beispiel #3
0
# @Author  : felix
# @Email   : [email protected]
# @File    : run_test.py
# @Software: PyCharm

import unittest
import os
from common.handlepath import CASEDIR, REPORTDIR
from library.HTMLTestRunnerNew import HTMLTestRunner
from common.handle_email import send_email

# 第一步:创建套件
suite = unittest.TestSuite()

# 第二步:加载用例到套件
loader = unittest.TestLoader()
suite.addTest(loader.discover(CASEDIR))

report_file = os.path.join(REPORTDIR, "report1.html")

# 第三步:执行用例
runner = HTMLTestRunner(stream=open(report_file, "wb"),
                        description="接口测试报告",
                        title="app接口测试测试报告",
                        tester="谢谢谢")

runner.run(suite)

# 发送邮件
send_email(report_file, "自动化测试报告")
Beispiel #4
0
import unittest
import os
from common.handlepath import CASEDIR, REPORTDIR
from HTMLTestRunnerNew import HTMLTestRunner
from common.handle_email import send_email

# 第一步:创建套件
suite = unittest.TestSuite()

# 第二步:加载用例到套件
loader = unittest.TestLoader()
suite.addTest(loader.discover(CASEDIR))

# from testcases import test_main_stream
# suite = unittest.defaultTestLoader.loadTestsFromModule(test_main_stream)

report_file = os.path.join(REPORTDIR, "report1.html")

# 第三步:执行用例
runner = HTMLTestRunner(stream=open(report_file, "wb"),
                        description="第一次接口测试报告",
                        title="py26测试报告",
                        tester="musen")

runner.run(suite)

send_email(report_file, "py26测试报告最终版")
Beispiel #5
0
"""
============================
Author:柠檬班-木森
Time:2020/3/5   11:05
E-mail:[email protected]
Company:湖南零檬信息技术有限公司
============================
"""

import unittest
import os
from common.handlepath import REPORTDIR
from HTMLTestRunnerNew import HTMLTestRunner
from common.handle_email import send_email
from testcases import test_main_stream

suite = unittest.defaultTestLoader.loadTestsFromModule(test_main_stream)

report_file = os.path.join(REPORTDIR, "report1.html")

# 第三步:执行用例
runner = HTMLTestRunner(stream=open(report_file, "wb"),
                        description="接口项目主流程测试报告",
                        title="主流程测试报告",
                        tester="musen")

runner.run(suite)

send_email(report_file, "主流程测试报告")