. : match any single character
* : match 0 or more times
\+ : match 1 or more times
\= : match 0 or 1 time (match optional)
\( : open group
\) : close group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import KIF | |
class HomeTests : KIFTestCase { | |
// test method name MUST have the prefix `test` | |
// for example: testA, testB, testLogin, ect... | |
func testHomeScreen() { | |
visitHomeScreen() | |
tapOn("button") | |
expectToSee("Some random label") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uncomment this line to define a global platform for your project | |
# platform :ios, '9.0' | |
target 'SetupTestingForiOSProject' do | |
# Comment this line if you're not using Swift and don't want to use dynamic frameworks | |
use_frameworks! | |
# Pods for SetupTestingForiOSProject | |
target 'SetupTestingForiOSProjectTests' do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
platform :ios, '9.0' | |
target 'MyAwesomeProject' do | |
use_frameworks! | |
target 'MyAwesomeProjectTests' do | |
inherit! :search_paths | |
pod 'Quick' | |
pod 'Nimble' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
platform :ios, '9.0' | |
target 'MyAwesomeProject' do | |
target 'MyAwesomeProjectTests' do | |
inherit! :search_paths | |
pod 'Specta' | |
pod 'Expecta' | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
class MyNativeTests: XCTestCase { | |
override func setUp() { | |
super.setUp() | |
// Put setup code here. This method is called before the invocation of each test method in the class. | |
} | |
override func tearDown() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
class MyNativeTests: XCTestCase { | |
func testSomething() { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class Gun: NSObject { | |
var bullets = 0 | |
init(bullets: Int) { | |
self.bullets = bullets | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import XCTest | |
@testable import MyAwesomeProject | |
class MyNativeTests: XCTestCase { | |
func testGunCanShootIfItHasBullets() { | |
// 1. Setup: create a gun with 1 bullet | |
let gun = Gun(bullets: 1) | |
// 2. Execution: shoot | |
gun.shoot() |
describe Gun
- describe shoot
- when has bullets
- when is unlocked
- it can shoot
- when is locked
- it cannot shoot
- when is unlocked
- when has no bullet
- it cannot shoot
- when has bullets
- describe lock