I am writing UI tests for iOS application. I want to read data from a local json file.
I am using the following code to get the path for my json file:
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")
    }
I have tried using the solution for the following stackoverflow question : Reading in a JSON File Using Swift. Didn't work!
Also, I had a look at the following Apple documentation: https://developer.apple.com/swift/blog/?id=37
Any help would be greatly appreciated!
 
     
     
     
    