NoraUi - 场景使用

NoraUi - Scenario usage

是否可以使用相同的场景来测试不同的条目,其中一些会导致 "right" 成功而另一些会 "right" 失败?如果行为正确,测试就可以了。
例如,登录连接应该在一个数据输入时成功,而在另一个输入时应该失败,但测试必须以成功结束。

是的,这个样本存在于 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;;;42

https://github.com/NoraUi/NoraUi/blob/master/src/test/resources/steps/hello.feature的第42步与noExistElement

KO
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>.*::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>.*::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.*//p' nonaui.log | head -n 1)
echo "******** counter Failures: $counterFailures"

counterErrors=$(sed -n 's/.*\[\(.*\)\] Tests run: \(.*\), Failures: \(.*\), Errors: \([1-9]\), Skipped: \(.*\), Time elapsed.*UT.*//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