我在论坛中找到了错误代码列表:https://groups.google.com/forum/?fromgroups=#!topic/specrun/vPQ7z2kpkbs https://groups.google.com/forum/?fromgroups=#!topic/specrun/vPQ7z2kpkbs
按错误代码对列表进行排序后,您将得到:
Unknown = 0,
Succeeded = 110,
Ignored = 120,
Pending = 210
NothingToRun = 310,
Skipped = 320,
Inconclusive = 410,
CleanupFailed = 420,
RandomlyFailed = 430,
Failed = 440,
InitializationFailed = 450,
FrameworkError = 510,
ConfigurationError = 520,
根据此列表,我们在构建服务器上使用以下命令行脚本来执行测试:
SpecRun.exe [...]
if errorlevel 200 exit /b %errorlevel%
exit /b 0
我们使用 exit 命令返回错误代码。
对于较高的错误级别代码 (>= 200),我们返回错误代码以中断构建。
但是,低于该限制的错误代码将被视为成功,并且返回 0。
使用此限制 (200),成功和忽略的案例将被视为成功,而其他所有情况都会破坏构建。如果您还想允许待处理测试 (210),您可以简单地检查 IF 中是否有更高的错误代码。