测试之家
  • 社区
  • 问答
  • 招聘
  • 社区学堂新
  • 开源项目
  • 活动
  • Wiki
  • 注册
  • 登录
新手
tianyu890619 (john)
第 1206 位会员 / 2014-07-04
6 篇帖子 • 31 条回帖
3 关注者
0 正在关注
17 收藏
未设置 GitHub 信息.
  • 個人信息
  • 個人專欄
  • 帖子
  • 回帖
  • 收藏
  • 正在關注
  • 關注者
  • 热门话题
  • 最近回帖
  • 自动化工具 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示
    2 个赞 / 19 条回复
  • Appium 求问在使用 xpath 获取 H5 元素后,然后 click,总是无法触发点击事件
    1 个赞 / 8 条回复
  • 持续集成 基于 python 的自动化测试框架如何部署到服务器端的 jenkins 中执行定时任务
    0 个赞 / 14 条回复
  • 接口测试 Jmeter 中传 list 参数提交后报错
    0 个赞 / 17 条回复
  • Appium xpath 中包含变量,想通过循环去取值后放至列表中,再比较大小,目前从列表中取到的总是第一个值
    0 个赞 / 0 条回复
  • Appium appium 连接真机测试,进入对应的 app 页面后,就不跑了
    0 个赞 / 3 条回复
  • 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示 at 2018年11月15日

    1.相关的工具涉及的 python 环境都需要部署安装到你对应的环境中,就跟 windows 中需要运行的环境一样,具体如何在 linux 上安装可以自行百度;
    2.jenkins 可以在你新建的 jenkins 任务中进行配置,对应你需要运行的 python 脚本路径即可

    PS:另外 linux 有自带的 crontab -e 跑定时任务的,相关执行脚本和执行时间也可以在这个里面进行配置

  • 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示 at 2018年08月16日

    公司不便登 qq,有什么问题 你大概列下吧

  • 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示 at 2018年08月15日
    僅樓主可見
  • 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示 at 2018年08月09日

    之前忘了更新这个帖子了,问题之前已经得到解决了。先说下之前无法显示.py 之前内容的问题,是由于在 linux 中从文本中读取的用例名称中最后都包含\r 结尾,导致在输出的时候.py 会直接覆盖.py 之前的内容,在打印该用例名称之前增加 case_name = case_name.replace('\r','') 过滤掉\r 内容即可正常打印出对应的用例名称.py ,现在已经能够正常在 linux 中跑用例脚本了

  • 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示 at 2017年11月08日

    这边调试过都能正常读取 txt 里面的数据,脚本如下:
    实际打印显示如下:
    print case_name+".py" 这个本来应该显示未 testsendSms.py 而实际却显示成了.pytsendSms 了,这个很奇怪啊,我在 linux 上单独试了打印输出效果是好的,这个跟 python 版本应该没关系吧,linux 中安装的 python 版本是 2.7.5 的

  • 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示 at 2017年11月08日

    这个是取的需执行的测试用例中的名称,因为总的用例目录下面还有子目录,“/” 是用来分割后取出这个用例名称的

  • 基于 python 的自动化测试框架如何部署到服务器端的 jenkins 中执行定时任务 at 2017年11月08日

    重新开了这个帖子https://testerhome.com/topics/10753

  • 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示 at 2017年11月07日

    上面的代码格式不对,还是看下面这个截图清晰一点:


  • 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示 at 2017年11月07日

    执行代码如下
    class AllTest:
    def init(self):
    global log, logger, resultPath, on_off
    log = MyLog.get_log()
    logger = log.get_logger()
    resultPath = log.get_report_path()
    on_off = localReadConfig.get_email("on_off")
    #caselist 所有平台的 OP 接口,caselist1 为除 dmp 平台外的所有接口
    self.caseListFile = os.path.join(readConfig.proDir, "caselist1.txt")
    self.caseFile = os.path.join(readConfig.proDir, "testCase")
    # self.caseFile = None
    self.caseList = []
    self.email = MyEmail.get_email()

    # 添加需运行用例
    def set_case_list(self):
    fb = open(self.caseListFile)
    for value in fb.readlines():
    data = str(value)
    if data != '' and not data.startswith("#"):
    self.caseList.append(data.replace("\n", ""))
    fb.close()

    def set_case_suite(self):
    self.set_case_list()
    test_suite = unittest.TestSuite()
    suite_module = []

    for case in self.caseList:
    case_name = case.split("/")[-1]
    print(case_name+".py")
    discover = unittest.defaultTestLoader.discover(self.caseFile, pattern=case_name + '.py', top_level_dir=None)
    suite_module.append(discover)
    print suite_module
    if len(suite_module) > 0:

    for suite in suite_module:
    for test_name in suite:
    test_suite.addTest(test_name)
    else:
    return None

    return test_suite

    def run(self):
    """
    run test
    :return:
    """
    try:
    suit = self.set_case_suite()
    if suit is not None:
    logger.info("*****TEST START**")
    fp = open(resultPath, 'wb')
    runner = HTMLTestRunner.HTMLTestRunner(stream=fp, title='Test Report', description='Test Description')
    runner.run(suit)
    else:
    logger.info("Have no case to test.")
    except Exception as ex:
    logger.error(str(ex))
    finally:
    logger.info("
    ***TEST END******")
    fp.close()
    # send test report by email
    if on_off == 'on':
    self.email.send_email()
    elif on_off == 'off':
    logger.info("Don't send report email.")
    else:
    logger.info("Unknow state.")

    if name == 'main':
    obj = AllTest()
    obj.run()

  • 接口自动化框架从 windows 迁移至 linux 后执行脚本 htmltestrunner 中的 report 一直不显示 at 2017年11月07日

    路径这块调试过,应该没有问题,使用的是相对路径,日志都能查看到,就是读取 excel 文件那块好像有问题

关于 / 活跃用户 / 中国移动互联网测试技术大会 / 反馈 / Github / API / 帮助推广
TesterHome社区,测试之家,由众多测试工程师组织和维护的技术社区,致力于帮助新人成长,提高测试地位,推进质量发展。Inspired by RubyChina
友情链接 WeTest腾讯质量开放平台 / InfoQ / 掘金 / SegmentFault / 测试窝 / 百度测试吧 / IT大咖说
简体中文 / 正體中文 / English

©testerhome.com 测试之家   渝ICP备2022001292号
  渝公网安备 50022202000435号    版权所有 © 重庆年云聚力信息技术有限公司