摘要:from openpyxl import * class excel(): def __init__(self,file): self.file = file self.wb = load_workbook(self.file) sheets = self.wb.get_sheet_names() self.sheet...
阅读全文
摘要:def getfile(dir_file): baseUrl = dir_file fileList = [] list = os.listdir(baseUrl) for i in range (0, len(list)): path = os.path.join(baseUrl,list[i]) if os.path...
阅读全文
摘要:[email]smtpserver=xxxusername=xxxpassword=xxxsender=xxxreceiver=xxx
阅读全文
摘要:import logging def log_system_init(logfile): "初始化日志系统,同时将日志信息输出到控制台和logfile日志文件" root = logging.getLogger() root.setLevel(logging.NOTSET) filehandler = logging.FileHandler(logfi...
阅读全文
摘要:from time import sleep from lib.log import * from public.BaseOperate import BaseOperate#BaseOperate是对基础操作进行封装的类 class loginpage(BaseOperate): def __init__(self,driver): BaseOperate....
阅读全文
摘要:import os from appium import webdriver from time import sleep, strftime from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.support import expected_conditions as EC,\ ...
阅读全文
摘要:import os import collections def getfile(dir_fiile): allFileNum = 0 baseUrl=dir_fiile list = os.listdir(baseUrl) filelist = [] for i in range(0, len(list)): #遍历 ...
阅读全文
摘要:配置文件命令为: [cmd]openAppium = node /Applications/Appium.app/Contents/Resources/node_modules/appium/bin/appium.jsstopAppium = pkill nodestartServer = adb
阅读全文
摘要:from appium import webdriver import readConfig import GetDevices import time from time import sleep def appdriver(): '''初始化测试环境,启动测试app''' conf = readConfig.Readconfig() cmd = GetDevices....
阅读全文
摘要:通过unittest.TestSuite()类直接构建,或者通过TestSuite实例的addTests、addTest方法构建
阅读全文
摘要:跳过测试类: 跳过某个用例: 如果发现是跳过时,就不会执行setup和teardown,就执行停止执行用例了
阅读全文
摘要:TestCase()类的run方法,第一个参数是result,不传默认是none 如果没有传result,即TestResult的类的或者子类的一个对象,如果没有传,则会给result赋给TestResult一个对象,然后查看是否有startTestRun熟悉,有则,只需startTestRun方法
阅读全文
摘要:如上为TestCase类里面的__init__初始化函数,目前了解不是很深,目前只知道methodName这个参数传入的就是我们自己编写的用例,已test开头的用例,如果只是用这个类,可以用任意名字,如下例子
阅读全文
摘要:* TestCase类里面有一个魔术函数__call__,如下即回调了TestCase的run 方法(run方法是用来执行测试用例的) def __call__(self, *args, **kwds): return self.run(*args, **kwds) 所以测试用例可以直接用该call
阅读全文
摘要:同一个目录下 test1.py import unittest class test1(unittest.TestCase): u"类1的测试用例" def test1(self): u"测试用例1" print "test001lalala" def test2(self): u"测试用例2" p
阅读全文
摘要:assertEqual(first, second, msg=None)¶ 只有first和second相等时,才是通过,否则不通过。first和second可以是任意类型,当判断是否相等时调用特定类型的相等函数判断,所以会给出明确的错误信息。 assertNotEqual(first, secon
阅读全文
摘要:第一类函数用于运行用例,分别为:setUp(),tearDown(),setUpclass(),tearDownClass(),run(),skipTest(),subTest(),debug() setUp() 该方法是在执行第一个测试用例之前迅速调用,创建一个textfixture,默认情况下是
阅读全文
摘要:Python unittest类与函数的概要介绍,这个主要是根据Python的unittest官方网站 class unittest.TestCase(methodName='runTest') TestCase的实例在unittest里面表示的是逻辑单元测试 这个类是个基础类,不同的测试需要用不同
阅读全文
摘要:当需要跳过某个测试用例或者某个测试类或者预期失败的测试用例,可以使用如下方法,这样就不会导致测试报告结果的失败 import unittestimport sys class TestStringMethods(unittest.TestCase): @unittest.skipUnless(sys
阅读全文
摘要:一下例子即把testcase添加到suit里面 import unittest class TestStringMethods(unittest.TestCase): def test_upper(self): self.assertEqual("foo".upper(), "FOO") def t
阅读全文
摘要:python unittest简单的例子如下: class TestString(unittest.TestCase): def test_upper(self): self.assertEqual("foo".upper(), "FOO") def test_isupper(self): self
阅读全文
摘要:Python的untiltest的单元测试框架最初受Junit的启发,同所有其他语言的单元测试框架一样,具有相似的特性。 单元测试框架,一般包括自动化测试,配置共享,关机测试,以及聚合测试用例到测试用例集,且测试用例和报告相互独立等。 unittest包含了几个重要的概念,如下: 1. test f
阅读全文