Snippets

Philippe Casgrain Locating a test resource inside our test bundle

Created by Philippe Casgrain
// Supposes this file is called LocationsTests
// Supposes you added the file "daylight-tests.sqlite" to the
// test target, which will automatically add a "Copy Files"
// build phase for your test target to copy the database in
// your test bundle

override func setUp() {
    super.setUp()
    let testBundle = Bundle(for: LocationsTests.self)
    let filePath = testBundle.path(forResource: "daylight-tests", ofType: "sqlite")

    self.database = FMDatabase(path: filePath)
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.