XCUITest - Guide

Quick Start:

Please refer to:

中文教程:

WWDC15 Session筆記 - Xcode 7 UI 測(cè)試初窺?

Official Guide:

Apple Official Guide—— UI Testing in Xcode

Blog&Articles:

UI Testing in Xcode 7

A Guide to XCode UI Test

Getting started with XCUITest framework for testing iOS apps.

Tips:

Suggested framework:

1.Long-run environment, define the configuration of the environment previously and make sure the testcase will recover the environment each time;

2.FrameWork Suggestion:


XCUI Framwork

Debug Related:

a. remember to add break-point at the end(or anywhere you want to pause) of your scripts when debugging, otherwise the log will be swept by the Application logs!

b. if you want to start recording from anywhere, just add a break-point before running the scripts, when the program paused you can then start recording from the point;

c.The debugging information will show you the sub-tree and how it is find by, it's very useful in defining the element.

General Issues:

1.no identitier, the sub-tree is changing frequently;

2.Testers exhausted to maintain the scripts;

3.framework bug梳毙;

4.The environment is not steady梧躺;

API :

Debugging Element Queries:

vardebugDescription: String

Provides debugging information about the query.

Creating New Queries:

func children(matching: XCUIElement.Type)

Returns a new query that matches all direct children of the requested type.

func descendants(matching: XCUIElement.Type)

Returns a new query that matches all descendants of the requested type.

func containing(NSPredicate)

Returns a new query that matches all elements containing a descendant that matches the provided predicate.

func containing(XCUIElement.Type,identifier: String?)

Returns a new query that matches all elements containing an element of the requested type, optionally also matching a specified identifier.

func matching(identifier: String)

Returns a new query that matches all elements with the provided identifier.

func matching(NSPredicate)

Returns a new query that matches all elements directly matching the provided predicate.

func matching(XCUIElement.Type,identifier: String?)

Returns a new query that matches all elements of the requested type, optionally also matching a specific identifier.

Accessing Matched Elements

var allElementsBoundByAccessibilityElement: [XCUIElement]

Immediately evaluates the query and returns an array of elements bound to the resulting accessibility elements.

var allElementsBoundByIndex: [XCUIElement]

Immediately evaluates the query and returns an array of elements bound by the index of each result.

var count: Int

Evaluates the query and returns the number of elements that match.

var element: XCUIElement

The query's single matching element.

func element(boundBy: Int)

An element that uses an index into the query's results to determine which underlying accessibility element to use.

func element(matching: NSPredicate)

An element that matches the predicate.

func element(matching: XCUIElement.Type,identifier: String?)

An element that matches the provided element type and identifier.

subscript(String)

Returns a descendant element matching the identifier specified bykey.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末哭懈,一起剝皮案震驚了整個(gè)濱河市砸狞,隨后出現(xiàn)的幾起案子敛助,更是在濱河造成了極大的恐慌叨粘,老刑警劉巖秒梅,帶你破解...
    沈念sama閱讀 216,997評(píng)論 6 502
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件旗芬,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡捆蜀,警方通過查閱死者的電腦和手機(jī)疮丛,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,603評(píng)論 3 392
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來漱办,“玉大人这刷,你說我怎么就攤上這事∶渚” “怎么了暇屋?”我有些...
    開封第一講書人閱讀 163,359評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)洞辣。 經(jīng)常有香客問我咐刨,道長(zhǎng),這世上最難降的妖魔是什么扬霜? 我笑而不...
    開封第一講書人閱讀 58,309評(píng)論 1 292
  • 正文 為了忘掉前任定鸟,我火速辦了婚禮,結(jié)果婚禮上著瓶,老公的妹妹穿的比我還像新娘联予。我一直安慰自己,他們只是感情好材原,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,346評(píng)論 6 390
  • 文/花漫 我一把揭開白布沸久。 她就那樣靜靜地躺著,像睡著了一般余蟹。 火紅的嫁衣襯著肌膚如雪卷胯。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,258評(píng)論 1 300
  • 那天威酒,我揣著相機(jī)與錄音窑睁,去河邊找鬼。 笑死葵孤,一個(gè)胖子當(dāng)著我的面吹牛担钮,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播佛呻,決...
    沈念sama閱讀 40,122評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼裳朋,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起鲤嫡,我...
    開封第一講書人閱讀 38,970評(píng)論 0 275
  • 序言:老撾萬榮一對(duì)情侶失蹤送挑,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后暖眼,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體收苏,經(jīng)...
    沈念sama閱讀 45,403評(píng)論 1 313
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡瘾杭,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,596評(píng)論 3 334
  • 正文 我和宋清朗相戀三年坡脐,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了卢佣。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,769評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡栋豫,死狀恐怖挤安,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情丧鸯,我是刑警寧澤蛤铜,帶...
    沈念sama閱讀 35,464評(píng)論 5 344
  • 正文 年R本政府宣布,位于F島的核電站丛肢,受9級(jí)特大地震影響围肥,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜蜂怎,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,075評(píng)論 3 327
  • 文/蒙蒙 一穆刻、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧杠步,春花似錦氢伟、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,705評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至试躏,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間设褐,已是汗流浹背颠蕴。 一陣腳步聲響...
    開封第一講書人閱讀 32,848評(píng)論 1 269
  • 我被黑心中介騙來泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留助析,地道東北人犀被。 一個(gè)月前我還...
    沈念sama閱讀 47,831評(píng)論 2 370
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像外冀,于是被迫代替她去往敵國(guó)和親寡键。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,678評(píng)論 2 354

推薦閱讀更多精彩內(nèi)容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 9,489評(píng)論 0 23
  • 每一個(gè)人的一生都有精彩的時(shí)刻雪隧,哪怕是個(gè)乞丐或流浪漢西轩。俗話說“莫欺少年窮”员舵,可能遇到一時(shí)的困難或坎坷,只要努力去消除...
    紅塵浪浪閱讀 173評(píng)論 0 0
  • 概要 通過偶然的機(jī)會(huì)得知了7-11日本創(chuàng)始人鈴木敏文的這兩本書. 買來以后, 斷斷續(xù)續(xù)用一個(gè)月的時(shí)間讀完了. 這兩...
    每天多一點(diǎn)閱讀 344評(píng)論 0 2
  • 今天真的有點(diǎn)小忙藕畔,從早上上班就開始忙马僻,一直到剛剛結(jié)束到家。工作中擠出的一點(diǎn)點(diǎn)時(shí)間看了一下英語注服,如果是用來寫作的話...
    snailwww閱讀 120評(píng)論 0 2
  • 3-24 【儀封人請(qǐng)見韭邓。曰:君子之至于斯也,吾未嘗不得見也溶弟。從者見之女淑。出曰:二三子,何患于喪乎辜御?天下之無道也久矣鸭你,...
    空空的山谷閱讀 442評(píng)論 0 0