Build Not failing when Jmeter test in Jenkins fail

123 views
Skip to first unread message

ssitara...@gmail.com

unread,
Feb 4, 2017, 1:45:22 AM2/4/17
to Jenkins Users
Hi,

I have Jenkins running as Container in docker, I have setup Jmeter environment with one test case and ran it from Jenkins 'Execute Shell', it runs fine but I intentionally set the test case to fail, so it fails. My expectatation was that Jenkins would stop build and throw an error but it says build success. How can I make it to fail ?

[JMeterTest] $ /bin/sh -xe /tmp/hudson1222895905918381553.sh
+ cd apache-jmeter-3.1/bin
+ sh jmeter.sh -n -t TestCases/TestLoop.jmx -l TestCases/results.jtl
Writing log file to: /var/jenkins_home/workspace/JMeterTest/apache-jmeter-3.1/bin/jmeter.log
Creating summariser <summary>
Created the tree successfully using TestCases/TestLoop.jmx
Starting the test @ Sat Feb 04 06:39:39 UTC 2017 (1486190379864)
Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
summary =      1 in 00:00:00 =    3.3/s Avg:    72 Min:    72 Max:    72 Err:     1 (100.00%)
Tidying up ...    @ Sat Feb 04 06:39:40 UTC 2017 (1486190380235)
... end of run
Finished: SUCCESS

Thanks.

Fritz Elfert

unread,
Feb 4, 2017, 2:59:40 AM2/4/17
to jenkins...@googlegroups.com
When executing a shell, jenkins uses the exit code for determining
success/failure. So:

=> Change your shell script so that it exits with an non-zero exitcode
in case of failure.

CU
-Fritz

On 04.02.2017 07:45, ssitara...@gmail.com wrote:
> Hi,
>
> I have Jenkins running as Container in docker, I have setup Jmeter
> environment with one test case and ran it from Jenkins 'Execute Shell',
> it runs fine but I intentionally set the test case to fail, so it fails.
> My expectatation was that Jenkins would stop build and throw an error
> but it says build success. How can I make it to fail ?
>
> [JMeterTest] $ /bin/sh -xe /tmp/hudson1222895905918381553.sh
> + cd apache-jmeter-3.1/bin
> + sh jmeter.sh -n -t TestCases/TestLoop.jmx -l TestCases/results.jtl
> Writing log file to: /var/jenkins_home/workspace/JMeterTest/apache-jmeter-3.1/bin/jmeter.log
> Creating summariser <summary>
> Created the tree successfully using TestCases/TestLoop.jmx
> Starting the test @ Sat Feb 04 06:39:39 UTC 2017 (1486190379864)
> Waiting for possible Shutdown/StopTestNow/Heapdump message on port 4445
> summary = 1 in 00:00:00 = 3.3/s Avg: 72 Min: 72 Max: 72 *Err: 1 (100.00%)*
> Tidying up ... @ Sat Feb 04 06:39:40 UTC 2017 (1486190380235)
> ... end of run
> Finished: SUCCESS
>
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to jenkinsci-use...@googlegroups.com
> <mailto:jenkinsci-use...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/43119f00-6d23-4272-a693-f1cf5f4d56cd%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-users/43119f00-6d23-4272-a693-f1cf5f4d56cd%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.


signature.asc

ssitara...@gmail.com

unread,
Feb 13, 2017, 12:25:06 AM2/13/17
to Jenkins Users
Hi,

Thank you so much for your help. I am able to fix this by setting the exit code to 1.

Sitaram
Reply all
Reply to author
Forward
0 new messages