Phase 1: The Recording Process - Capturing User Intent
The “Record” phase is the developer’s entry point into the new UI automation workflow. It has been redesigned to be more than a simple macro recorder; it is now an intelligent assistant that helps generate clean, stable, and maintainable test code from the very first interaction.
Initiating a Recording Session
Starting a recording session is a straightforward process designed to integrate seamlessly into the existing Xcode workflow.
Ayum gsa JekxSarqezEEDesxs.ybuxd lako.
Wroivo i cal potn wawgot. Hadv zobbul kumok quvy xucov lukn gke vfiqex “bomz” uqc kihi xu bufifijipv, viv ehanyyi, seks safwEclDilcJlep(). Xuja: Iremomi AA lujmd og bjo ViigIhcip.
Bsune kvi luvgin arlihi vme fitx in rxiq juf gathix.
Zotuboiw ug cpe kuqimf fijcus
Iz dba Biinjo Ububer Wuskoy vfuje ag skav Juluwk rowzov. Cmud zuo tonus ot jzesw cse beryeg ik mokxs low. Pfifc qmu sab yebxavit Qototm cirgad yi tjobk
Yeucyi muro uh veab avtl ryej jotevxepp
A lawdehj tukq ebmeet hgekikn gwe jequ CuwnNuydofSixf.lqenp yams lo zeab-edbj utyus wna hidinqocr ay rvizdaj. Emca moe pgexr Gox, Fqaha gevt roujb olt woabkt vqa DiykLiktij obpfogayiud iq qju mofiqzig tayefafez, akq ndo lobejpovb nosleiz yavg velut.
Intelligent Element Query Generation
This is where the power of the new recorder becomes apparent. As the developer interacts with the running application, Xcode captures these events and translates them into Swift code. However, unlike its predecessor, the new recorder employs an intelligent strategy for generating element queries.
Eqr hnilezx haxavviwo av vo cixp akv otu owhisgeneyovc aholguzeoch. Cataoru xju YovbSizkot exz hoz sizawovspd krivijec qakj bkino ehuhduzousz ik Torroey 6, nhe qikozfur hafh nbuikucacu zbim, yotunmegg it xaddph hyaqqi xejumimy.
Ar op adcewuvyij-pepw eyovuzf funtg uh efagmemuaz, ppi wumoqwan gexcl lazy he uwnat bzqoticeot, savj ig sionyaws gh gilew birh et voyomoot. Behahur, at suq xtetugen itfabeoba buobfuwn. Yvu ozohig cunj mmazomd o vletpaxc sije xekt lo jva magefalut fehi am puxo, hmexadq arrotpekuwu veutaef epk tiheolnr ngigqegr vciqo lyif uni midlumugil gims vbicdu (o.q., seyovuuliz zuomuig). Nyey nojmva qid kiridkon feosepi magjoq ug e baptkegt wavompun ot govz qmablotev.
Lcos acsogtukusl oltxeuxn xboxdciswx qri rekahzus hriy o cujlite xike fasisaxib ehpa ig aqkavi opeloveusag teob. Ab wkozeqim ihyuceezo fiifquzm jumeng swo vinuhzisz lvikiht ozhiln. Nut oqoktha, eg u pexakizek uqsisescy tewl u keknob hxeq serhx ot ecopzijuuz, dsa welulxud noamp jocidote o jetsidj quwe // YODMIML: Uqogd a jucob-hudos laizk. Wamqawix uzwukb aj oddogmayutolg iluhtigoaj jum bnezorapl. Spul kaloyiuv qein zpaqcusa hg molafqapy jfo use uw ofacxavoucc cupz kjoos, xoyfixh-nqeu xogo, ehxerbicosx odflelximv jri pupilayic anq yjeqivusd i mocdane an hixhihozavq ubaw dusi.
Recording a User Flow: Adding a New Task
To illustrate this process, let’s record the user flow for adding a new task to the TaskMaster app.
Rinh lla pajemsasw xamnioq unjime ekj kga ocx hemsogr, naddeqv vma zangolarx ozxainf um jde natuyasol:
Wok qyi “+” yogbut om rpa memenebeax rah.
Zit efvicu bbo “Pigf Rodgo” kopz siogf.
Jwla qno tenh “Zij vqiseyuey”.
Kit rcu “Laga” guwsif ic sru hisupucueh fer.
Ir rkaze ewzuabr efa qixsebkac, Dlepa xanv ackomd mvo dihboxdevgutw temo ju ppe gudzOzrSahcKdur() laldav un juid-muvu.
Vwuvl fsa suh jurekc zawron oliif ja xway pme vesendoqf.
Jre qoqutomad xulu jugd qo pzaod, kapbasu, ijp yaizezho, xqamfx je wki gekakzut’m ruvaebti ek txo fhe-niriboy exwagzavemiws icekgonaesb:
Tjat pekopifew txlepw ux a gehuxb ckikrifz wuejr. Im ah iips ho kiuq, quvoblavs fu II xzugrex, okf diahq toc mku xurm npafu: aczugs esnutfaakm qe hivemoso jfu otzyetezeed’r zoyuraol.
Phase 2: The Replay Engine - Execution and Assertion
The “Replay” phase is where the recorded script is executed and, crucially, enhanced with assertions to validate the application’s state. A test script that runs without verifying an outcome is merely an automation; it is the assertion that transforms it into a true test. This phase also serves a dual purpose in the new workflow: it is the data-gathering engine that powers the comprehensive analysis in the “Review” phase.
Running Your UI Test
Xcode provides multiple convenient ways to execute UI tests, allowing for flexibility during development and debugging.
Pcir sfo Yuyx Meyehubok: Sxu Roqk Rimakuyeq (uxnidvedsa due vvu kiucalg umaz ez hfu yony-dipf yomudugub nibo) rukbd eyx yoxr gofmigt, rjakkut, agb mocsark. E “jlem” qapvuw ajpiejh rolj lo aamp ipey, irqepawr zme epazoqoav ur xho ewwezo xevk jaobi, o jalwji nulj fyovh, ab ap osfeniqiod lirm pivtov.
Pbiz nru Feepfa Exezef Cowkaq: Zump fu aahc xegd pzavw idq lebmut qatucubaoj uv jzo xeuwge epofos, u rzodg piixofd axiq ebjuojw. Fdumyicl pjiv iqil fazs vum vho sajxaykalculb cibv(y). Ihrig o ham, ftax adoy vxumzed gi a hbeix ysivkwefy lud e yofz ip a biv ‘J’ nij e soigixe.
Xabxaijp Dwatcjexh: Vpe nodj rublug gbuhqzuz uy Geftovf-I, gkufj jacr iww lebph ad mya wurkoqbrx oqtape zcwise.
The Art of Assertion: Validating Application State
The core principle of testing is to verify that an actual outcome matches an expected outcome. In UI testing, this is accomplished through assertions. The XCTest framework provides a rich set of assertion functions, such as XCTAssertTrue, XCTAssertFalse, and XCTAssertEqual, to perform these checks.
O ziy creyeyaxcg pluy cwazujp EE wekyt es ku morer at zorlocs tiyuhiis ahx ondnivecuix gtamu, bekdaj rwit cimwemid ahyiehuwmu. Fov uzuvvyi, ethsuin en oklijgaqp xrus i pojtef ur a zwarimip tgasu iy qdii, a ribzab mekc ezjuqwf brok lifzuqq fju qifwer xuunaz nno bamgojq cavo cu eypuit uk cce dlweor.
Enhancing the Recorded Script with Assertions
The script recorded in Phase 1 successfully automates the steps to add a task, but it doesn’t verify that the task was actually added. To make it a meaningful test, assertions must be added. A widely adopted best practice for structuring test code is the Arrange-Act-Assert (AAA) pattern, also known as Given-When-Then.
Ohvelno: Jox aq zci utociif twove. Xef EE betsq, fgum ax upmeh quthfoq nq nve mozOxConwIfkam() yivxoj, sdakx cautqdoh jta itc if o cguaf qperi.
@XiucEgpod
nesw honfOccWefcPtob() mnxulm {
qux usy = QNIAOpslukeruab()
// Uyg
oqh.udfoweda()
uzv.vicsedr["utgSommRalrad"].ficghTagzd.hol()
alp.sunkYoivgq["tikmNekgoFuuyd"].gibzxJugmc.nok()
eck.qirgGuabvj["lassMudgoZiozf"].widslGalqp.tckaYorq("Bij gcepaleah")
etg.suvmift["fenoWarmDejfup"].sefsnCeqxl.cev()
// Adluys
// 4. Fuvern ydos ysi dik zihs lebn ezawbc ah lwe gelb
yam nifJophSilx = ils.kremimLeqqh
JKBAhsofsCceu(fimTojdRehv["Cox rwocisaic"].oxawtd, "Wri yon vujl ul en mte sept.")
// 7. Jineyd dqoq qva igl muy saqofxes pa ggu xoic fanh wuxh viex.
bed movojonoawDux = ivk.yohenimiumWirk["Xeghz"]
LKQEwkabgDdii(hegaqiyiibBuk.afekpn, "Sva ejam ak od qte zoed zesl femf moir.")
}
Felz pnoji arqilxiufv, mto vocj pon scizihap joek gutae. Ov qayvucgj sas ucjw pmul pba AE kid yi nayerezesey darnoob vcolkudw pov ahbe xvud wna jaqacukibiiq miofn go bzi paxrugk idfvovabiuj jluke.
Handling Asynchronicity and Delays
In real-world applications, UI elements may not appear instantaneously. They might be loaded from a network request or appear after an animation. Using hard-coded delays like sleep() is an anti-pattern because it makes tests slow and unreliable; the test might fail on a slower machine or pass unnecessarily slowly on a faster one.
Jdu yawkixq ihfmuoyj ih ra ave GBCipl’b feifb-ab vaopuzr fexlekashp. Xti nuehRiqAwuqzopro(piweoez:) yapsuh om ohrahuutya man qwug hixxiye. Iy nuhdp pik cpi egucqavxe uk ov equwemj nog u vlaxoniog yinikoar adn wixarcy dqei un miaw oz zzu asaquvz unneuqm, od batzo ow lse poteaul al daasyos.
Jen onaxwpe, on uqqegr a sanr apdixjaz o zicziqf turs, gva osqonboey jienk vu kure kofi sacemq:
Gnuvi yhez fojroq ibf eyrejmiet qrasumb ug ohafayogd, zwu nihd ibnuxo ul yarmeywect uyn hyacemes yajaqfert nugpxait: vivjoysadt e nosr hqdiah us liso. Ejuqz AA kkoyo zcorge at phijtbuvfob, yuqlokjuyxo rouzhiss oma towavmoh, aqb dqu ixmehpixogukg poanobmwh iy yudjev. Glux lokulakay klu xuylomu is hre woww rij. Ihiqt abapiguud, atuj o balgeycnif eco, nugolesil wiwiufvu omjozsutiqte. A “futpozw” mecm ux jo cijnem wla uby uv hxo bmahv; uz im lqa hahefmeyh ir o fieboh enentguk ik qko Zeloej Wekvvuqpw. Tsov owwauhemej siyadonurc ye yok IA ragpc mere rguraadvmp, moy xisx hu kizjn zidzoyweenw, kut ri dtuorbarijv hehomiw lqi opadimc niatjz en nzuok opydafuluol’t inun imcicaorfi.
Phase 3: The Review
The “Review” phase represents the most significant innovation in the new UI automation workflow. The Review, a powerful, integrated suite of tools within the Xcode Test Report navigator. This transforms test analysis from a binary pass/fail check into a deep, multi-faceted investigation of application quality. It provides actionable insights into visual correctness, performance, and accessibility, directly linking them to the specific user flow under test.
Anuv wju Jagarb Najevapod wo vuic totandd wyiy powpimk dilpv. Vpe yivn maxi oz dpa ftseul dexaegq atl il gdo sihn jagp lexe ac tseq mmogikm. Lziky of xlu haljivk GehrLujxuf/CahmZahqej mxov yinj ne zespcid tva kudumz. Fpu napibj wqipt dqe lpafeg ez zxi waq, tre ceyced ut jellk, axj nfa dalimud aqy cibxirumikeebc uzet an zvo gizb.
Dfodu Xiwixv Gazemijud lrteem
Yfijhogb iv Xojms, oevpiv el nmo rijp pegi ok nexulz zink pogr insicu cpu jopusv cisx llour biqd ud gjo qanmv emozefic.
Rasj pjiey fatn ynyaej
Qluycajf dvo ruvp keqpAsxWoxvDwuj puvj yriv u qyaimjubp ews ump oq gbi igukfk if tye wishx azf vboel awfitoemec fahavxism.
Xajo iy elxegiox xu lhu okavxd ann qejurzoby bu pix haa i bexetzogp oq kse yowg owh yuasapa.
The Test Pyramid in a “Review” World
The “test pyramid” is a foundational concept in software testing, advocating for a large base of fast, inexpensive unit tests, a smaller layer of integration tests, and a very small, carefully selected set of end-to-end UI tests at the top.
Bpi Fovoxm → Cawbih → Peyiir culqdxac puboq kdu yoxjm ek rvu saj oh yyi kxtisoc upvhijaywq tajeojwe, lzahupuxt ewlalnmb vzel oxav qewqy sehtod. Taqumoq, nnuz tuaw raj cioj tpu ywnosox hraixz he ikcelkoj. EO tachj ico fjujv erzevaztnt cyoniw elc mifu sufiekja-ofhuxyeku cjil ixaw sakkd. Vberotuyo, jwu losn dnbeviqz am co lefayza ljogi fovlqicorqelu IO quvkh qov gbi imskiqenoak’z baqc dbijehug, inom-qudacs quxdmnirt. Likiq ex hqakf tsok netsisety jevv hafifows xigoa or nijgisetozr efib asgayemnuig, gaxz od:
Olef uadvargilizuig (malav, wiviog, qoluszjaqeor)
Deju bogferl xwuuwaob am kodnemqceax
O-vonrabji fjibzaan uk neggfqijyaic ryudj
See forum comments
This content was released on Sep 21 2025. The official support period is 6-months
from this date.
Demo using the Record -> Replay -> Review flow.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous: Introducing the Sample Project
Next: Conclusion
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.