Skip to content

Instantly share code, notes, and snippets.

View voxqhuy's full-sized avatar
:shipit:
Don’t comment bad code—rewrite it

Huy Vo voxqhuy

:shipit:
Don’t comment bad code—rewrite it
  • San Diego, CA
View GitHub Profile
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of UISearchBar
Last active January 24, 2020 20:29
Sample iOS Unit Tests: Working with a ViewController composed of UISearchBar
import XCTest
@testable import YourProjectModule
class ViewControllerTest: XCTestCase {
var systemUnderTest: ViewController!
override func setUp() {
super.setUp()
@ccabanero
ccabanero / Sample iOS Unit Tests: Testing Model Class methods
Last active June 10, 2019 22:06
Sample iOS Unit Tests: Testing Model Class methods
//
// TEST CODE
import XCTest
@testable import to
class JSONReaderTest: XCTestCase {
@ccabanero
ccabanero / Sample iOS Integration Test: Test When Model performs work over the Network
Last active June 10, 2019 22:06
Sample iOS Integration Test: Test When Model performs work over the Network
// Example of an asynchronous unit test
func testUserLogin() {
let readyExpectation = expectationWithDescription("ready")
User.loginWithUsername("kris@bla.org", password: "blah") { (isSuccess) -> Void in
let expectedLoginSuccessStatus = true
@ccabanero
ccabanero / Sample iOS Unit Tests: Working with a ViewController composed of TableViews
Last active November 9, 2023 09:00
Sample iOS Unit Tests: Working with a ViewController composed of TableViews
import XCTest
@testable import YourAppTargetname
class SideMenuViewControllerTest: XCTestCase {
var viewControllerUnderTest: SideMenuViewController!
override func setUp() {
super.setUp()