Why does cucumber keep failling on jenkins, althou

2019-05-24 11:28发布

问题:

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.