【Python】设备重启测试
①添加读取键盘输入功能,方便测试者选择压测次数!
Python提供了 input() 内置函数从标准输入读入一行文本,默认的标准输入是键盘。
input 可以接收一个Python表达式作为输入,并将运算结果返回。
例:
#!/usr/bin/python3
str = input("请输入:");
print ("你输入的内容是: ", str)
这会产生如下对应的结果:
请输入:ABCD
你输入的内容是: ABCD
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
==============================================================================================
Usage:
This script performs task that pressure test for automatic restart of equipment.
python RebootTest.py
Examples:
python RebootTest.py
==============================================================================================
'''
import os
import time
rebootCount = int(input("请输入重启次数:"));
print ("你输入的次数是: ", rebootCount)
def find_device():
# os.system('adb kill-server')
# os.system('adb start-server')
# os.system('adb root')
# os.system('adb remount')
print("adb devices")
os.system('adb devices')
def reboot():
os.system('adb reboot')
def screen_downup():
os.system('adb shell input keyevent 26')
def power_downup():
os.system('adb shell sendevent /dev/input/event0 1 116 1')
os.system('adb shell sendevent /dev/input/event0 0 0 0')
os.system('adb shell sendevent /dev/input/event0 1 116 0')
os.system('adb shell sendevent /dev/input/event0 0 0 0')
def get_log(name,count):
os.system('adb logcat -t 50000 > '+name+count+'.log')
#重启
for i in range(0,rebootCount):
find_device
screen_downup()
print("screen_down")
time.sleep(5)
screen_downup()
print("screen_up")
time.sleep(5)
print("power_down")
power_downup()
time.sleep(5)
print("power_up")
power_downup()
count=str(i)
get_log(name="reboot",count=count)
print("auto_reboot loop again")
reboot()
print("wait auto_reboot 60s")
time.sleep(60)
print("auto_reboot finish\n")
【Python】设备重启测试的更多相关文章
- Appium+python自动化(三十六)- 士兵突击许三多 - 多个appium服务启动,多个设备启动,多进程并发启动设备-并发测试 - 上(超详解)
简介 前面课程只是启动了单个appium服务,只能控制单台设备.如果需要针对多台设备测试那么该如何处理?而且发现群里的小伙伴们也在时不时地在讨论这个问题,想知道怎么实现的,于是宏哥就决定写一片这样的文 ...
- Python:渗透测试开源项目
Python:渗透测试开源项目[源码值得精读] sql注入工具:sqlmap DNS安全监测:DNSRecon 暴力破解测试工具:patator XSS漏洞利用工具:XSSer Web服务器压力测试工 ...
- selenium + python 多浏览器测试
selenium + python 多浏览器测试 支持库包 在学习 Python + Selenium 正篇之前,先来看下对多浏览器模拟的支持.目前selenium包中已包含webdriver,hel ...
- python 实现九型人格测试小程序
用python实现九型人格测试,并把测试结果绘制成饼图,实现代码如下: # @Description: 九型人格 import xlrd, matplotlib.pyplot as plt data ...
- Appium使用Python运行appium测试的实例
Appium使用Python运行appium测试的实例 一. Appium之介绍 https://testerhome.com/topics/8038 详情参考--https://testerhom ...
- 基于Python的XSS测试工具XSStrike使用方法
基于Python的XSS测试工具XSStrike使用方法 简介 XSStrike 是一款用于探测并利用XSS漏洞的脚本 XSStrike目前所提供的产品特性: 对参数进行模糊测试之后构建合适的payl ...
- python 程序小测试
python 程序小测试 对之前写的程序做简单的小测试 ... # -*- encoding:utf-8 -*- ''' 对所写程序做简单的测试 @author: bpf ''' def GameOv ...
- 关于测试驱动的开发模式以及实战部分,建议看《Python Web开发测试驱动方法》这本书
关于测试驱动的开发模式以及实战部分,建议看<Python Web开发测试驱动方法>这本书
- Selenium 4 Python的最佳测试框架
随着Python语言的使用越来越流行,基于Python的测试自动化框架也越来越流行.在项目选择最佳框架时,开发人员和测试人员会有些无法下手.做出选择是应该判断很多事情,框架的脚本质量,测试用例的简单性 ...
随机推荐
- CentOS 7安装fcitx中文输入法
安装过程例如以下: 1.增加EPEL源 EPEL7差点儿是CentOS必备的源: sudo yum install epel-release 2.加入mosquito-myrepo源 mosquito ...
- PHP移动互联网开发笔记(7)——MySQL数据库基础回顾[1]
一.数据类型 1.整型 数据类型 存储空间 说明 取值范围 TINYINT 1字节 非常小的整数 带符号值:-128~127无符号值:0~255 SMALLINT 2字节 较小的整数 带符号值:-32 ...
- 后台报错java.lang.IllegalArgumentException: Invalid character found in the request target.
报错: Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level. java.lang ...
- ie7easyui的书写要规范
在书写easyui对象的属性,有时候习惯在,属性的末尾再加一个“,”,这个在高版本浏览器是没事的,但是在ie7及以下,会有报错
- Lucene + Pinyin4J 提供首字母搜索(——)
遇到一个集团需求,要求在地址查询时候提供拼音搜索,第一反应应该不难,不过实现过程中却一波三折. 1.第一步是讲字段首字母进行索引,具体可以使用Pinyin4j提供的方法完成. 2.原来系统用的luce ...
- 【t087】公共汽车
Time Limit: 1 second Memory Limit: 128 MB [问题描述] 路人丁成为了一名新公交车司机,每个司机都有一张牌子,牌子的正面写了拥有这个牌子的司机开的线路号,另外一 ...
- Andrew Ng Machine Learning 专题【Logistic Regression & Regularization】
此文是斯坦福大学,机器学习界 superstar - Andrew Ng 所开设的 Coursera 课程:Machine Learning 的课程笔记. 力求简洁,仅代表本人观点,不足之处希望大家探 ...
- 卷积神经网络(CNN)与特殊的卷积
各种卷积操作的可视化的显示形式:GitHub - vdumoulin/conv_arithmetic: A technical report on convolution arithmetic in ...
- atheros wifi 动因分析
Ar6003 驱动文档摘要 1. wmi : wireless module interface //无线模块结构 2. bmi : bootloader message interface 3. ...
- TCP/IP协议族(一)
TCP/IP协议族(一) HTTP简介.请求方法与响应状态码 接下来想系统的回顾一下TCP/IP协议族的相关东西,当然这些东西大部分是在大学的时候学过的,但是那句话,基础的东西还是要不时的回顾回顾的. ...