gpt4 book ai didi

testing - 确定测试厨房测试是通过还是失败

转载 作者:行者123 更新时间:2023-11-28 21:29:17 25 4
gpt4 key购买 nike

我们有一个看起来像这样的脚本:

#!/bin/bash
for cookbook in $cookbooks; do
cd /path/to/$cookbook
kitchen test;
# Log whether the test failed or passed
done;

# Print number of tests passed and number of tests failed

如何确定我的厨房测试是通过还是失败?

最佳答案

您可以检查 kitchen test 命令的退出状态,并像这样递增计数器:

#!/bin/bash
let failed=0
let passed=0

for cookbook in $cookbooks; do
cd /path/to/$cookbook
kitchen test;

if [ $? -ne 0 ]
then
failed=$((failed + 1))
else
passed=$((passed + 1))
fi
done;

echo "There was $passed passed and $failed failed tests."

关于testing - 确定测试厨房测试是通过还是失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29242357/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com