补充:自动化测试高级应用之python多线程的使用-新方法

前段时间在网上学习多线程跑用例的时,发现一种更简洁,优雅的使用多线程的方法,在此分享给大家。

阅读本文前,请先阅读前面写的多线程跑用例的文章:【精选】第七章 第四节 自动化测试高级应用之python多线程的使用_add_test_img-CSDN博客

 

本文新的方法,对原有的run_allcase.py进行了改写,分为test_runner.py 和run_allcase.py两个文件。

test_runner.py源码如下:

from selenium_lib.common import *
from BeautifulReport import BeautifulReport
import unittest, time, os
from multiprocessing.dummy import Pool


class TestRunner(object):
    def __init__(self, testor="QA",title="UI自动化测试报告",description="测试用例批量执行"):
        self.testor = testor
        self.title = title
        self.des = description
        # 获取当前时间,并转化成我们想要的格式
        self.now_time = time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime(time.tim

你可能感兴趣的:(selenium3,+,selenium,测试用例,python)