Why does this test fail?
Create a new swift iOS project in XCode 7
called Example with UI tests.
Example/ViewController.swift:
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
UIPasteboard.generalPasteboard().string = "test"
}
}
ExampleUITests/ExampleUITests.swift:
import XCTest
class ExampleUITests: XCTestCase {
override func setUp() {
super.setUp()
continueAfterFailure = false
XCUIApplication().launch()
}
override func tearDown() {
super.tearDown()
}
func testExample() {
XCTAssertNotNil(UIPasteboard.generalPasteboard().string) //this fails
}
}