# all_tests_pro.py

import unittest,time,os,multiprocessing
import HTMLTestRunner #查找多有含有thread的文件,文件夹
def EEEcreatsuit():
casedir = []
listaa = os.listdir(r'C:\Users\wangxue1\PycharmProjects\selenium2TestOne')
for xx in listaa:
if 'thread' in listaa:
casedir.append(xx)
suite = []
for n in casedir:
testunit = unittest.TestSuite()
discover = unittest.defaultTestLoader.discover(n,pattern='test*.py',top_level_dir=n)
print(discover)
for test_suite in discover:
for test_case in test_suite:
testunit.addTests(test_case)
suite.append(testunit)
print('================casedir:==========',casedir)
print('+++++++++++++++++++++++++++++++++++')
print('!!!!!suite:!!!!!',suite)
return suite,casedir #多进程运行测试套件,将结果写入HTMLTestRunner报告
def EEEEmultiRunCase(suite,casedir):
now = time.strftime('%Y-%m-%d-%H_%M_%S',time.localtime(time.time()))
testreport = 'C:\\Users\\wangxue1\\PycharmProjects\\selenium2TestOne\\' + now + '\\'
filename = testreport + 'report.html'
if not os.path.exists(testreport):
os.makedirs(testreport)
else:
pass
proclist = []
s = 0
with open(filename,'wb') as report:
for i in suite:
runner = HTMLTestRunner.HTMLTestRunner(stream=report,title=u'测试报告',description=u'用例执行情况:')
proc = multiprocessing.Process(target=runner.run(i),args=(i,))
proclist.append(proc)
s = s + 1
for proc in proclist: proc.start()
for proc in proclist: proc.join() runtmp = EEEcreatsuit()
EEEEmultiRunCase(runtmp[0],runtmp[1])

【Selenium2】【Python多线程】的更多相关文章

  1. python多线程学习记录

    1.多线程的创建 import threading t = t.theading.Thread(target, args--) t.SetDeamon(True)//设置为守护进程 t.start() ...

  2. python多线程编程

    Python多线程编程中常用方法: 1.join()方法:如果一个线程或者在函数执行的过程中调用另一个线程,并且希望待其完成操作后才能执行,那么在调用线程的时就可以使用被调线程的join方法join( ...

  3. Python 多线程教程:并发与并行

    转载于: https://my.oschina.net/leejun2005/blog/398826 在批评Python的讨论中,常常说起Python多线程是多么的难用.还有人对 global int ...

  4. python多线程

    python多线程有两种用法,一种是在函数中使用,一种是放在类中使用 1.在函数中使用 定义空的线程列表 threads=[] 创建线程 t=threading.Thread(target=函数名,a ...

  5. python 多线程就这么简单(转)

    多线程和多进程是什么自行google补脑 对于python 多线程的理解,我花了很长时间,搜索的大部份文章都不够通俗易懂.所以,这里力图用简单的例子,让你对多线程有个初步的认识. 单线程 在好些年前的 ...

  6. python 多线程就这么简单(续)

    之前讲了多线程的一篇博客,感觉讲的意犹未尽,其实,多线程非常有意思.因为我们在使用电脑的过程中无时无刻都在多进程和多线程.我们可以接着之前的例子继续讲.请先看我的上一篇博客. python 多线程就这 ...

  7. python多线程监控指定目录

    import win32file import tempfile import threading import win32con import os dirs=["C:\\WINDOWS\ ...

  8. Selenium2+python自动化17-JS处理滚动条

    前言 selenium并不是万能的,有时候页面上操作无法实现的,这时候就需要借助JS来完成了. 常见场景: 当页面上的元素超过一屏后,想操作屏幕下方的元素,是不能直接定位到,会报元素不可见的. 这时候 ...

  9. Selenium2+python自动化23-富文本(自动发帖)

    前言 富文本编辑框是做web自动化最常见的场景,有很多小伙伴遇到了不知道无从下手,本篇以博客园的编辑器为例,解决如何定位富文本,输入文本内容 一.加载配置 1.打开博客园写随笔,首先需要登录,这里为了 ...

  10. Selenium2+python自动化24-js处理富文本(带iframe)

    前言 上一篇Selenium2+python自动化23-富文本(自动发帖)解决了富文本上iframe问题,其实没什么特别之处,主要是iframe的切换,本篇讲解通过js的方法处理富文本上iframe的 ...

随机推荐

  1. CRM rbac 组件的应用

    1 拷贝 rbac 组件到项目中,注册这个app 2 数据库迁移 1 删除rbac下migrations里除了init外的文件 2 修改用户表 class User(models.Model): &q ...

  2. Django 自定义

    from django.db import models class MyCharfield(models.Field): def __init__(self,max_length,*args,**k ...

  3. 51Nod 1072 威佐夫游戏

    题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1072 有2堆石子.A B两个人轮流拿,A先拿.每次可以从一堆 ...

  4. APIClound 弹出层 Frame

    JS api.openFrame({ name: 'showPic', url: './showPic.html', rect: { // x: api.pageParam.marginBottom, ...

  5. 新建web项目myeclipse基本设置

    1. General --> Workspace --> UTF-82. General --> Editors --> Associations --> JSP --& ...

  6. JAVA获取不同操作系统的分隔符等参数

    import java.util.Properties; public class SeparatorUtils { /* system properties to get separators */ ...

  7. Prometheus监控学习笔记之教程推荐

    最近学习K8S和基于容器的监控,发现了如下的教程质量不错,记录下来以备参考 1. K8S最佳实战(包括了K8S的Prometheus监控和EFK日志搜集) https://jimmysong.io/k ...

  8. HashMap的实现原理总结

    HashMap基于hashing原理,我们通过put()和get()方法储存和获取对象. 当我们将键值对传递给put()方法时,它调用键对象的hashCode()方法来计算hashcode,让后找到b ...

  9. Ubuntu 部署 nginx

    Ubuntu 部署 nginx  apt-get install nginx

  10. openstack tap complete

    $ openstack complete > /etc/bash_completion.d/osc.bash_completion re-login and bash