Jenkins does not stop cucumber tests when aborting (pressing the stop[x] button)

602 views Asked by At

I have calabash running iOS tests on Jenkins. When the job encounters fails I sometimes manually abort the tests by pressing the stop[x] button within the job. The problem is the next test in the feature file begins running even though I aborted. This behavior is not observed when launching the tests through the terminal. When exiting the cucumber test in the terminal the sim returns to home and no other test are launched.

I found a hook that might be useful

After do |s| 
  # Tell Cucumber to quit after this scenario is done - if it failed.
  Cucumber.wants_to_quit = true if s.failed?
end

However, there are times when I don't want it to stop just because one scenario failed. I feel like Jenkins needs to kill all processes and its not.

If someone knows how to kill calabash and its instances manually via terminal after Jenkins has been instructed to abort, I would be interested in that too.

I tried:

ps aux | grep -i instruments | awk {'print $2'} | xargs kill -9

Unfortunately that did not work. Possibly two reasons

  1. greping instruments shows two or more process

20272 ?? S 0:00.00 sh -c xcrun instruments -w "iPhone 5 (8.1 Simulator)...

20273 ?? S 0:00.45 /Applications/Xcode.app/Contents/Developer/usr/bin/instruments -w iPhone 5]...

Should I switch awk to print column 1?

or reason two

  1. I'm not greping the correct process?

Here is some of my version info:

calabash-ios version: 0.11.4

Calabash::Cucumber::MIN_SERVER_VERSION: 0.11.4

Xcode 6.1

1

There are 1 answers

1
Gábor Lipták On BEST ANSWER

You have to let Jenkins to find all forked processes. Depending on the Job type you have to pass different environment entries into the forked process. This question is about the other way (so how to make Jenkins NOT to stop processes), but the names of the possible environment entries are there. Just pass these environment entries below to each forked process and then the process tree killer will find them:

  • BUILD_ID
  • HUDSON_SERVER_COOKIE
  • JENKINS_COOKIE
  • JENKINS_SERVER_COOKIE
  • HUDSON_COOKIE