Continue Rake after failure

断了今生、忘了曾经 提交于 2019-12-05 08:19:09
kite

How do you run NUnit from rake? are you using "sh"?

This is how you use "sh" to execute shell command, and intercept the result.

I just use empty block to ignore any result(failed or success)

            sh "your shell command" do |ok,res|
                #empty block to ignore any failed or success status
                #in your case set failed flag based on ok parameter
               nunitSuccessFlag=false #hardcoded for sample; must set true or false based on ok parameter
            end

put this raise exception after shutting down the server so ccnet knows that build failed

    raise "NUnit failed" if nunitSuccessFlag == false

alternative: use try catch block as stated by user knut above as shown in this link: Rake Task: error handling (shut down the server in the ensure block)

I used this to make rake ignore the status returned from the command:

sh "the command || true"

true always exits without an error, making sh always see a success.

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