Xcodebuild稳定性测试go脚本
[本文出自天外归云的博客园]
简单封装下xcodebuild test命令,写一个执行xcode测试的go程序,可以设定单case执行次数,也可以二次组装调用进行多个case的测试,代码如下:
package main import (
"flag"
"fmt"
"os/exec"
"strings"
) func qnegTestRunner(workspacePath string, scheme string, targetMethod string) (testResult int) {
targets := strings.Split(targetMethod, "/")
className := targets[1]
methodName := targets[2]
var err error
var cmd *exec.Cmd
var result []byte
commandString := fmt.Sprintf("xcodebuild test -workspace %s -scheme %s -destination 'platform=iOS Simulator,name=iPhone 7,OS=12.2' -only-testing:%s", workspacePath, scheme, targetMethod)
cmd = exec.Command("/bin/bash", "-c", commandString)
result, err = cmd.Output()
passedSign := fmt.Sprintf("'-[%s %s]' passed", className, methodName)
if strings.Contains(string(result), passedSign) {
testResult = 1
} else {
fmt.Println(commandString)
fmt.Println(strings.Trim(string(result), "\n"))
fmt.Println(err)
testResult = 0
}
return
} /*
终端执行该脚本命令如下:
go run exeTest.go -exeCount 3 -projectPath "/Users/admin/Desktop/zenki/XX" -scheme "Scheme" -targetMethod "Scheme/ClassName/methodName"
*/
func main() {
var targetMethod = flag.String("targetMethod", "", "目标方法")
var exeCount = flag.Int("exeCount", 3, "运行次数")
var projectPath = flag.String("projectPath", "/Users/admin/Desktop/zenki/XX", "项目路径")
var scheme = flag.String("scheme", "", "选择主题")
flag.Parse()
workspacePath := fmt.Sprintf("%s%s", *projectPath, "/XX.xcworkspace")
finalResult := 0
for index := 1; index <= *exeCount; index++ {
fmt.Println(fmt.Printf("[%d time execute] %s", index, *targetMethod))
finalResult += qnegTestRunner(workspacePath, *scheme, *targetMethod)
}
if finalResult == *exeCount {
fmt.Println(fmt.Sprintf("Execute %d times, all passed.", *exeCount))
} else {
fmt.Println(fmt.Sprintf("Execute %d times, %d times passed.", *exeCount, finalResult))
}
}
Xcodebuild稳定性测试go脚本的更多相关文章
- 移动性能测试 | 持续集成中的 Android 稳定性测试
前言 谈到Android稳定测试,大多数会联想到使用monkey工具来做测试.google官方提供了monkey工具,可以很快速点击被应用,之前我有一篇帖子提到了monkey工具的使用,详见: htt ...
- Android-monkey稳定性测试(多台设备同时进行)
1.目的(原创文章,转载请注明出处-) 主要为指引开展android平台应用的稳定性测试,尽可能地在应用发布前发现crash及an ...
- Android客户端稳定性测试——Monkey
修改时间 修改内容 修改人 2016.6.20 创建 刘永志 2016.6.29 完成 刘永志 Monkey简介: Android SDK自带的命令行测试工具,向设备发送伪随机事件流,对应用程序进行进 ...
- [转贴]LTP--linux稳定性测试 linux性能测试 ltp压力测试 ---IBM 的 linux test project
https://blog.csdn.net/melody157398/article/details/24354415 LTP--linux稳定性测试 linux性能测试 ltp压力测试 ---I ...
- 基于jmeter+perfmon的稳定性测试记录
1. 引子 最近承接了项目中一些性能测试的任务,因此决定记录一下,将测试的过程和一些心得收录下来. 说起来性能测试算是软件测试行业内,有些特殊的部分.这部分的测试活动,与传统的测试任务差别是比较大的, ...
- Monkey 稳定性测试
学习网址: https://blog.csdn.net/lucytan01/article/details/79958727 https://blog.csdn.net/hebbely/article ...
- 对Linux系统内核版本稳定性测试介绍
对Linux系统内核版本稳定性测试介绍 在对 Linux 内核版本稳定性的测试中,需要明确地声明并证明为什么版本是稳定的或者是不稳定的. 然而还没有被证明和证实当前现有的系统范围内的压力测试可以测试 ...
- LTP--linux稳定性测试 linux性能测试 ltp压力测试 ---IBM 的 linux test project
LTP--linux稳定性测试 linux性能测试 ltp压力测试 ---IBM 的 linux test project Peter盼 2014-04-23 11:25:49 20302 收藏 ...
- LTP--linux稳定性测试 linux性能测试 ltp压力测试 内核更新 稳定性测试
LTP--linux稳定性测试 linux性能测试 ltp压力测试 zhangzj1030关注14人评论33721人阅读2011-12-09 12:07:45 说明:在写这篇文章之前,本人也不曾了 ...
随机推荐
- 用 ConfigMap 管理配置
1. ConfigMap介绍管理配置 ConfigMap介绍 Secret 可以为 Pod 提供密码.Token.私钥等敏感数据:对于一些非敏感数据,比如应用的配置信息,则可以用 ConfigMap ...
- git提交时报错处理办法
git提交时报错:Updates were rejected because the tip of your current branch is behind: 有如下几种解决方法: 1.使用强制pu ...
- 轻量级C#编辑器RoslynPad((基于Roslyn编译器))
简介 RoslynPad是一个Apache 2.0协议开源的轻量级C#编辑器.支持自动完成,语法提示,修改建议等功能.很适合平时随手写个C#程序看看运行结果. 目前版本:0.10.1,无需保存也可以运 ...
- Linux学习26-linux查看某个时间段的日志(sed -n)-史上最详细
前言 在linux上查找日志的时候,如果我想找出某个时间段的日志,比如查找今天早上8点到下午2点的日志. 用grep不太方便直接过滤出来,可以使用sed根据时间去查找 sed -n '/开始时间日期/ ...
- vue项目积累
(1)--save和--save-dev 安装到开发环境npm axios --save-dev 安装到生产环境npm axios --save .
- DT系统应用-添加地图标注
修改方法:修改模板->Homepage->contact.htm 在 {php $map_height = 300;} {php @include DT_ROOT.'/api/map/'. ...
- underscore 工具
=============== 通知: 博主已迁至<掘金>码字,博客园可能以后不再更新,掘金地址:https://juejin.im/post/5a1a6a6551882534af25a8 ...
- linux系统时区问题
1. centos 7 转载自:https://www.cnblogs.com/zhangeamon/p/5500744.html 查看时区: timedatectl $timedatectl sta ...
- 20、Python常用模块sys、random、hashlib、logging
一.sys运行时环境模块 sys模块负责程序与python解释器的交互,提供了一系列的函数和变量,用于操控python的运行时环境. 用法: sys.argv:命令行参数List,第一个元素是程序本身 ...
- hdfs的文件个数 HDFS Quotas Guide
HDFS Quotas Guide Overview HDFS允许管理员为多个每个目录设置使用的命名空间和空间的配额.命名空间配额和空间配额独立操作,但是这两种类型的配额的管理和实现非常类似. Nam ...