是否有可能使用相同的场景来测试不同的条目,其中一些将导致“正确”成功,而另一些则导致“正确”失败?如果行为正确,测试就可以了。
例如,登录连接在一个数据条目中应该成功,对于另一个条目则应该失败,但是测试必须结束才能成功。
发布于 2020-03-31 14:25:38
是的,此示例存在于NoraUi的CI中:
https://github.com/NoraUi/NoraUi/blob/master/src/test/resources/data/in/hello.csv
author;zip;city;element;element2;date;title;Result
Jenkins T1;35000;Rennes;smile;smile;16/01/2050;;
Jenkins T2;75000;Paris;smile;smile;;;31
Jenkins T3;56100;Lorient;smile;smile;;;25
Jenkins T4;35000;Rennes;smile;smile;;;
Jenkins T5;35000;Rennes;noExistElement;noExistElement;;;42
Jenkins T6;35000;;smile;smile;;;2
Jenkins T7;35000;Rennes;;;;;4
Jenkins T8;;Rennes;;smile;smile;;58您可以在Result列(输入数据提供程序)中找到KO步骤的数目。
例如:
Jenkins T5;35000;Rennes;noExistElement;noExistElement;;;42https://github.com/NoraUi/NoraUi/blob/master/src/test/resources/steps/hello.feature的N°42步为KO与noExistElement
When I click on $bakery.DemoPage-<element>在你的CI之后:
https://noraui.github.io/#continuousIntegration
travis-ci在线示例(unix批处理示例使用SED):https://github.com/NoraUi/NoraUi/blob/master/test/run.sh
echo "***************************************************"
echo "** Integration tests verification **"
echo "***************************************************"
counters1=$(sed -n 's:.*\[Excel\] > <EXPECTED_RESULTS_1>\(.*\)</EXPECTED_RESULTS_1>.*:\1:p' nonaui.log | head -n 1)
echo "******** $counters1"
nb_counters1=$(sed -n ":;s/$counters1//p;t" nonaui.log | sed -n '$=')
echo "********" found $nb_counters1 times
counters2=$(sed -n 's:.*\[Excel\] > <EXPECTED_RESULTS_2>\(.*\)</EXPECTED_RESULTS_2>.*:\1:p' nonaui.log | head -n 1)
echo "******** $counters2"
nb_counters2=$(sed -n ":;s/$counters2//p;t" nonaui.log | sed -n '$=')
echo "******** found $nb_counters2 times"
# 3 = 1 (real) + 2 counters (Excel and CSV)
if [ "$nb_counters1" == "3" ] && [ "$nb_counters2" == "3" ]; then
echo "******** All counter is SUCCESS"
else
echo "******** All counter is FAIL"
echo "$counters1 found $nb_counters1 times"
echo "$counters2 found $nb_counters2 times"
pwd
ls -l
cat target/reports/html/index.html
exit 255
fi
echo "***************************************************"
echo "** Unit tests verification **"
echo "***************************************************"
counterFailures=$(sed -n 's/.*\[\(.*\)\] Tests run: \(.*\), Failures: \([1-9]\), Errors: \(.*\), Skipped: \(.*\), Time elapsed.*UT.*/\3/p' nonaui.log | head -n 1)
echo "******** counter Failures: $counterFailures"
counterErrors=$(sed -n 's/.*\[\(.*\)\] Tests run: \(.*\), Failures: \(.*\), Errors: \([1-9]\), Skipped: \(.*\), Time elapsed.*UT.*/\4/p' nonaui.log | head -n 1)
echo "******** counter Errors: $counterErrors"
if [ "$counterFailures" == "" ] && [ "$counterErrors" == "" ]; then
echo "******** All unit test are SUCCESS"
else
if [ "$counterFailures" != "" ]; then
echo "******** At least one unit test is Failure"
fi
if [ "$counterErrors" != "" ]; then
echo "******** At least one unit test is Error"
fi
exit 255
fi https://stackoverflow.com/questions/60947149
复制相似问题