UI自动化测试框架
UI自动化测试框架涉及的常用方法封装
Automatic_tester
在自动化的道路越走越远
展开
-
selenium用tomorrow多线程运行脚本
from time import time, sleepfrom tomorrow import threadsfrom selenium import webdriverdef startBrowser(name): try: if name == "firefox" or name == "Firefox" or name == "ff": ...原创 2020-03-18 14:54:34 · 323 阅读 · 0 评论 -
UI自动化装饰器失败截图
def errorScreen(func): def wrapper(self, *args, **kwargs): try: func(self) except: self.driver.get_screenshot_as_file('./{}.png'.format(func.__name__)) ...原创 2020-01-19 15:45:16 · 366 阅读 · 0 评论 -
HTMLTestRunner源码
【代码】HTMLTestRunner源码。原创 2019-09-24 15:59:28 · 13707 阅读 · 1 评论 -
测试脚本的编写
from time import sleepfrom Base.BasePage import *from Conf.Read_ini import *from Pages.LeftBlank import *from Pages.SysSetting import *from Usual.LoginMethod import *class TestDistrictMaintai...原创 2019-09-24 15:54:53 · 1823 阅读 · 0 评论 -
业务Page元素的封装
from selenium.webdriver.common.by import Byfrom Base.BasePage import Base, loggerclass Logistics(Base): carrier = (By.XPATH, '//*[@class="el-col el-col-7"]/div[1]/div/div/div/div/input') ...原创 2019-09-24 15:53:58 · 133 阅读 · 1 评论 -
删除测试记录
import os# 删除本地测试日志class DeleteRecord(object): def delLog(self): # 设置路径 path = os.path.dirname(__file__) # 获取指定路径下的文件 dirs = os.listdir(path) # 循环读取路径下...原创 2019-09-24 15:50:55 · 643 阅读 · 0 评论 -
获取所有的测试记录
import osclass TestRecord(): def test_image(self): pic = [] # 设置路径 path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'TestReport', "Screen") # 获取指...原创 2019-09-24 15:49:24 · 124 阅读 · 0 评论 -
logging模块日志记录
# coding:utf-8import logging, osfrom time import strftimenow = strftime("%Y-%m-%d.%H.%M.%S.")class Log(object): def __init__(self): # 文件的命名 self.logName = os.path.join(os.p...原创 2019-09-24 15:48:14 · 151 阅读 · 0 评论 -
读取.ini文件和yaml文件
import configparser, os, yaml, warningsclass ConfigFile(object): def __init__(self): self.object = configparser.RawConfigParser() self.iniFile = os.path.join(os.path.dirname(__...原创 2019-09-24 15:46:55 · 279 阅读 · 0 评论 -
Common中读取Excel数据的方法
import xlrd, os# 返回某个单元格的值class Excel(object): def __init__(self, filename, sheetName): self.filename = filename self.sheetName = sheetName # 获取sheetName def getSheet...原创 2019-09-24 15:44:49 · 596 阅读 · 0 评论 -
Common中连接MySQL数据库方法
import pymysqlfrom Conf.Read_ini import ConfigFileclass SQLs(ConfigFile): def __init__(self): ConfigFile.__init__(self) self.db = pymysql.connect(host=self.database_host, ...原创 2019-09-24 15:42:35 · 665 阅读 · 0 评论 -
Common中邮件发送测试日志、截图、报告方法
import smtplib, osfrom email.header import Headerfrom email.mime.text import MIMETextfrom Log.Logs import TestRecordfrom email.mime.multipart import MIMEMultipart# 第三方 SMTP 服务def send_mail(ac...原创 2019-09-24 15:41:00 · 315 阅读 · 0 评论 -
BasePage基类相关方法封装
import time, os, unittestfrom Log.Loging import Logfrom selenium import webdriver as CSfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.common.action_chains import A...原创 2019-09-24 15:37:14 · 675 阅读 · 0 评论