์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- RxSwift
- BOJ
- MVVM
- Kuring
- designpattern
- UIKit
- Xcode
- combine
- BFS
- SwiftUI
- reactorkit
- realm
- rxcocoa
- ํจ์คํธ์บ ํผ์ค
- visionOS
- arkit
- raywenderlich
- Lv2
- ios
- SnapKit
- ํ๋ก๊ทธ๋๋จธ์ค
- XCTest
- node.js
- TCA
- tableView
- CollectionView
- ๋ฐฑ์ค
- Flutter
- swift
- Swfit
Archives
- Today
- Total
lgvv98
part5 (ch6) UI Test ๋ณธ๋ฌธ
โ ์ด๋ฒ ์๊ฐ์๋ UI Test์ ๋ํด์ ์์๋ณผ ์์ ์ด์ผ.
์ ๋ ํ ์คํธ์ UI ํ ์คํธ์ ์ฐจ์ด
์ ๋ ํ ์คํธ๋ ํด๋์ค์ ๋ํด์ ์งํํ๊ณ , UI ํ ์คํธ๋ ์ฑ ์์ฒด๋ฅผ ๋ฐ์น ์์ผ์ ์ฌ์ฉํ๋ค.
XCUIApplication์ ๋ฌธ์์์ ์ดํด๋ณด๋ฉด ํ๋์ ํด๋์ค์ด๋ค!
๋ นํ๋ฒํผ์ ์ด์ฉํด ์ฝ๋๋ฅผ ์์ฑํ ์๋ ์๋ค.
๋ค๋ง, ๋คํธ์ํฌ๊ฐ ์์ด์ผ ํ๊ฑฐ๋, ์ฌ๋ฌ๋ฒ์ ํญ์ ํตํด ์ด๋ํ ํ๋ฉด ๋ฑ ์ด๋ ค์์ด ์กด์ฌํ์ฌ, Unit Test๋ฅผ ๋ ํ์ฉํ๋ค.
๋ํ ๋ นํ ๋ฒํผ์ ํตํ๋ฉด ์ด๋ป๊ฒ ์ฟผ๋ฆฌ๋ฅผ ์์ฑํด์ผํ๋์ง ์ฝ๊ฒ ํ์ ํ ์ ์์ผ๋ ์ฐธ๊ณ ํ์.
๐ ์๋๋ ์์์ฝ๋
//
// MovieReviewUITests.swift
// MovieReviewUITests
//
// Created by Hamlit Jason on 2022/01/17.
//
import XCTest
// UITest์ ๊ฒฝ์ฐ์๋ ํ์
์์๋ ๋คํธ์ํฌ์ ์ฐ๊ฒฐ๋์ด์์ด์ผ ์ฑ์ด ๊ตฌ๋๋๋์ , ๋ํ, ์ฌ๋ฌ๋ฒ ํด๋ฆญํด์ ๊ทธ ์ง์ ์ผ๋ก ๊ฐ์ ์ฌ์ฉํด์ผํ๋ ๋จ์ ์ผ๋ก ์ธํด Unitํ
์คํธ๋ง ์ฃผ๋ก ์ฌ์ฉํ๋ค.
class MovieReviewUITests: XCTestCase {
var app: XCUIApplication!
override func setUp() {
super.setUp()
continueAfterFailure = false // ์คํจํ๋ฉด ์ฝ๋ ์ญ ์คํ์ํ๊ณ ์ข
๋ฃ
app = XCUIApplication()
app.launch()
}
override func tearDown() {
super.tearDown()
app = nil
}
func test_navigationBar์_ํ์ดํ์ด_์ํํ์ ์ผ๋ก_์ค์ ๋์ด์๋ค() {
let existNavigationBar = app.navigationBars["์ํ ํ์ "].exists
XCTAssertTrue(existNavigationBar)
}
func test_SearchBar๊ฐ_์กด์ฌํ๋ค() {
// ์์น๋ฐ๊ฐ ๋ค๋น๊ฒ์ด์
์ ์์นํ๋์ ๋ค์ด์๊ธฐ ๋๋ฌธ์
let existSearchBar = app.navigationBars["์ํ ํ์ "]
.searchFields["Search"]
.exists
XCTAssertTrue(existSearchBar)
}
func test_SearchBar์_cancel๋ฒํผ์ด_์กด์ฌํ๋ค() {
let navigationBar = app.navigationBars
navigationBar
.searchFields["Search"]
.tap()
let existSearchBarCancelButton = navigationBar
.buttons["Cancel"]
.exists
XCTAssertTrue(existSearchBarCancelButton)
}
func test_๋
นํ๋ฒํผ์_ํด๋ฆญํด์_ํ
์คํธ์ฝ๋_์์ฑ() {
let app = XCUIApplication()
let navigationBar = app.navigationBars["์ํ ํ์ "]
let searchSearchField = navigationBar.searchFields["Search"]
searchSearchField.tap()
app.tables["Empty list"].swipeUp()
searchSearchField.swipeDown()
navigationBar.buttons["Cancel"].tap()
let collectionViewsQuery = app.collectionViews
collectionViewsQuery.children(matching: .cell).element(boundBy: 3).swipeUp()
collectionViewsQuery.children(matching: .cell).element(boundBy: 2).swipeDown()
}
}
'โ ๏ธ deprecated โ ๏ธ > ํจ์บ (์ด๊ฒฉ์ฐจ)' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
part5 (ch6). MovieReview XCTest ์ฝ๋๋ฆฌ๋ทฐ (0) | 2022.02.01 |
---|---|
part5 (ch6). BDD์ ๊ฐ๋ ์ ๋ํด์ ์์๋ณด๊ธฐ (0) | 2022.02.01 |
part5 (ch6). MovieReview ์ฝ๋๋ฆฌ๋ทฐ (0) | 2022.01.31 |
part5. (ch6) SwiftLint ์์๋ณด๊ธฐ (0) | 2022.01.17 |
part5. (ch5) BookReview XCTest ์ฝ๋๋ฆฌ๋ทฐ (0) | 2022.01.09 |
Comments