【发布时间】:2019-12-10 15:39:18
【问题描述】:
基于 NUnit 的 example,可在 Appcenter github 存储库中获得,我得到了以下构建后脚本:
#!/usr/bin/env bash
echo "Found Unit test projects"
find $APPCENTER_SOURCE_DIRECTORY -regex '*.Tests*\.csproj' -exec echo {} \;
echo
echo "Run Unit test projects"
find $APPCENTER_SOURCE_DIRECTORY -regex '*.Tests*\.csproj' | xargs dotnet test --logger "trx;LogFileName=testresult.trx";
#find file with results
echo "XUnit tests result:"
pathOfTestResults=$(find $APPCENTER_SOURCE_DIRECTORY -name 'testresult.trx')
echo
grep ' \[FAIL\]' $pathOfTestResults
failures=$(grep -o ' \[FAIL\]' $pathOfTestResults | wc -l)
if [[ $failures -eq 0 ]]
then
echo "Unit Tests passed"
else
echo "Unit Tests failed"
exit 1
fi
我在本地测试了脚本,它工作正常。 当 Appcenter 执行 sctipt 时,它会写入“XUnit 测试结果:”然后永远挂起。
有人在 Appcenter 中成功配置了 xUnit 测试吗?提供的脚本可能有什么问题?
【问题讨论】:
标签: xamarin continuous-integration xunit visual-studio-app-center