一、简介

tomorrow属于第三方的一个模块,使用threads方法作为装饰器去修饰一个普通的函数,使其可以达到并发效果。使用起来非常简单。

二、安装

  • pip install tomorrow
  • 使用Pycharm安装

三、使用

1、项目结构

2、test_a.py

# -*- coding:UTF-8 -*-
import unittest
from selenium import webdriver
from time import sleep ''' A 用例 ''' class Test_aa(unittest.TestCase):
"""AA"""
@classmethod
def setUpClass(self):
global driver
driver = webdriver.Chrome()
driver.get("https://www.cnblogs.com/TSmagic/") def test_a_openurl(self):
print("我是a")
driver.quit()

其余两个用例与此相同,复制即可

3、run.py

# coding=utf-8
import unittest
from framework.HwTestReport import HTMLTestReport
from BeautifulReport import BeautifulReport
from tomorrow import threads
import datetime
import time
import os # 定义测试报告名称
now_time = str(datetime.datetime.now().strftime('%Y%m%d%H%M'))
report_name = "report_" + now_time def test_suits(): # 加载所有测试用例
discover = unittest.defaultTestLoader.discover("kisskiss", pattern="test_*.py")
return discover # 普通执行
def run_inorder():
suite = unittest.defaultTestLoader.discover("kisskiss", pattern="test_*.py")
report_abspath = os.path.join("report", f"{report_name}.html")
with open(report_abspath, 'wb') as f: # 改为with open 格式
HTMLTestReport(stream=f, verbosity=2, images=True, title='UI自动化-测试报告', description='tomorrow',
tester='莲(Lit)').run(suite) # 线程数
@threads(3)
def run(test_suit): result = BeautifulReport(test_suit)
result.report(filename=f'{report_name}.html', description='tomorrow', log_path='report') if __name__ == "__main__": t_bg = time.time() run_inorder() # 普通执行 # cases = test_suits()
# for i in cases:
# run(i) # 执行测试用例,生成报告 t_fs = time.time()
print("耗时:%.2f秒" %(t_fs - t_bg))

四、测试结果

自行测试比较,O(∩_∩)O哈哈~

Python-tomorrow应用于UI自动化的简单使用的更多相关文章

  1. airtest自动化中的poco+python连接手机实现ui自动化

    airtest:http://airtest.netease.com/docs/docs_AirtestIDE-zh_CN/index.html官网地址 AirtestIDE:跨平台的UI自动化测试编 ...

  2. ATOMac - 基于Python的Mac应用Ui自动化库

    ATOMacTest 一.缘 起 近期工作需要对一款Mac端应用实现常用功能的自动化操作,同事推荐ATOMac这款工具,这几天简单研究了下,同时也发现现网介绍ATOMac的资料非常有限,故在此记录下A ...

  3. Python Selenium 搭建Web UI自动化

    Python搭建UI自动化环境 下载Python3 Python官网 PyCharm 环境配置 安装Python 勾选Add Python to PATH,一直下一步. 验证:CMD输入Python ...

  4. [python]pytest实现WEB UI自动化

    前言:其实这篇写的是pytest的测试框架运用,实现自动化和https://www.cnblogs.com/Jack-cx/p/9357658.html 原理一致 1.为啥不用unittest Pyt ...

  5. Python—UI自动化完整实战

    实战项目 均来源于互联网 测试报告2017年11月29日优化后的测试报告:https://github.com/defnngj/HTMLTestRunner 1.项目概述: 本实战已126邮箱为例子进 ...

  6. uiautomator +python 安卓UI自动化尝试

    使用方法基本说明:https://www.cnblogs.com/mliangchen/p/5114149.html,https://blog.csdn.net/Eugene_3972/article ...

  7. (appium+python)UI自动化_09_unittest批量运行测试用例&生成测试报告

    前言 上篇文章[(appium+python)UI自动化_08_unittest编写测试用例]讲到如何使用unittets编写测试用例,并执行测试文件.接下来讲解下unittest如何批量执行测试文件 ...

  8. Python结合Pywinauto 进行 Windows UI 自动化

    转:Python结合Pywinauto 进行 Windows UI 自动化 https://blog.csdn.net/z_johnny/article/details/52778064 说明:Pyw ...

  9. Python UI自动化

    Python3--Uiautomator2--Pytest--Alure使用 官方源码GitHub地址:https://github.com/openatx/uiautomator2 介绍 uiaut ...

  10. 完成一段简单的Python程序,用于实现一个简单的加减乘除计算器功能

    #!/bin/usr/env python#coding=utf-8'''完成一段简单的Python程序,用于实现一个简单的加减乘除计算器功能'''try: a=int(raw_input(" ...

随机推荐

  1. 一道网红题:Java值传递,答案开始看了不太懂,是不是涉及到了匿名类的实例化?

    题目如下:看起来是值传递的考察... public class Test{ public static void main(String[] args){ int a = 10; int b = 10 ...

  2. VisualVM简单配置以及插件安装

    一.概述 VisualVM是随JDK发布的功能很强大的运行监视和故障处理程序.除了运行监视,故障处理外,还提供了很多其他方面的功能,如性能分析等.它有一个很大的优点:不需要被监视的程序基于特殊Agen ...

  3. SAN证书(转载)

    日常在周末更新相关容器,更新 potainer 2.6.3 后发现所有远程 docker 节点都无法连接了,看了下日志报错是这样的: background schedule error (endpoi ...

  4. 读书笔记<<世界是部金融史>>

    1.权力只对来源负责.权力只会对其来源负责--孟德斯鸠<论法的精神> 2.能违反的是纪律,不能违反的是规律.人自然要遵从人性规律. 3.在金融市场中有一个法则,如果市场认为一件事是真的,那 ...

  5. nginx按天输出日志

    直接在nginx配置文件中,配置日志循环,而不需使用logrotate或配置cron任务.需要使用到$time_iso8601 内嵌变量来获取时间.$time_iso8601格式如下:2015-08- ...

  6. [BUUCTF]HCTF 2018WarmUp1 write up

    ctrl+U查看源代码, 如下: 访问提示中的source.php文件 发现显示了源码,且存在另一个PHP文件hint.php(提示.php),先查看文件内是否有信息 用file来传参,并且要绕过wh ...

  7. Flex布局原理【转载】

    引言 CSS3中的 Flexible Box,或者叫flexbox,是用于排列元素的一种布局模式. 顾名思义,弹性布局中的元素是有伸展和收缩自身的能力的. 相比于原来的布局方式,如float.posi ...

  8. Python ArcPy批量掩膜、重采样大量遥感影像

      本文介绍基于Python中ArcPy模块,对大量栅格遥感影像文件进行批量掩膜与批量重采样的操作.   首先,我们来明确一下本文的具体需求.现有一个存储有大量.tif格式遥感影像的文件夹:且其中除了 ...

  9. openwrt 刷回梅林或者原厂固件

    路由器刷了openwrt固件后,访问不了CFE恢复模式了.本人最近用腾达AC18路由器,刷了AC68U的梅林改版固件.但是后面再用CFE刷了openwrt固件之后,发现wifi不能用,所以又想刷回梅林 ...

  10. 基于swiper.js的异型轮播

    基于原生swiper.js的异型轮播 <div class="swiper-container" > <div class="swiper-wrappe ...