Why does cucumber keep failling on jenkins, although tests pass?

时光怂恿深爱的人放手 提交于 2020-01-14 02:25:02

问题


My cucumber test work well on command line, but when I run them in Jenkins/Hudson continuous integration, I get the following, but am not sure how to fix it:

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

My final lines of my scripts:

cucumber

And i was advised to add 'exit 0' but then this breaks my Junit reports, so reporting is incorrect.


回答1:


I think cucumber gives non-zero process exit code either because of skipped or because of pending tests. Try to get it to not run any skipped, then any pending, then any skipped or pending tests and see what exit codes it gives. To see the exit code (in Unix), run it with something like:

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




回答2:


The cucumber --strict flag causes cucumber to return exit code 1 (e.g. fail) if there is pending scenarios. Jenkins (or any CI) will fail if there is a non-zero exit code.

I would check if you have a cucumber.yml file in your project as that is likely where your --strict is hiding.



来源:https://stackoverflow.com/questions/12982834/why-does-cucumber-keep-failling-on-jenkins-although-tests-pass

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!