随笔分类 -  python自动化框架——PO设计模式

摘要:import unittest from ddt import ddt, data, unpack import requests test_data = [['xs', 'xs01', 'xs02','xs03'], ['cs', 'cs01', 'cs02', 'cs03'], ['cr', ' 阅读全文
posted @ 2020-04-07 01:13 小白龙白龙马
摘要:import os import configparser proDir = os.path.split(os.path.realpath(__file__))[0] configPath = os.path.join(proDir, "xs.ini") class ReadConfig(): de 阅读全文
posted @ 2020-04-06 19:15 小白龙白龙马
摘要:import os import configparser proDir = os.path.split(os.path.realpath(__file__))[0] configPath = os.path.join(proDir, "xs.ini") class ReadConfig(): de 阅读全文
posted @ 2020-04-06 19:10 小白龙白龙马
摘要:在run_all.py中编写如下脚本: # cording:utf-8 import unittest import os from common import HTMLTestRunner_cn #os.path.dirname: 获取当前文件所在的文件夹路径。 os.path.realpath( 阅读全文
posted @ 2020-04-04 18:09 小白龙白龙马
摘要:import unittest from selenium import webdriver from ddt import ddt,data,unpack import time from aaa import readxls test_data = readxls() @ddt class Te 阅读全文
posted @ 2020-04-04 15:53 小白龙白龙马
摘要:注意:每一条用例测试之前,需要执行:self.driver.find_element_by_id('kw').clear() 正常状态: import unittest from selenium import webdriver from ddt import ddt,data,unpack im 阅读全文
posted @ 2020-04-04 15:33 小白龙白龙马
摘要:读取excel模块: import xlrd def readxls(): xl=xlrd.open_workbook('C:\\Users\\del\\Desktop\\book.xls') #打开Excel表格 sheet1 = xl.sheet_by_name('Sheet1') #指定表1 阅读全文
posted @ 2020-04-04 14:25 小白龙白龙马
摘要:python 的unittest 没有自带数据驱动功能。 所以如果使用unittest,同时又想使用数据驱动,那么就可以使用DDT来完成。 DDT是 “Data-Driven Tests”的缩写,包含类的装饰器ddt和两个方法装饰器data(直接输入测试数据),file_data(可以从json或者 阅读全文
posted @ 2020-04-04 13:57 小白龙白龙马
摘要:import unittest from ddt import ddt,data,unpack test_data=[1,2,3,4,5,6,7,8] @ddt class TestMath(unittest.TestCase): def setUp(self): pass @data(*test_ 阅读全文
posted @ 2020-04-04 13:54 小白龙白龙马
摘要:import unittest from ddt import ddt,data,unpack test_data=test_data=[[1,3],[4,5],[6,7]] @ddt class TestMath(unittest.TestCase): def setUp(self): pass 阅读全文
posted @ 2020-04-04 13:50 小白龙白龙马
摘要:import unittest from ddt import ddt,data,unpack test_data=[{'no':1,'name':'小李'},{'no':2,'name':'小张'},{'no':3,'name':'小王'}] @ddt class TestMath(unittes 阅读全文
posted @ 2020-04-04 13:40 小白龙白龙马
摘要:[qudong]dr=1;[url]ul=http://www.baidu.com from selenium import webdriver from selenium.webdriver.support.wait import WebDriverWait from selenium.webdr 阅读全文
posted @ 2020-04-03 14:21 小白龙白龙马
摘要:在自动化测试过程中,为了提高脚本的可读性和降低维护成本,将一些通用信息写入配置文件,将重复使用的方法写成公共模块进行封装,使用时候直接调用即可。 这篇博客,介绍下python中利用configparser模块读写配置文件的方法,仅供参考。。。 一、读取文件 configparser模块支持读取.co 阅读全文
posted @ 2020-04-02 23:42 小白龙白龙马
摘要:文件ini里面内容; [email_qq]qq=123456mm=1sstt;[mima]#r=123r=12345t=www.baidu.com import configparser # C:\\Users\\del\\PycharmProjects\\untitled1\\cs\xs.ini 阅读全文
posted @ 2020-04-02 23:37 小白龙白龙马
摘要:转载:https://www.cnblogs.com/yinzhengjie/p/8570093.html ConfigParser模块用于生成和修改常见配置文档,当前模块的名称在 python 3.x 版本中变更为 configparser。类似于apache和mysql的配置文件就用这个模块生成 阅读全文
posted @ 2020-04-02 23:34 小白龙白龙马
摘要:from selenium import webdriver from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as 阅读全文
posted @ 2020-04-01 17:11 小白龙白龙马
摘要:import time from selenium import webdriver driver = webdriver.Firefox() driver.get('http://www.baidu.com') time.sleep(5) driver.find_element('id','kw' 阅读全文
posted @ 2020-03-31 20:02 小白龙白龙马
摘要:from selenium import webdriver import time class BasePage(object): """ BasePage封装所有页面都公用的方法,例如driver, Find_Element等 """ # 实例化BasePage类时,最先执行的就是__init_ 阅读全文
posted @ 2020-03-31 15:58 小白龙白龙马
摘要:from selenium import webdriver import time class BasePage(object): """ BasePage封装所有页面都公用的方法,例如driver, Find_Element等 """ # 实例化BasePage类时,最先执行的就是__init_ 阅读全文
posted @ 2020-03-31 15:24 小白龙白龙马