title: How to run swift XCTest tearDown once
body: <p>I am using xcode 8.3.3, swift, and I am trying to get the tearDown method to run only once.  </p>
  
  <p>I launch the application once with the solution provided here: 
  <a href="https://stackoverflow.com/questions/45021466/xctestcase-not-launching-application-in-setup-class-method">XCTestCase not launching application in setUp class method</a></p>
  
  <p>In the tearDown method, I want to logout of the application.  I only want to do this once.</p>
  
  <p>The XCTest documentation has a class tearDown() method, but when I try to use it - it doesn't have access to the application anymore?:
  <a href="https://developer.apple.com/documentation/xctest/xctestcase/understanding_setup_and_teardown_for_test_methods" rel="nofollow noreferrer">https://developer.apple.com/documentation/xctest/xctestcase/understanding_setup_and_teardown_for_test_methods</a></p>
  
  <p>This is all I get when I am in the tearDown method and so it can't access any elements on the application anymore:</p>
  
  <p><a href="https://i.stack.imgur.com/poIa7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/poIa7.png" alt="enter image description here"></a></p>
  
  <p>How can I run the code in the tearDown just once at the end of all tests?</p>