title: Read local JSON file in XCUITest
body: <p>I am writing UI tests for iOS application. I want to read data from a local json file.</p>
  
  <p>I am using the following code to get the path for my json file:</p>
  
  <pre><code>func testExample() {
  
      readJSON()
  }
  
  func readJSON(){
      let bundle = Bundle(for:myTestClass.self)
      if let path = bundle.url(forResource: "myurl", withExtension: "json"){
          print("Got the path")
          print(path)
      }
      else{
          print("Invalid filename/path")
      }
  </code></pre>
  
  <p>I have tried using the solution for the following stackoverflow question :
  <a href="https://stackoverflow.com/questions/24410881/reading-in-a-json-file-using-swift">Reading in a JSON File Using Swift</a>. Didn't work!</p>
  
  <p>Also, I had a look at the following Apple documentation: 
  <a href="https://developer.apple.com/swift/blog/?id=37" rel="nofollow noreferrer">https://developer.apple.com/swift/blog/?id=37</a></p>
  
  <p>Any help would be greatly appreciated!</p>