Add the test subject
ในการเขียน Automated test จะต้องมีเป้าหมายของการทดสอบเสมอ สำหรับ unit test เป้าหมายของเราก็คือ class นั่นเอง
สร้างไฟล์ใหม่ คลิกขวาที่ xctest_example > New File...
เลือก Swift File
ตั้งชื่อว่า Adder.swift แล้วกด Create
จะมีไฟล์ใหม่เกิดขึ้น และ เปิด Editor ให้อัตโนมัติ
เพิ่ม Code นี้เข้าไปใน Adder.swift
public class Adder { public init() { } public func add(first: Int, second: Int) -> Int { return first + second } }