title: Best way to exit iOS application after tests
body: <p>In my iOS app, I have a webview.
  In the project, there is a specific target that runs integration test for javascript and native code communication. These tests are written in javascript, and ran inside the WebView.</p>
  
  <p>I can detect when javascript is done testing. What I'd like to do is exit the application, so that the <code>xcodebuild -scheme MyJSTests</code> would run and exit properly.</p>
  
  <p><strong>What's the best way to exit an iOS application when the tests are done?</strong></p>
  
  <p>EDIT:
  I have no choice on the test framework whatsoever, as we receive the test files from another project. All I can do is implement a method that's responsible for reporting and exiting.</p>
  
  <p>The tests are executed in full javascript, inside the webview. The test scripts are loaded through a custom URLProtocol. At the end of the tests, a method call <code>reportResults()</code> is done, that is forwarded to native code.</p>