sh Test Runner(允许定义迭代次数和可选记者)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Test Runner(允许定义迭代次数和可选记者)相关的知识,希望对你有一定的参考价值。
#!/bin/bash
# syntax
# $ ./test.sh -n # -q # | true
# script colors
YELLOW='\033[1;33m'
LIGHTBLUE='\033[1;36m'
GREEN='\033[1;32m'
NC='\033[0m'
RESET='\033[0m'
# set default values (will be updated by getopts)
ITERATIONS=1
QUIET=-1
REPORTER='mocha'
while getopts ":n:q:r:" opt; do
case $opt in
q) QUIET=$OPTARG;;
n) ITERATIONS=$OPTARG;;
r) REPORTER=$OPTARG;;
\?)
# echo "Invalid option: -$OPTARG" >&2 ;;
esac
done
# coerce QUIET if we passed true | false
if [ $QUIET = 'true' ]; then QUIET=1; fi
if [ $QUIET = 'false' ]; then QUIET=0; fi
printf "\n"
for (( index=1; index<=ITERATIONS; index++ ))
do
if [ $QUIET -ne 1 ]; then
if [ $REPORTER != 'dots' ]; then
printf "\n\n [${LIGHTBLUE} running ${RESET}] ${YELLOW} Running Test $index of ${ITERATIONS} ... ${RESET}\n\n"
fi
fi
if [ $REPORTER = 'dots' ]; then
karma start --reporters super-dots
else
karma start
fi
if [ $QUIET -ne 1 ]; then
if [ $REPORTER = 'dots' ]; then
printf "\n\n"
else
printf "\n [${GREEN} complete ${RESET}] ${YELLOW} Completed $index of ${ITERATIONS} ... ${RESET}\n"
fi
fi
done
timestamp=`date +"%Y.%m.%d %H:%M:%S"`
if [ $ITERATIONS > 0 ]; then
printf "\n\n"
printf "${GREEN}====================================================================================================\n\n"
printf "${GREEN} === [${ITERATIONS}] Test(s) Processed [${timestamp}] ${RESET}\n\n"
printf "\n"
fi
以上是关于sh Test Runner(允许定义迭代次数和可选记者)的主要内容,如果未能解决你的问题,请参考以下文章
实现一个BOOST_TEST test_runner,用于从不同的共享库中运行多个测试。
Angular 6:尝试区分“[object Object]”时出错。只允许使用数组和可迭代对象
Angular:尝试与'[object Object]'进行比较时出错。仅允许数组和可迭代的对象
sh 在范围内运行可迭代任务次数
sh 在范围内运行可迭代任务次数
尝试区分“[object Object]”时出错。只有数组和可迭代