-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit Testing in Xcode #31
Comments
So It's taken me a little longer to work this simple readme up as I was trying to implement this simple function inside of the time project.
|
Update for the Readme above When testing with a slightly complex app, in our case Time has a table view entry point with a navigation controller. Here are the steps I've taken to get to the functions inside of our TableViewController func testExample() {
// we need to initialize the storyboard
let storyBoard = UIStoryboard(name: "Main", bundle: Bundle.main)
// then initialize the navigation controller
let navigationController = storyBoard.instantiateInitialViewController() as! UINavigationController
// we now need to extract the TableViewController which is the first child of the navigation controller.
let tableViewController = navigationController.viewControllers[0] as! TasksTableViewController
// Follow the same steps for any tests that may be present inside the viewController.
let total = 3
XCTAssertEqual(tableViewController.addTwoNumbers(x: 1, y: 2), 3)
} |
It's almost as if you're learning something ... 🤔 😉 (keep up the great work!) 🎉 |
Testing is Key
So far I've not been able to spend time on researching or implementing tests. There are two types of testing that are possible on iOS.
In this issue, my focus will be to figure out How one goes about writing unit tests in XCode
I'm starting by looking at the following Video and blogs on Ray Wenderlich
I'd like to spend ~a day and a half trying to get a reasonable idea about unit testing and I am hoping to write a short walkthrough on how one would unit test for swift 3.1
The text was updated successfully, but these errors were encountered: