你好!让我们讨论一下,如果您不想手动检查本地化,那么在2020年现在可以如何测试多语言iOS应用程序。
![图片](https://habrastorage.org/webt/xa/yu/wy/xayuwymbwerx4lxec7va_-mikn4.png)
— -, . ( ), . : , , , . . , , , .
![图片](https://habrastorage.org/webt/zt/6x/vv/zt6xvvqcxxh1cmxe6rhp5ibi4us.jpeg)
Product Owner . , — , .
![图片](https://habrastorage.org/webt/ts/xi/2y/tsxi2ywxidtfaum6rasuahznjyq.jpeg)
: , .
![图片](https://habrastorage.org/webt/ly/h9/ir/lyh9irpnouj3zfgsw917pv5v5fe.jpeg)
6-7 .
Exness Mobile Trader.
, WebSocket. . , . : , - . — push-.
![图片](https://habrastorage.org/webt/gx/gu/3_/gxgu3_mmixgr9vcmzm39pkts3fy.jpeg)
, . .
2017 , 70% - , . . , . 2017- . . . , BDD-, API Postman. 2018 , - , .
— . , , .
— , , ?
Crowdin — . , Jira, : , , . , . .
Crowdin : XML, YML, JSON, . . - : , . Crowdin API. . , - , . , , , , .
Crowdin .
: ?
LinguanApp — «» Xcode-, - . , , - . : . LinguanApp : , . , , .
: LinguanApp , , Crowdin.
, . , , — , , . , . , , :
![图片](https://habrastorage.org/webt/gg/je/ot/ggjeotkl-jgpibef9r467d8yplu.jpeg)
? , , , : 14 . iPhone ( , iPhone SE), 6 15 = 90 « — ». . , . .
-, : iPhone Xs Max, iPhone X, 6S 6 plus. , , . Display Zoom:
![图片](https://habrastorage.org/webt/ur/s-/89/urs-89miiyoocuc9l4kumreqetq.png)
? , . iPhone 6S, Display Zoom iPhone 5. iOS 11 iPhone Xs Display Zoom, Xr Xs Max .
. . , .
. , . UI-. UI-, , . , accessebility Identifier’:
signinButton.accessebilityIdentifier = "btn_auth"
, Identity Inspector Xcode.
, , . Swift XCTest.
func testTutorial() {
tutorialButton.tap()
waitForElementToDissappear(element: tutorialButton, timeout: 5)
makeScreenshot()
for _ in 1...4 {
app.swipeLeft()
makeScreenshot()
}
tutorialCloseButton.tap()
waitForElementToDissappear(element: tutorialCloseButton, timeout: 3)
}
, Tutorial. . , . tutorial , .
:
Stackoverflow :
func makeScreenshot() {
XCTContext.runActivity(named: "Making a full screenshot and saving it") { (activity) in
let screen = XCUIScreen.main
let fullscreenshot = screen.screenshot()
let fullScreenshotAttachment = XCTAttachment(screenshot: fullscreenshot)
fullScreenshotAttachment.lifetime = .keepAlways
activity.add(fullScreenshotAttachment)
}
}
:
func waitForElementToDissappear(element: XCUIElement, timeout: Double) {
let doesNotExistPredicate = NSPredicate(format: "exists == FALSE")
expectation(for: doesNotExistPredicate, evaluatedWith: element, handler: nil)
waitForExpectations(timeout: timeout, handler: nil)
}
.
— Fastlane, . , .
:
![图片](https://habrastorage.org/webt/z8/a5/gu/z8a5gu26fytc9jhsjytl91p9wc4.png)
SnapshotHelper.swift Snapfile, .
Fastlane UI Test Target. UI Test Bundle:
![图片](https://habrastorage.org/webt/xk/cc/do/xkccdoeniktglkasbsryxiedqto.png)
:
![图片](https://habrastorage.org/webt/yz/yj/7v/yzyj7vafd8jk3hsm99j-wfi2rmu.png)
Target membership .
. , shared. , Build :
![图片](https://habrastorage.org/webt/rp/k5/-c/rpk5-cycy9slzltmvjbes4qplae.png)
Test :
![图片](https://habrastorage.org/webt/tx/up/ns/txupnskt7yomasqbovex-wxol8m.png)
Fastlane setUp(), -:
override func setUp() {
continueAfterFailure = false
setupnapshot(app)
app.launch()
}
, , Fastlane. makeScreenshot() snapshot("snapshot_name"), Fastlane .
, . :
func testTutorial() {
tutorialButton.tap()
waitForElementToDissappear(element: tutorialButton, timeout: 5)
snapshot("Tutorial_page_1")
var i: Int = 2
repeat {
app.swipeLeft()
snapshot("Tutorial_page_\(i)")
i += 1
} while i <= 5
tutorialCloseButton.tap()
waitForElementToDissappear(element: tutorialCloseButton, timeout: 3)
}
4 5 : , , , . , — , . :
![图片](https://habrastorage.org/webt/fg/fn/i5/fgfni5p0tbbkks5y939h-sb-4hm.png)
list of device , ; , UI-, . , , — .
fastlane snapshot HTML- , , .
Fastlane . 5 4 5 28 . . Fastlane.
— XCTest Plan. WWDC 2019 Xcode 11. : , , . , XCTest Plan Xcode .
. , , XCTest Plan:
![图片](https://habrastorage.org/webt/vx/xe/8m/vxxe8ms3laqa4ixtdyabhvy_mk0.png)
:
![图片](https://habrastorage.org/webt/x6/js/ov/x6jsov3k9xsk8fojo5yqbknvtpm.png)
. application language:
![图片](https://habrastorage.org/webt/1m/8r/zy/1m8rzygompsqgxy-moynjhrexhm.png)
Shared settings system language, , , :
![图片](https://habrastorage.org/webt/zu/xh/6p/zuxh6p8-skmfpreydsxuq0fmgvg.png)
. :
—> Run yourTestName():
![图片](https://habrastorage.org/webt/vr/4b/ic/vr4biczi5lllonwctnuvvjvsar8.png)
,
Xcodebuild:
Xcodebuild
-workspace ExnessForHeisenbug.xcworkspace/
-scheme ExnessForHeisenbug
-destination 'platform=iOS Simulator,OS=10.3.1,name=iPhone 6s'
-destination 'platform=iOS Simulator,OS=11.4,name=iPhone 7 plus'
-destination 'platform=iOS Simulator,OS=12.2,name=iPhone Xs'
-destination 'platform=iOS Simulator,OS=12.2,name=iPhone SE'
test -testPlan ExnessForHeisenbug
, , testPlan destination. , iOS, .
XCTest Plan. , . Fastlane.
testTutorial:
![图片](https://habrastorage.org/webt/i7/1s/8d/i71s8dv7-1kjges4dc1bug2ed3e.png)
XCTest Plan: . Fastlane HTML-, , . , Xcode , - . XCTest Plan , Xcode.
. , Apple , , . , Fastlane 28 , XCTest Plan 2,6 . 10 .
, . , -: , .
- :
— iOS Snapshot Test Case, , Objective C. UIView/CALayer . (recordMode = true) (). (recordMode = false), .
![图片](https://habrastorage.org/webt/-x/pj/iy/-xpjiye_jd8a8xcktxv872l9hdu.jpeg)
Deposit is in your account! Long title! Test it Elon Musk!, 120 000 000.00 USD. , .
. , - . , transaction id, .
( ). , , .
pod
![图片](https://habrastorage.org/webt/nu/i2/c0/nui2c0uz0yjj4hkkgk6oqcp_ldi.png)
:
FB_REFERENCE_IMAGE_DIR — ,
IMAGE_DIF_DIR — .
![图片](https://habrastorage.org/webt/nj/sa/q_/njsaq_hn8beyf30rcrtulhzz6zy.png)
. - , . , , .
— Swift Snapshot Testing, Point Free Co. : . JSON, , URL, .
. E Import Snapshot Testing, assertSnapshot() ViewController . .
import SnapshotTesting
import XCTest
class MyViewControllerTests: XCTestCase {
func testMyViewController() {
let vc = MyViewController()
assertSnapshot(matching: vc, as: .image)
}
}
, Swift . — diff: . . , , open source, , .
, . — XCTest Plan Fastlane. . -.
Exness : Exness Trading, , Social Trading, .
Crowdin . LinguanApp Exness Trading , , , . Social Trading. Fastlane . XCTest Plan . , Exness Trading Swift Snapshot Test Case, Social Trading — iOS Snapshot Test Case. , . Happy testing!
/ :
Fastlane:
https://agostini.tech/2018/07/15/automatic-screenshots-with-fastlane-snapshot/
https://docs.fastlane.tools/getting-started/ios/screenshots/
XCTestPlan:
https://shashikantjagtap.net/wwdc19-getting-started-with-test-plan-for-xctest/
https://developer.apple.com/videos/play/wwdc2019/403
https://developer.apple.com/videos/play/wwdc2019/413
swift-snapshot-testing:
https://github.com/pointfreeco/swift-snapshot-testing/
ios-snapshot-test-case:
https://github.com/uber/ios-snapshot-test-case/
Display Zoom:
http://www.iphonehacks.com/2014/09/use-display-zoom-iphone-6-plus.html