尽管测试通过,为什么黄瓜会继续在jenkins上失败?

时间:2012-10-19 21:40:37

标签: jenkins hudson cucumber

我的黄瓜测试在命令行上运行良好,但是当我在Jenkins / Hudson持续集成中运行它们时,我得到以下内容,但我不确定如何解决它:

11 scenarios (3 skipped, 3 pending, 5 passed)
78 steps (51 skipped, 3 pending, 24 passed)
0m3.238s
Build step 'Execute shell' marked build as failure
Recording test results
Failed to send e-mail to kamilski81 because no e-mail address is known, and no default e-mail domain is configured
Failed to send e-mail to i.wooten because no e-mail address is known, and no default e-mail domain is configured
Failed to send e-mail to scott.j.rodgers because no e-mail address is known, and no default e-mail domain is configured
Sending e-mails to: dev@sc.com
Finished: FAILURE

我的剧本的最后一行:

cucumber

我被建议添加'退出0',但这会破坏我的Junit报告,因此报告不正确。

2 个答案:

答案 0 :(得分:4)

我认为,由于跳过或由于挂起的测试,黄瓜会给出非零进程退出代码。尝试让它不运行任何跳过,然后任何挂起,然后任何跳过或挂起的测试,并查看它给出的退出代码。要查看退出代码(在Unix中),请使用以下内容运行它:

cucumber ...args to select tests... ; echo $?

答案 1 :(得分:4)

如果有待处理的情况,黄瓜--strict标志会导致黄瓜返回退出代码1(例如失败)。如果存在非零退出代码,Jenkins(或任何CI)将失败。

我会检查你的项目中是否有一个cucumber.yml文件,因为这可能是你的--strict隐藏的地方。