问题
I am using Xcode 7, Swift, and the new UI Automation announced at WWDC 15. I want to test some things in an oracle database after some of my UI automation tests have run.
Can this be done? If so how do you do it? I can't seem to find any sort of documentation on the subject.
回答1:
The mobile phone doesn't guarantee a permanent and stable network connection and is a big problem for direct connection to DB. For mobile platforms you need to create a web service on a server that will do all the work between database and mobile application. It is not recommended to connect directly to databases, except when it is local databases(SQLite).
回答2:
I just upvoted @lurie-manea answer, in addition to that you shouldn't rely on Xcode UI test for testing your DB transaction once you have your web service implemented since you'd be able to test the DB state with XCTest(app tests) or if you using AppCode for writing code, it has nice plugin to test restful web services,
https://www.jetbrains.com/objc/help/testing-restful-web-services.html
Hope this helps.
来源:https://stackoverflow.com/questions/32916709/connect-to-an-oracle-database-in-swift