https://blog.youkuaiyun.com/qq_27275447/article/details/80270270
https://blog.youkuaiyun.com/m0_38034387/article/details/80566528
unittest中最核心的四个概念是:test case, test suite, test runner, test fixture。
TestCase :测试用例,python中的一个继承了unittest.TestCase的class。
TestSuite :多个测试用例集合在一起,就是TestSuite
TestLoader :是用来加载TestCase到TestSuite中的
TestRunner :是来执行测试用例的,测试的结果会保存到TestResult实例中,包括运行了多少测试用例,成功了多少,失败了多少等信息
(元素、方法、值等是从表中读取,非直接写入)
待解决1:怎么查看unitest的基类,进行二次封装
1、引入npm包,因读取表中数据,所以导入xlrd
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException #异常捕捉
from selenium.common.exceptions import NoAlertPresentException
import os,time
import xlrd
from threading import Thread
#import

这篇博客介绍了unittest框架的核心概念,包括测试用例(TestCase)、测试套件(TestSuite)、测试加载器(TestLoader)和测试运行器(TestRunner)。文章通过具体的步骤指导如何创建测试用例,读取表格数据,并解释了测试用例的执行顺序和如何进行二次封装。同时,博主提出了在unittest中遇到的问题,如如何查看unittest基类以及如何处理不执行main函数下的代码。
最低0.47元/天 解锁文章
1040

被折叠的 条评论
为什么被折叠?



