Home
%3CLINGO-SUB%20id%3D%22lingo-sub-829173%22%20slang%3D%22en-US%22%3EUI%20testing%20for%20Windows%20apps%20with%20WinAppDriver%20and%20Appium%20-%20Azure%20DevOps%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-829173%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FWindows-Dev-AppConsult%2FUI-testing-for-Windows-apps-with-WinAppDriver-and-Appium%2Fba-p%2F825352%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3EIn%20the%20previous%20post%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewe%20have%20learned%20how%2C%20thanks%20to%20WinAppDriver%20and%20Appium%2C%20we%20can%20perform%20UI%20testing%20against%20our%20Windows%20applications.%20In%20that%20post%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fqmatteoq%2FWpfUiTesting%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ewe%20have%20created%20a%20sample%20WPF%20app%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20then%20we%20have%20tested%20some%20basic%20user%20interactions%2C%20using%20the%20local%20WinAppDriver%20service%20running%20on%20our%20machine.%20However%2C%20the%20most%20interesting%20scenario%20is%20automating%20these%20tests%20so%20that%2C%20in%20the%20context%20of%20a%20CI%2FCD%20pipeline%2C%20they%20can%20be%20automatically%20executed%20every%20time%20we%20commit%20new%20code%20to%20our%20repository.%20The%20recently%20announced%20integration%20with%20Azure%20DevOps%20makes%20the%20task%20easier%20to%20implement%2C%20since%20the%20WinAppDriver%20service%20is%20already%20up%20%26amp%3B%20running%20on%20every%20Windows%20hosted%20agent.%20However%2C%20you%20may%20find%20some%20challenges%20in%20implementing%20the%20workflow%20since%20UI%20testing%20is%20quite%20different%20from%20unit%20testing%20and%20it%20has%20different%20requirements.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHopefully%2C%20this%20blog%20post%20will%20help%20you%20walking%20through%20the%20implementation%20of%20UI%20Testing%20for%20Windows%20on%20Azure%20DevOps.%20Lets'%20start!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22the-basics-of-ci--cd-for-msix%22%20id%3D%22toc-hId-1621958896%22%20id%3D%22toc-hId-1621958896%22%3EThe%20basics%20of%20CI%20%2F%20CD%20for%20MSIX%3C%2FH3%3E%0A%3CP%3EThis%20post%20isn't%20meant%20to%20be%20a%20comprehensive%20guide%20about%20Azure%20DevOps%20for%20Windows%20applications.%20If%20you%20want%20to%20understand%20in%20details%20some%20of%20the%20concepts%20that%20we%20will%20implement%20in%20this%20blog%20post%2C%20a%20good%20starting%20point%20is%20the%20workshop%20that%20my%20team%20delivered%20at%20BUILD%20about%20moving%20Windows%20app%20forward%2C%20which%20is%20available%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2FAppConsult-WinAppsModernizationWorkshop%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20Specifically%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2FAppConsult-WinAppsModernizationWorkshop%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EExercise%205%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewill%20guide%20you%20through%20packaging%20an%20application%20with%20MSIX%20and%20implement%20a%20CI%2FCD%20pipeline%20on%20Azure%20DevOps%20to%20automatically%20build%20and%20deploy%20the%20MSIX%20package%20every%20time%20you%20commit%20some%20new%20code%20to%20the%20repository.%20Another%20great%20resource%20is%20the%20session%20that%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2Fridomin%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3ERicardo%20Minguez%20Pablos%3C%2FA%3E%2C%20PM%20at%20Microsoft%2C%20and%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftwitter.com%2Fonovotny%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EOren%20Novotny%3C%2FA%3E%2C%20Microsoft%20MVP%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fmybuild.techcommunity.microsoft.com%2Fsessions%2F77012%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Edelivered%20at%20BUILD%202019%3C%2FA%3E.%20Here%20are%20some%20important%20concepts%20that%20we%20will%20use%20through%20the%20post.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20CI%2FCD%20workflow%20is%20typically%20implemented%20using%20two%20different%20pipelines%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-12%22%3E%0A%3CLI%20id%3D%22pragma-line-12%22%3EA%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ebuild%20pipeline%3C%2FSTRONG%3E%2C%20which%20takes%20care%20of%20taking%20the%20source%20code%20of%20the%20project%20and%20building%20it.%20In%20the%20context%20of%20MSIX%20packaging%2C%20the%20build%20pipeline%20takes%20care%20of%20compiling%20our%20Windows%20application%20and%20creating%20a%20MSIX%20package%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-13%22%3EA%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Erelease%20pipeline%3C%2FSTRONG%3E%2C%20which%20takes%20care%20of%20taking%20the%20output%20of%20the%20build%20process%2C%20configure%20it%20and%20deploy%20it%20on%20one%20ore%20more%20environments%20(testing%2C%20production%2C%20etc.).%20In%20the%20context%20of%20MSIX%20packaging%2C%20the%20release%20pipeline%20has%20the%20responsibility%20of%20signing%20the%20package%20and%20then%20deploying%20it%20using%20one%20of%20the%20many%20supported%20approaches%3A%20you%20can%20publish%20to%20the%20Microsoft%20Store%2C%20you%20can%20leverage%20Visual%20Studio%20App%20Center%20for%20testing%2C%20you%20can%20deploy%20on%20a%20website%2C%20etc.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20signing%20operation%20is%20a%20very%20delicate%20one%20in%20this%20process%20and%20the%20separation%20of%20concerns%20between%20the%20build%20and%20the%20release%20pipeline%20is%20very%20important%20to%20prevent%20identity%20theft%20and%20malicious%20usages%20of%20our%20certificate%2C%20especially%20if%20we're%20signing%20the%20application%20with%20a%20public%20or%20an%20enterprise%20certificate.%20Why%20is%20that%3F%20Visual%20Studio%20supports%20signing%20a%20package%20as%20part%20of%20the%20MSIX%20generation%20process%2C%20so%20we%20might%20be%20tempted%20to%20use%20this%20approach%20to%20make%20things%20simpler%20and%20do%20everything%20in%20the%20build%20pipeline.%20However%2C%20in%20order%20to%20do%20that%2C%20we%20would%20need%20to%20make%20the%20certificate%20available%20to%20the%20build%20process%2C%20which%20means%20committing%20it%20to%20our%20repository%20together%20with%20the%20source%20code.%20This%20is%20a%20bad%20practice%2C%20especially%20if%20you're%20working%20as%20part%20of%20a%20team.%20This%20means%20that%20every%20developer%20who%20is%20working%20on%20the%20application%20will%20have%20the%20chance%20to%20get%20the%20certificate%20and%20use%20it%20to%20sign%20other%20applications%2C%20even%20malicious%20ones%2C%20leading%20to%20an%20identity%20theft.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22the-challenges-with-ui-testing%22%20id%3D%22toc-hId--930198065%22%20id%3D%22toc-hId--930198065%22%3EThe%20challenges%20with%20UI%20testing%3C%2FH3%3E%0A%3CP%3EWhen%20you%20start%20to%20think%20about%20implementing%20UI%20testing%20as%20part%20of%20your%20CI%2FCD%20pipeline%20for%20MSIX%2C%20you%20face%20some%20challenges%20compared%20to%20a%20traditional%20testing%20scenario.%20Typically%20unit%20testing%20is%20included%20as%20part%20of%20the%20build%20pipeline%2C%20since%20tests%20are%20executed%20against%20the%20code%20of%20your%20application.%20However%2C%20a%20MSIX%20package%20can't%20be%20deployed%20without%20being%20signed%20and%2C%20based%20on%20what%20we%20have%20just%20learned%2C%20we%20can't%20do%20the%20signing%20operation%20in%20the%20build%20pipeline.%3C%2FP%3E%0A%3CP%3EAs%20such%2C%20we%20need%20to%20change%20a%20bit%20the%20architecture%20we%20have%20seen%20and%20split%20the%20release%20pipeline%20into%202%20different%20stages%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-22%22%3E%0A%3CLI%20id%3D%22pragma-line-22%22%3EA%20stage%20for%20the%20UI%20testing.%20This%20stage%20will%20take%20care%20of%20downloading%20the%20MSIX%20package%20produced%20by%20the%20build%20pipeline%2C%20sign%20it%2C%20install%20it%20on%20the%20hosted%20agent%20and%20then%20run%20the%20UI%20tests%20we%20have%20built%20using%20WinAppDriver.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-23%22%3EA%20stage%20for%20the%20actually%20deploy.%20This%20stage%20will%20take%20care%20of%20deploying%20the%20signed%20MSIX%20package%20to%20whatever%20platform%20we%20want%20to%20use%20for%20distribution.%20This%20stage%20will%20be%20executed%20only%20if%20the%20previous%20one%20has%20completed%20successfully.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EIn%20this%20blog%20post%20we're%20going%20to%20build%20all%20the%20components%20which%20make%20this%20architecture%20possible.%20I%20will%20assume%20that%20you%20already%20have%20an%20Azure%20DevOps%20account.%20If%20not%2C%20you%20can%20create%20one%20for%20free%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-in%2Fservices%2Fdevops%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethe%20official%20website%3C%2FA%3E.%20Don't%20worry!%20Despite%20the%20platform%20contains%20%22Azure%22%20in%20the%20name%2C%20it%20isn't%20directly%20tight%20to%20an%20Azure%20subscription.%20You%20can%20create%20a%20free%20account%20even%20without%20owning%20an%20Azure%20subscription%20or%20having%20to%20provide%20a%20credit%20card.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20start!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22the-build-pipeline%22%20id%3D%22toc-hId-812612270%22%20id%3D%22toc-hId-812612270%22%3EThe%20build%20pipeline%3C%2FH3%3E%0A%3CP%3ELet's%20start%20to%20create%20the%20build%20pipeline.%20Once%20you're%20in%20your%20project%20on%20Azure%20DevOps%2C%20move%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPipelines%20%E2%86%92%20Builds%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20and%20choose%20the%20option%20to%20create%20a%20new%20one.%20As%20first%20step%2C%20you%20will%20have%20to%20choose%20the%20repository%20where%20your%20code%20is%20hosted.%20This%20is%20the%20repository%20which%20contains%20our%20whole%20solution%2C%20which%20includes%20both%20the%20WPF%20application%20and%20the%20tests.%20It's%20the%20one%20we%20have%20built%20on%20the%20previous%20post%2C%20which%20is%20available%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fqmatteoq%2FWpfUiTesting%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efor%20your%20reference.%20Then%20you%20will%20be%20asked%20to%20choose%20a%20starting%20template.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20629px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129090iCDD59729C6C4010A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22pipelinetemplate.png%22%20title%3D%22pipelinetemplate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20best%20one%20for%20our%20scenario%20is%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EUniversal%20Windows%20Platform%3C%2FSTRONG%3E%2C%20since%20it%20will%20contain%20all%20the%20steps%20to%20create%20a%20MSIX%20package%2C%20regardless%20if%20it's%20a%20pure%20UWP%20app%20or%20a%20Win32%20app%20packaged%20with%20the%20Windows%20Application%20Packaging%20Project%2C%20like%20our%20scenario.%20The%20option%20will%20create%20a%20template%20based%20on%20YAML%2C%20which%20is%20a%20markup%20language%20used%20to%20enable%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EInfrastructure%20as%20code%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eapproach%2C%20where%20the%20pipeline%20is%20created%20through%20a%20definition%20file%20rather%20than%20manual%20processes.%20This%20way%2C%20the%20definition%20of%20the%20pipeline%20can%20be%20treated%20like%20any%20other%20file%20of%20the%20project%2C%20included%20in%20the%20repository%20and%20evolve%20with%20your%20code%20as%20the%20requirements%20change.%20This%20is%20how%20the%20template%20looks%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-39%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-comment%22%3E%23%20Universal%20Windows%20Platform%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-comment%22%3E%23%20Build%20a%20Universal%20Windows%20Platform%20project%20using%20Visual%20Studio.%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-comment%22%3E%23%20Add%20steps%20that%20test%20and%20distribute%20an%20app%2C%20save%20build%20artifacts%2C%20and%20more%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-comment%22%3E%23%20https%3A%2F%2Faka.ms%2Fyaml%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Etrigger%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-bullet%22%3E-%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Emaster%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Epool%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20vmImage%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'windows-latest'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Evariables%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20solution%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'**%2F*.sln'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20buildPlatform%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'x86%7Cx64%7CARM'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20buildConfiguration%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Release'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20appxPackageDir%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(build.artifactStagingDirectory)%5CAppxPackages%5C%5C'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Esteps%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3ENuGetToolInstaller%401%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3ENuGetCommand%402%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20restoreSolution%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(solution)'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EVSBuild%401%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20platform%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'x86'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20solution%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(solution)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20configuration%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(buildConfiguration)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20msbuildArgs%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%2Fp%3AAppxBundlePlatforms%3D%22%24(buildPlatform)%22%20%2Fp%3AAppxPackageDir%3D%22%24(appxPackageDir)%22%20%2Fp%3AAppxBundle%3DAlways%20%2Fp%3AUapAppxPackageBuildMode%3DStoreUpload'%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20template%20is%20a%20good%20starting%20point%2C%20but%20it%20lacks%20some%20important%20tasks%2C%20like%20publishing%20the%20actual%20output%20(the%20MSIX%20package)%20so%20that%20it%20can%20be%20picked%20up%20by%20the%20release%20pipeline.%3C%2FP%3E%0A%3CP%3ELet's%20do%20a%20few%20tweaks%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-76%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3Etrigger%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-bullet%22%3E-%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Emaster%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Epool%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20vmImage%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'windows-latest'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Evariables%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20buildPlatform%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'x86'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20buildConfiguration%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Release'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20appxPackageDir%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(build.artifactStagingDirectory)%5CAppxPackages%5C%5C'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Esteps%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EVSBuild%401%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20platform%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(buildPlatform)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20solution%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'**%2F*.sln'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20configuration%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(buildConfiguration)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20msbuildArgs%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%2Frestore%20%2Fp%3AAppxBundlePlatforms%3D%22%24(buildPlatform)%22%20%2Fp%3AAppxPackageDir%3D%22%24(appxPackageDir)%22%20%2Fp%3AAppxBundle%3DAlways%20%2Fp%3AUapAppxPackageBuildMode%3DSideloadOnly%20%2Fp%3AAppxPackageSigningEnabled%3Dfalse'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EPublishBuildArtifacts%401%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20displayName%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Publish%20artifact%3A%20drop'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20PathtoPublish%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(appxPackageDir)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20condition%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EsucceededOrFailed()%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EHere%20is%20the%20list%20of%20changes%20we%20have%20done%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20id%3D%22pragma-line-104%22%3E%0A%3CLI%20id%3D%22pragma-line-104%22%3EWe%20have%20reduced%20the%20number%20of%20supported%20build%20platforms%2C%20since%20some%20of%20the%20default%20ones%20aren't%20suitable%20for%20a%20WPF%20application%2C%20like%20ARM.%20As%20such%2C%20we%20have%20set%20the%20variable%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EbuildPlatform%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20x86%20only.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-105%22%3EWe%20have%20removed%20the%20tasks%20to%20install%20NuGet%20and%20restore%20the%20packages.%20A%20separate%20task%2C%20in%20fact%2C%20isn't%20needed%20anymore%2C%20since%20Visual%20Studio%20can%20do%20it%20on%20its%20own.%20We%20just%20have%20to%20add%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%2Frestore%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eparameter%20to%20the%20build%20arguments%2C%20which%20are%20specified%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EmsbuildArgs%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eproperty%20of%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EVSBuild%401%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etask.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-106%22%3EIn%20my%20scenario%2C%20I'm%20planning%20to%20deploy%20the%20application%20on%20an%20Azure%20website%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fmsix%2Fapp-installer%2Fapp-installer-root%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EApp%20Installer%20technology%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Einstead%20of%20using%20the%20Microsoft%20Store.%20As%20such%2C%20I've%20set%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%2Fp%3AUapAppxPackageBuildMode%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eparameter%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESideloadOnly%3C%2FSTRONG%3E.%20This%20way%2C%20Visual%20Studio%20will%20generate%20only%20the%20.msix%20%2F%20.msixbundle%20files%20and%20not%20the%20.msixupload%20one%2C%20which%20is%20only%20for%20the%20Store.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-107%22%3EWe've%20set%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%2Fp%3AAppxPackageSigningEnabled%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eparameter%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Efalse%3C%2FSTRONG%3E%2C%20since%20we%20don't%20want%20to%20do%20the%20signing%20as%20part%20of%20the%20build%20process.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-108%22%3EWe've%20added%20a%20task%20to%20publish%20the%20artifacts%20(the%20MSIX%20package)%20in%20a%20folder%20hosted%20on%20Azure%20DevOps%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Edrop%3C%2FSTRONG%3E.%20This%20way%2C%20the%20release%20pipeline%20will%20be%20able%20to%20pick%20the%20generated%20MSIX%20package.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EHowever%2C%20it%20isn't%20enough.%20We%20need%20to%20do%20a%20few%20additional%20things%20to%20properly%20support%20the%20MSIX%20%2F%20UI%20testing%20scenario.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22setting-the-msix-package-version%22%20id%3D%22toc-hId--1936058196%22%20id%3D%22toc-hId--1936058196%22%3ESetting%20the%20MSIX%20package%20version%3C%2FH4%3E%0A%3CP%3EWhen%20you%20build%20a%20MSIX%20package%20using%20a%20CI%2FCD%20approach%2C%20an%20important%20requirement%20is%20to%20update%20the%20version%20number%20in%20the%20manifest%20every%20time%20a%20new%20package%20is%20created.%20If%20you%20rely%20on%20a%20manual%20approach%20(eg%3A%20changing%20the%20version%20in%20the%20manifest%20before%20committing%20the%20new%20code)%20you%20open%20the%20door%20to%20many%20potential%20problems.%20It's%20enough%20to%20forget%20to%20change%20the%20version%20to%20trigger%20the%20release%20of%20a%20new%20package%20with%20the%20same%20version%20number%20as%20the%20previous%20one%2C%20breaking%20the%20update%20chain.%20The%20easiest%20way%20to%20do%20it%20is%20by%20leveraging%20a%203rd%20party%20extension%20available%20on%20the%20Azure%20DevOps%20Marketplace%2C%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3DrichardfennellBM.BM-VSTS-Versioning-Task%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EManifest%20Versioning%20Build%20Tasks%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eby%20Richard%20Fennel.%20Once%20you%20have%20installed%20it%20on%20your%20Azure%20DevOps%20account%2C%20you%20can%20just%20add%20the%20following%20step%20in%20the%20YAML%20before%20the%20one%20which%20performs%20the%20build%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-116%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EVersionAPPX%402%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20displayName%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Version%20MSIX'%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EHowever%20this%20isn't%20enough.%20This%20task%2C%20in%20fact%2C%20takes%20care%20of%20setting%20a%20version%20number%20based%20on%20the%20build%20number%20generated%20by%20Azure%20DevOps%20which%2C%20by%20default%2C%20has%20the%20following%20syntax%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-123%22%20class%3D%22language-text%20hljs%22%3E%24(date%3AyyyyMMdd)%24(rev%3A.r)%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20expression%20is%20translated%20with%20a%20number%20like%2020190205.1.%20The%20problem%20is%20that%20this%20syntax%20isn't%20suitable%20for%20a%20MSIX%20package%2C%20since%20the%20manifest%20requires%20a%20version%20number%20with%20the%20expression%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ex.y.z.0%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(for%20example%2C%201.2.5.0).%20As%20such%2C%20we%20need%20to%20change%20the%20default%20version%20number%2C%20by%20adding%20the%20following%20entry%20before%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Esteps%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20of%20the%20YAML%20file%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-129%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3Ename%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%24(date%3Ayyyy).%24(Month)%24(rev%3A.r).0%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThis%20way%2C%20at%20every%20build%2C%20Azure%20DevOps%20will%20generate%20a%20build%20number%20like%202019.2.1.0%2C%20which%20is%20perfect%20for%20MSIX%20versioning.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22publish-the-tests-library%22%20id%3D%22toc-hId--193247861%22%20id%3D%22toc-hId--193247861%22%3EPublish%20the%20tests%20library%3C%2FH4%3E%0A%3CP%3EThe%20changes%20we%20have%20made%20so%20far%20would%20have%20been%20required%20by%20any%20CI%2FCD%20implementation%20for%20MSIX.%20The%20following%20one%2C%20instead%2C%20is%20specific%20to%20our%20scenario%2C%20where%20the%20solution%20contains%20also%20UI%20tests.%20When%20we%20move%20the%20testing%20session%20from%20the%20build%20pipeline%20to%20the%20release%20pipeline%2C%20we%20hit%20an%20issue.%20In%20order%20to%20run%20the%20tests%2C%20we%20need%20to%20compile%20the%20project%20which%20contains%20the%20tests%2C%20so%20that%20we%20can%20get%20a%20DLL%20which%20contains%20our%20test%20class.%20However%2C%20since%20we%20are%20in%20the%20release%20pipeline%2C%20we%20don't%20have%20access%20anymore%20to%20the%20source%20code%20of%20the%20project%2C%20but%20only%20to%20the%20artifacts%20published%20by%20the%20build%20pipeline.%20As%20such%2C%20other%20than%20publishing%20the%20MSIX%20package%20as%20an%20artifact%2C%20we%20need%20also%20to%20publish%20the%20DLL%20which%20contains%20our%20test%20suite%20so%20that%20the%20test%20runner%20can%20pick%20it.%3C%2FP%3E%0A%3CP%3ETo%20do%20this%2C%20we%20can%20add%2C%20as%20final%20step%2C%20another%20task%20to%20publish%20a%20build%20artifact%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-141%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EPublishBuildArtifacts%401%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20PathtoPublish%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'WpfUiTesting.Tests%5Cbin%5CRelease%5C'%0A%20%20%20%20ArtifactName%3A%20'%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3Etests'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20condition%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EsucceededOrFailed()%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWe're%20going%20to%20create%20a%20new%20artifact%2C%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Etests%3C%2FSTRONG%3E%2C%20where%20we're%20going%20to%20store%20the%20compilation%20output%20of%20the%20test%20project%20(%3CSTRONG%3EWpfUiTesting.Tests%3C%2FSTRONG%3E).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22the-full-yaml%22%20id%3D%22toc-hId-1549562474%22%20id%3D%22toc-hId-1549562474%22%3EThe%20full%20YAML%3C%2FH4%3E%0A%3CP%3EThis%20is%20the%20final%20YAML%20file%20after%20all%20our%20changes%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-154%22%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3Etrigger%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-bullet%22%3E-%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Emaster%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Epool%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20vmImage%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'windows-latest'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Evariables%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20buildPlatform%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'x86'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20buildConfiguration%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Release'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20appxPackageDir%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(build.artifactStagingDirectory)%5CAppxPackages%5C%5C'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Ename%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%24(date%3Ayyyy).%24(Month)%24(rev%3A.r).0%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3Esteps%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EVersionAPPX%402%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20displayName%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Version%20MSIX'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EVSBuild%401%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20platform%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(buildPlatform)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20solution%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'**%2F*.sln'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20configuration%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(buildConfiguration)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20msbuildArgs%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%2Frestore%20%2Fp%3AAppxBundlePlatforms%3D%22%24(buildPlatform)%22%20%2Fp%3AAppxPackageDir%3D%22%24(appxPackageDir)%22%20%2Fp%3AAppxBundle%3DAlways%20%2Fp%3AUapAppxPackageBuildMode%3DSideloadOnly%20%2Fp%3AAppxPackageSigningEnabled%3Dfalse'%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EPublishBuildArtifacts%401%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20displayName%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Publish%20artifact%3A%20drop'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20PathtoPublish%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%24(appxPackageDir)'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20condition%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EsucceededOrFailed()%3C%2FSPAN%3E%0A%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EPublishBuildArtifacts%401%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20PathtoPublish%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'WpfUiTesting.Tests%5Cbin%5CRelease%5C'%0A%20%20%20%20ArtifactName%3A%20'%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-string%22%3Etests'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20condition%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EsucceededOrFailed()%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIf%20we%20now%20run%20the%20build%20(saving%20the%20YAML%20file%20will%20be%20enough%20to%20trigger%20a%20new%20execution)%20and%20everything%20goes%20well%2C%20at%20the%20end%20of%20the%20process%20we%20should%20get%20two%20artifacts%3A%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-194%22%3E%0A%3CLI%20id%3D%22pragma-line-194%22%3EA%20folder%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Edrop%3C%2FSTRONG%3E%2C%20which%20contains%20the%20unsigned%20MSIX%20package.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-195%22%3EA%20folder%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Etests%3C%2FSTRONG%3E%2C%20which%20contains%20the%20DLL%20with%20our%20tests%2C%20plus%20all%20the%20testing%20dependencies%20like%20MSTest%20or%20the%20Appium%20SDK%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129093i854DEED19A2F34A0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22artifacts.png%22%20title%3D%22artifacts.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20it's%20time%20to%20build%20our%20release%20pipeline!%3C%2FP%3E%0A%3CH3%20id%3D%22the-release-pipeline---the-ui-testing-stage%22%20id%3D%22toc-hId--806080982%22%20id%3D%22toc-hId--806080982%22%3EThe%20release%20pipeline%20-%20The%20UI%20testing%20stage%3C%2FH3%3E%0A%3CP%3EAs%20mentioned%20in%20the%20beginning%20of%20the%20post%2C%20our%20pipeline%20will%20be%20made%20by%20two%20different%20stages.%20In%20this%20section%2C%20we're%20going%20to%20focus%20on%20the%20one%20which%20performs%20the%20UI%20testing.%20Only%20if%20the%20tests%20are%20all%20green%2C%20we'll%20move%20to%20the%20next%20stage%20to%20do%20the%20actual%20deployment.%3C%2FP%3E%0A%3CP%3EGo%20back%20to%20the%20Azure%20DevOps%20dashboard%20of%20your%20project%20and%20move%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPipelines%20%E2%86%92%20Releases%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20create%20a%20new%20one.%20As%20first%20step%2C%20you%20will%20be%20asked%20to%20choose%20one%20of%20the%20available%20templates.%20Choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EEmpty%20job%3C%2FSTRONG%3E%2C%20since%20we're%20going%20to%20start%20from%20scratch%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20595px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129094i3B0F0C8CBF8378AC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22emptyjob.png%22%20title%3D%22emptyjob.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EGive%20to%20the%20stage%20a%20meaningful%20name%20(for%20example%2C%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EUI%20testing%3C%2FSTRONG%3E%3CSPAN%3E)%2C%20then%20close%20the%20panel.%20You%20should%20see%20a%20screen%20like%20the%20following%20one%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20654px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129095i62A25C4102B4F165%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22newreleasepipeline.png%22%20title%3D%22newreleasepipeline.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAs%20first%20step%2C%20let's%20add%20an%20artifact%2C%20so%20that%20the%20various%20stages%20we're%20going%20to%20build%20can%20access%20to%20the%20output%20of%20the%20build%20pipeline%20we%20have%20previously%20built.%20Click%20on%20the%26nbsp%3B%3CSTRONG%3EAdd%20an%20artifact%3C%2FSTRONG%3E%26nbsp%3Bbox%20and%20choose%2C%20in%20the%26nbsp%3B%3CSTRONG%3ESource%20(build%20pipeline)%3C%2FSTRONG%3E%26nbsp%3Bfield%2C%20the%20name%20of%20the%20build%20pipeline%20we%20have%20previously%20built.%20Feel%20free%20to%20keep%20all%20the%20default%20options%20that%20will%20be%20filled.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20618px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129096iF4205A646F2724BA%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22addartifact.png%22%20title%3D%22addartifact.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ENow%20click%20on%20the%20lighting%20icon%20on%20the%20artifact%20and%20set%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EContinous%20deloyment%20trigger%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bswitch%20to%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EEnabled%3C%2FSTRONG%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20574px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129098iC9316F683C5922F4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22continuousdeploymenttrigger.png%22%20title%3D%22continuousdeploymenttrigger.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThanks%20to%20this%20option%2C%20every%20time%20the%20build%20pipeline%20will%20complete%20successfully%2C%20the%20release%20pipeline%20will%20be%20automatically%20triggered.%20Once%20you're%20back%20to%20the%20pipeline%20overview%2C%20click%20on%20the%26nbsp%3B%3CSTRONG%3E1%20job%2C%200%20task%3C%2FSTRONG%3E%26nbsp%3Blink%20under%20the%20stage%20name%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20666px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129100iD9CC193346ABDFD4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22jobtasks.png%22%20title%3D%22jobtasks.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EWe%20will%20get%20access%20to%20the%20deployment%20process%2C%20where%20we're%20going%20to%20specify%20all%20the%20steps%20we%20want%20to%20perform.%20It's%20similar%20to%20what%20we%20did%20with%20the%20build%20pipeline%2C%20the%20only%20difference%20is%20that%20the%20release%20pipeline%20creation%20is%20UI%20based%2C%20so%20we%20won't%20write%20YAML%20this%20time.%20First%20click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAgent%20job%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20change%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAzure%20Specification%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edropdown%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ewindows-2019%3C%2FSTRONG%3E.%20We%20want%20to%20use%20the%20most%20recent%20version%20of%20Windows%20and%20Visual%20Studio.%20Now%20click%20on%20the%20%2B%20button%20near%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAgent%20job%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20start%20adding%20the%20various%20tasks%20we're%20going%20to%20perform.%20This%20is%20the%20flow%20we're%20going%20to%20implement%3A%3C%2FP%3E%0A%3COL%20id%3D%22pragma-line-229%22%3E%0A%3CLI%20id%3D%22pragma-line-229%22%3EWe're%20going%20to%20sign%20the%20MSIX%20package%20produced%20by%20the%20build%20pipeline.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-230%22%3EWe're%20going%20to%20install%20it%20on%20the%20Windows%20hosted%20agent%20which%20is%20running%20the%20pipeline.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-231%22%3EWe're%20going%20to%20launch%20WinAppDriver%20and%20run%20the%20tests.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ELet's%20start!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22the-code-signing%22%20id%3D%22toc-hId-740215848%22%20id%3D%22toc-hId-740215848%22%3EThe%20code%20signing%3C%2FH4%3E%0A%3CP%3EThe%20easiest%20way%20to%20sign%20your%20MSIX%20package%20is%20using%20a%203rd%20party%20extension%20developed%20by%20Stefan%20Kert%2C%20which%20is%20available%20on%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dstefankert.codesigning%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EMarketplace%3C%2FA%3E.%20Once%20you%20have%20installed%20it%20on%20your%20account%2C%20you%20can%20add%20a%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECode%20signing%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etask%20which%2C%20under%20the%20hood%2C%20will%20use%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fwin32%2Fappxpkg%2Fhow-to-sign-a-package-using-signtool%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethe%20signtool%20utility%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20sign%20the%20package%20with%20the%20certificate%20you%20have%20provided.%20The%20bonus%20of%20this%20extension%20is%20that%20it%20uses%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fdevops%2Fpipelines%2Flibrary%2Fsecure-files%3Fview%3Dazure-devops%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3ESecure%20Files%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20store%20the%20certificate.%20This%20means%20that%20you%20will%20be%20able%20to%20use%20it%20inside%20a%20pipeline%2C%20but%20you%20won't%20be%20able%20to%20download%20it%20or%20copy%20somewhere%20else.%20Even%20if%20you%20give%20access%20to%20the%20pipeline%20to%20someone%20else%2C%20they%20won't%20be%20able%20to%20reuse%20your%20certificate%20to%20sign%20other%20applications.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20three%20important%20fields%20to%20edit%20in%20the%20settings%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20451px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129101iCE2539DC56C20B6C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22codesigning.png%22%20title%3D%22codesigning.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20id%3D%22pragma-line-242%22%3E%0A%3CLI%20id%3D%22pragma-line-242%22%3EIn%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESecure%20File%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efield%20choose%20the%20PFX%20file%20which%20contains%20the%20certificate%20you%20want%20to%20use%20to%20sign%20the%20MSIX%20package.%20You%20can%20click%20on%20the%20settings%20icon%20near%20the%20field%20to%20upload%20a%20new%20one.%20Remember%20that%2C%20as%20per%20guidelines%2C%20the%20subject%20of%20the%20certificate%20must%20match%20the%20publisher%20name%20in%20the%20manifest%2C%20otherwise%20the%20signing%20operation%20will%20fail.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-243%22%3EIn%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESecure%20File%20Password%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efield%20you%20need%20to%20specify%20the%20certificate's%20password.%20Instead%20of%20adding%20it%20here%20in%20clear%2C%20it's%20better%20to%20create%20a%20new%20variable%20and%20define%20it%20later.%20In%20my%20case%2C%20I've%20created%20a%20variable%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%24(PfxPassword)%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-244%22%3EIn%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EFile()s%20to%20sign%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efield%20you%20need%20to%20specify%20which%20file%20(or%20files)%20you%20want%20to%20sign.%20In%20our%20case%2C%20we%20want%20to%20sign%20the%20file%20with%20.msixbundle%20extension%20that%20will%20be%20produced%20by%20the%20build%20pipeline.%20Since%20there%20will%20be%20only%20one%2C%20we%20can%20just%20use%20the%20expression%20*%3CSTRONG%3E%3CEM%3E%2F%3C%2FEM%3E.msibundle%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20sign%20all%20the%20files%20with%20this%20extension%20included%20in%20any%20artifacts%20folder.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%3EAfter%20you%20have%20saved%20the%20task%2C%20you%20can%20click%20on%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EVariables%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Btab%20in%20the%20pipeline%20to%20store%20the%20password.%20Just%20add%20a%20new%20item%20with%20the%20same%20name%20you%20have%20chosen%20in%20the%20task%20(%3C%2FSPAN%3E%3CSTRONG%3EPfxPassword%3C%2FSTRONG%3E%3CSPAN%3E%2C%20in%20my%20case)%20and%2C%20as%20value%2C%20the%20password.%20For%20extra%20security%2C%20click%20on%20the%20lock%20icon%20near%20the%20value%20so%20that%20it%20will%20be%20masked.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20910px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129102i28C4F6EE3C413D2B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22variables.png%22%20title%3D%22variables.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH4%20id%3D%22download-and-install-the-certificate%22%20id%3D%22toc-hId--1811941113%22%20id%3D%22toc-hId--1811941113%22%3EDownload%20and%20install%20the%20certificate%3C%2FH4%3E%0A%3CP%3EThis%20step%20is%20required%20only%20if%20you're%20signing%20your%20application%20with%20a%20certificate%20which%20hasn't%20been%20released%20by%20a%20public%20certification%20authority%2C%20but%20it's%20an%20internal%20enterprise%20or%20self-signing%20certificate.%20In%20the%20first%20scenario%2C%20in%20fact%2C%20being%20released%20by%20a%20public%20CA%2C%20it%20will%20be%20already%20trusted%20by%20Windows%20and%2C%20as%20such%2C%20you%20can%20directly%20proceed%20to%20install%20the%20application%20on%20the%20hosted%20agent.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20this%20isn't%20your%20scenario%2C%20then%2C%20we%20need%20to%20make%20the%20certificate%20trusted%20by%20the%20hosted%20agent%20before%20sideloading%20the%20MSIX%20package%2C%20otherwise%20the%20operation%20will%20fail.%20The%20first%20step%20is%20to%20download%20the%20certificate%20on%20the%20machine.%20For%20this%20purpose%2C%20we%20can%20use%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EDownload%20secure%20file%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etask%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129103i37117766C7ED1995%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22DownloadSecureFile.png%22%20title%3D%22DownloadSecureFile.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThere%20are%20two%20important%20things%20to%20configure%20here%3A%3C%2FP%3E%0A%3COL%20id%3D%22pragma-line-259%22%3E%0A%3CLI%20id%3D%22pragma-line-259%22%3EIn%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESecure%20File%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efield%20you%20must%20choose%20(or%20upload%2C%20if%20it%20isn't%20available)%20the%20public%20certificate%20which%20is%20associated%20to%20the%20private%20certificate%20you%20have%20used%20in%20the%20previous%20task%20to%20sign%20the%20package%20(the%20file%20with%20.cer%20extension).%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-260%22%3EIn%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EReference%20name%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efield%2C%20you%20need%20to%20assign%20a%20name%20to%20the%20file.%20This%20way%2C%20the%20certificate%20will%20be%20accessible%20by%20the%20pipeline%20using%20the%20variable%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%24(xyz.secureFilePath)%3C%2FSTRONG%3E%2C%20where%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Exyz%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20name%20you%20have%20assigned.%20In%20my%20case%2C%20it%20will%20be%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%24(certificate.secureFilePath)%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThe%20next%20step%20is%20to%20add%20a%20PowerShell%20script%20that%20will%20take%20care%20of%20installing%20this%20certificate%20on%20the%20hosted%20agent.%20Click%20again%20on%20the%20%2B%20sign%20near%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAgent%20job%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20add%20a%20task%20of%20type%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPowerShell%20script%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20983px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129104i42D2A5E474569567%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22ImportCertificate.png%22%20title%3D%22ImportCertificate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EChoose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EInline%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20copy%20and%20paste%20the%20following%20script%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-268%22%20class%3D%22language-powershell%20hljs%22%3EImport-Certificate%20-Filepath%20%24(certificate.secureFilePath)%20-CertStoreLocation%20cert%3A%5CLocalMachine%5CTrustedPeople%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWe're%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EImport-Certificate%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecommand%20to%20import%20the%20certificate%20we%20have%20just%20uploaded%20as%20secure%20file%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETrusted%20People%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Estore.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22install-the-msix-package%22%20id%3D%22toc-hId--69130778%22%20id%3D%22toc-hId--69130778%22%3EInstall%20the%20MSIX%20package%3C%2FH4%3E%0A%3CP%3ETo%20install%20the%20MSIX%20package%20we%20need%20to%20add%20another%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPowerShell%20Script%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etask%2C%20which%20will%20use%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd-AppPackage%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ecommand%20followed%20by%20the%20file%20name.%20However%2C%20in%20our%20scenario%20we%20don't%20have%20a%20fixed%20name%2C%20since%20Visual%20Studio%20generates%20MSIX%20packages%20using%2C%20as%20name%2C%20the%20convention%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Eapp%20name_version_CPU%20architecture%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E(for%20example%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EWpfUiTesting.Package_2019.2.1.0_x86%3C%2FSTRONG%3E).%20Since%20it%20includes%20the%20version%2C%20the%20name%20will%20change%20at%20every%20build.%20To%20workaround%20this%20problem%20we%20can%20replace%20the%20version%20number%20in%20the%20file%20name%20with%20the%20variable%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%24(Build.BuildNumber)%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%2C%20which%20will%20be%20replaced%20by%20the%20current%20build%20number.%3C%2FP%3E%0A%3CP%3EThis%20is%20an%20example%20of%20the%20script%20to%20install%20the%20package%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-279%22%20class%3D%22language-powershell%20hljs%22%3EAdd-AppPackage%20-Path%20%3CSPAN%20class%3D%22hljs-string%22%3E%22WpfUiTesting.Package_%24(Build.BuildNumber)_x86.msixbundle%22%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIn%20order%20for%20the%20task%20to%20find%20the%20package%2C%20you%20need%20to%20expand%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdvanced%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20and%20set%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EWorking%20Directory%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20the%20folder%20where%20the%20build%20artifact%20is%20copied%2C%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20id%3D%22pragma-line-285%22%20class%3D%22language-powershell%20hljs%22%3E%24(System.DefaultWorkingDirectory)%2F_CI%20-%20CD%2Fdrop%2FWpfUiTesting.Package_%24(Build.BuildNumber)_Test%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIn%20my%20scenario%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E_CI%20-%20CD%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20name%20of%20the%20build%20pipeline%2C%20while%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EWpfUiTesting.Package%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20name%20of%20the%20packaged%20version%20of%20my%20WPF%20app.%20You%20can%20click%20on%20the%20three%20dots%20near%20the%20field%20if%20you%20want%20to%20explore%20the%20folder%20with%20the%20artifacts%2C%20so%20that%20you%20can%20find%20the%20right%20one.%20Also%20in%20this%20case%2C%20however%2C%20remember%20to%20replace%20the%20fixed%20version%20number%20with%20the%20the%20build%20number's%20variable%2C%20since%20the%20folder%20name%20generated%20by%20Visual%20Studio%20includes%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22perform-the-ui-tests%22%20id%3D%22toc-hId--641919586%22%20id%3D%22toc-hId--641919586%22%3EPerform%20the%20UI%20tests%3C%2FH4%3E%0A%3CP%3E%3CSPAN%3ENow%20that%20the%20MSIX%20application%20is%20installed%20on%20the%20hosted%20agent%2C%20we%20can%20finally%20run%20the%20UI%20tests.%20As%20first%20step%2C%20we%20need%20to%20run%20the%20WinAppDriver%20service%2C%20otherwise%20the%20Appium%20SDK%20won't%20be%20able%20to%20launch%20and%20interact%20with%20the%20application.%20As%20already%20mentioned%2C%20WinAppDriver%20is%20already%20installed%20on%20the%20hosted%20agent%2C%20so%20we%20just%20need%20to%20start%20it%20using%20one%20of%20the%20available%20tasks%20called%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EWinAppDriver%3C%2FSTRONG%3E%3CSPAN%3E.%20Once%20we%20have%20added%20it%20to%20our%20pipeline%2C%20all%20we%20need%20to%20do%20is%20to%20choose%20which%20kind%20of%20command%20we%20want%20to%20execute%2C%20in%20this%20case%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EStart%20WinAppDriver%3C%2FSTRONG%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129107i45EA147F1E7E3322%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22StartWinAppDriver.png%22%20title%3D%22StartWinAppDriver.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ENow%20we're%20ready%20to%20start%20our%20tests%2C%20by%20adding%20a%20new%20task%20of%20type%26nbsp%3B%3CSTRONG%3EVisual%20Studio%20test%3C%2FSTRONG%3E%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20976px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129108iB78A1B1C90684211%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22visualstudiotest.png%22%20title%3D%22visualstudiotest.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20task%20will%20pick%20up%20the%20DLL%20we%20have%20produced%20in%20the%20build%20pipeline%20and%20stored%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Etests%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efolder.%20We%20just%20need%20to%20specify%20the%20search%20criteria%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETest%20files%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efield.%20The%20easiest%20way%20is%20to%20use%20pattern%20matching.%20For%20example%2C%20in%20my%20sample%20project%20the%20test%20suite%20is%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EWpfUiTesting.Tests%3C%2FSTRONG%3E%2C%20so%20I've%20used%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E*test*.dll%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Epattern%20to%20look%20for%20all%20the%20DLLs%20in%20the%20folder%20which%20contain%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Etest%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ekeyword.%20This%20task%2C%20under%20the%20hood%2C%20will%20leverage%20a%20process%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EVstest.console%3C%2FSTRONG%3E%2C%20which%20is%20a%20console-based%20test%20runner%20included%20in%20Visual%20Studio.%3C%2FP%3E%0A%3CP%3EThe%20last%20step%20is%20to%20stop%20WinAppDriver%20once%20we%20have%20completed%20the%20testing.%20We%20just%20need%20to%20again%20the%20WinAppDriver%20task%20but%2C%20this%20time%2C%20we%20need%20to%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EStop%20WinAppDriver%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eas%20action.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20974px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129109iB557DE7F9E28268C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22stopwinappdriver.png%22%20title%3D%22stopwinappdriver.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH4%20id%3D%22running-the-release-pipeline%22%20id%3D%22toc-hId-1100890749%22%20id%3D%22toc-hId-1100890749%22%3ERunning%20the%20release%20pipeline%3C%2FH4%3E%0A%3CP%3EThat's%20it!%20Now%20you%20can%20test%20the%20release%20pipeline%2C%20either%20by%20manually%20clicking%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%20release%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ebutton%20or%20by%20committing%20new%20code%20to%20the%20repository%20which%2C%20due%20to%20the%20CI%2FCD%20configuration%2C%20will%20trigger%20a%20new%20build%20followed%20by%20a%20new%20release.%20During%20the%20execution%20of%20the%20release%20pipeline%2C%20the%20test%20will%20be%20executed%20and%20the%20same%20%22voodoo%20magic%22%20that%20we%20have%20seen%20on%20our%20PC%20will%20happen%20also%20on%20the%20hosted%20agent%3A%20the%20application%20will%20be%20launched%20and%20the%20interactions%20we%20have%20specified%20using%20the%20Appium%20SDK%20will%20be%20triggered.%20Of%20course%2C%20we%20won't%20actually%20see%20the%20test%20happening%2C%20since%20we%20don't%20have%20a%20visual%20connection%20to%20the%20hosted%20agent%20(like%20a%20remote%20session).%20However%2C%20we'll%20be%20able%20to%20follow%20the%20various%20tasks%20using%20the%20Azure%20DevOps%20log.%20At%20the%20end%20of%20the%20execution%2C%20the%20pipeline%20will%20succeed%20or%20fail%20based%20on%20the%20outcome%20of%20the%20test%20suite.%20Regardless%2C%20you%20will%20be%20able%20to%20see%20the%20details%20about%20the%20tests%20in%20the%20dashboard%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20899px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129110iCDDAD6B21B4563CF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22failedtests.png%22%20title%3D%22failedtests.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIn%20the%20above%20screenshot%2C%20for%20example%2C%20you%20can%20see%20that%20the%20testing%20session%20has%20failed%3A%201%20test%20didn't%20pass%2C%20which%20accounts%20for%2050%25%20of%20the%20whole%20test%20suite.%20If%20we%20click%20on%20it%2C%20we%20can%20see%20all%20the%20details%20we%20need%20to%20understand%20why%20the%20test%20has%20failed.%20As%20you%20can%20see%20in%20the%20screenshot%20below%2C%20these%20are%20the%20same%20information%20that%20Visual%20Studio%20was%20reporting%20us%20through%20Test%20Explorer%20on%20our%20local%20machine%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129111i402BB01A4FB8459A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22testexplorer.png%22%20title%3D%22testexplorer.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22the-release-pipeline---the-deploy%22%20id%3D%22toc-hId-345685147%22%20id%3D%22toc-hId-345685147%22%3EThe%20release%20pipeline%20-%20The%20deploy%3C%2FH3%3E%0A%3CP%3ENow%20that%20we%20have%20our%20UI%20testing%20stage%20up%20%26amp%3B%20running%2C%20we%20can%20add%20a%20new%20stage%20to%20perform%20the%20actual%20deploy.%20Just%20go%20back%20to%20the%20edit%20mode%20of%20the%20release%20pipeline%2C%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20%E2%86%92%20New%20stage%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20give%20it%20a%20meaningful%20name%20(like%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EDeploy%3C%2FSTRONG%3E).%20Then%20click%20again%20on%20the%20label%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E1%20job%2C%200%20tasks%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20start%20adding%20the%20tasks%20that%20will%20need%20to%20be%20performed.%20The%20only%20fixed%20task%20to%20add%20here%20is%20the%20code%20signing%20one%2C%20which%20is%20the%20exact%20same%20one%20we%20have%20added%20in%20the%20UI%20testing%20stage.%20Every%20stage%2C%20in%20fact%2C%20starts%20from%20the%20artifacts%20published%20by%20the%20build%20pipeline%2C%20so%20the%20starting%20point%20is%20again%20an%20unsigned%20MSIX%20package.%20Before%20deploying%20it%2C%20we%20need%20to%20sign%20it.%20I%20won't%20repeat%20the%20steps%2C%20since%20we%20need%20to%20use%20the%20same%20exact%20configuration%20we%20have%20used%20in%20the%20UI%20testing%20stage.%3C%2FP%3E%0A%3CP%3EThe%20next%20step%20is%20to%20add%20a%20task%20which%20does%20the%20actual%20deployment.%20I%20won't%20provide%20step%20by%20step%20instructions%20here%2C%20because%20it%20all%20depends%20by%20which%20is%20your%20deployment%20scenario%3A%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-324%22%3E%0A%3CLI%20id%3D%22pragma-line-324%22%3EIf%20you're%20publishing%20on%20the%20Store%2C%20you%20can%20use%20the%20task%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EWindows%20Store%20-%20Publish%3C%2FSTRONG%3E%2C%20which%20will%20use%20the%20Store%20APIs%20to%20do%20an%20automatic%20submission.%20You%20will%20be%20asked%20to%20add%2C%20as%20service%20endpoint%2C%20your%20connection%20with%20your%20Partner%20Center%20account%2C%20followed%20by%20all%20the%20information%20about%20the%20app%2C%20like%20the%20app%20id.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-325%22%3EIf%20you're%20using%20sideloading%20and%20App%20Installer%2C%20you%20can%20deploy%20to%20Azure%20using%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAzure%20File%20Copy%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etask%20(if%20you%20want%20to%20use%20the%20static%20website%20feature%20offered%20by%20Azure%20Storage%20and%20blobs)%20or%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAzure%20App%20Service%20Deploy%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eone%20(in%20case%20you%20want%20to%20host%20the%20package%20using%20a%20full%20website).%20Or%2C%20if%20you%20aren't%20using%20Azure%2C%20you%20can%20use%20the%20generic%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EFTP%20Upload%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etask%20to%20upload%20the%20package%20to%20any%20hosting.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-326%22%3EIf%20you're%20deploying%20the%20application%20to%20a%20small%20set%20of%20testers%2C%20you%20can%20use%20Visual%20Studio%20App%20Center%20by%20leveraging%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApp%20Center%20distribute%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Etask.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EFor%20example%2C%20in%20my%20scenario%20I'm%20deploying%20the%20WPF%20application%20to%20a%20blob%20storage%20on%20Azure%2C%20so%20this%20is%20how%20my%20deploy%20stage%20looks%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20633px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129112i47F2032291EB1908%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22deploystage.png%22%20title%3D%22deploystage.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAt%20the%20end%20of%20the%20process%2C%20the%20whole%20release%20pipeline%20should%20look%20like%20this%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20983px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F129113iC60D1356366894C4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22releasepipeline.png%22%20title%3D%22releasepipeline.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESince%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EDeploy%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Estage%20is%20defined%20after%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EUI%20Testing%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eone%2C%20the%20actual%20deploy%20will%20be%20performed%20only%20if%20all%20the%20tests%20are%20passing.%20If%20any%20of%20the%20test%20should%20fail%2C%20the%20whole%20UI%20testing%20stage%20will%20fail%2C%20meaning%20that%20the%20deploy%20one%20won't%20be%20executed.%20Smart%2C%20isn't%20it%3F%3C%2FP%3E%0A%3CH3%20id%3D%22wrapping-up%22%20id%3D%22toc-hId-2088495482%22%20id%3D%22toc-hId-2088495482%22%3EWrapping%20up%3C%2FH3%3E%0A%3CP%3EIt's%20been%20a%20long%20journey!%20But%20we%20have%20achieved%20our%20goal%3A%20we%20have%20integrated%20UI%20testing%20for%20our%20WPF%20application%20inside%20a%20CI%2FCD%20pipeline%20on%20Azure%20DevOps.%20From%20now%20on%2C%20every%20time%20we're%20going%20to%20commit%20new%20code%20to%20the%20repository%2C%20the%20following%20actions%20will%20happen%3A%3C%2FP%3E%0A%3CUL%20id%3D%22pragma-line-341%22%3E%0A%3CLI%20id%3D%22pragma-line-341%22%3EA%20build%20pipeline%20will%20compile%20the%20main%20application%20and%20package%20it%20as%20MSIX.%20At%20the%20same%20time%2C%20also%20the%20UI%20tests%20will%20be%20compiled%20in%20a%20dedicated%20DLL.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-342%22%3EThe%20first%20stage%20of%20the%20release%20pipeline%20will%20download%20the%20generated%20MSIX%20package%2C%20it%20will%20sign%20it%20and%20it%20will%20install%20it%20on%20the%20hosted%20agent.%20Then%2C%20it%20will%20execute%20the%20UI%20tests%2C%20thanks%20to%20the%20WinAppDriver%20service%20being%20pre%20installed%20on%20all%20the%20Windows%20based%20hosted%20agents.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-343%22%3EIf%20all%20the%20tests%20are%20green%2C%20the%20release%20pipeline%20will%20move%20to%20the%20second%20stage%3A%20the%20MSIX%20package%20will%20be%20downloaded%20again%2C%20signed%20and%20then%20deployed%20to%20your%20platform%20of%20choice%20(Store%2C%20Visual%20Studio%20App%20Center%2C%20website%2C%20etc.).%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThis%20workflow%20will%20ensure%20that%20the%20quality%20bar%20is%20always%20met%20and%20the%20whole%20test%20suite%20is%20executed%20every%20time%20we%20make%20any%20change%20to%20the%20source%20code%2C%20no%20matter%20how%20small%20or%20big.%3C%2FP%3E%0A%3CP%3EAs%20a%20reminder%2C%20you%20can%20find%20the%20full%20source%20code%20of%20the%20sample%20project%2C%20including%20the%20YAML%20file%20for%20the%20build%20pipeline%2C%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fqmatteoq%2FWpfUiTesting%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Eon%20GitHub%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHappy%20testing!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-829173%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EThis%20blog%20post%20will%20help%20you%20walking%20through%20the%20implementation%20of%20UI%20Testing%20for%20Windows%20on%20Azure%20DevOps%20with%20WinAppDriver%20and%20Appium%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft

In the previous post we have learned how, thanks to WinAppDriver and Appium, we can perform UI testing against our Windows applications. In that post we have created a sample WPF app and then we have tested some basic user interactions, using the local WinAppDriver service running on our machine. However, the most interesting scenario is automating these tests so that, in the context of a CI/CD pipeline, they can be automatically executed every time we commit new code to our repository. The recently announced integration with Azure DevOps makes the task easier to implement, since the WinAppDriver service is already up & running on every Windows hosted agent. However, you may find some challenges in implementing the workflow since UI testing is quite different from unit testing and it has different requirements.

 

Hopefully, this blog post will help you walking through the implementation of UI Testing for Windows on Azure DevOps. Lets' start!

 

The basics of CI / CD for MSIX

This post isn't meant to be a comprehensive guide about Azure DevOps for Windows applications. If you want to understand in details some of the concepts that we will implement in this blog post, a good starting point is the workshop that my team delivered at BUILD about moving Windows app forward, which is available here. Specifically, Exercise 5 will guide you through packaging an application with MSIX and implement a CI/CD pipeline on Azure DevOps to automatically build and deploy the MSIX package every time you commit some new code to the repository. Another great resource is the session that Ricardo Minguez Pablos, PM at Microsoft, and Oren Novotny, Microsoft MVP, delivered at BUILD 2019. Here are some important concepts that we will use through the post.

 

A CI/CD workflow is typically implemented using two different pipelines:

 

  • A build pipeline, which takes care of taking the source code of the project and building it. In the context of MSIX packaging, the build pipeline takes care of compiling our Windows application and creating a MSIX package
  • A release pipeline, which takes care of taking the output of the build process, configure it and deploy it on one ore more environments (testing, production, etc.). In the context of MSIX packaging, the release pipeline has the responsibility of signing the package and then deploying it using one of the many supported approaches: you can publish to the Microsoft Store, you can leverage Visual Studio App Center for testing, you can deploy on a website, etc.

The signing operation is a very delicate one in this process and the separation of concerns between the build and the release pipeline is very important to prevent identity theft and malicious usages of our certificate, especially if we're signing the application with a public or an enterprise certificate. Why is that? Visual Studio supports signing a package as part of the MSIX generation process, so we might be tempted to use this approach to make things simpler and do everything in the build pipeline. However, in order to do that, we would need to make the certificate available to the build process, which means committing it to our repository together with the source code. This is a bad practice, especially if you're working as part of a team. This means that every developer who is working on the application will have the chance to get the certificate and use it to sign other applications, even malicious ones, leading to an identity theft.

 

The challenges with UI testing

When you start to think about implementing UI testing as part of your CI/CD pipeline for MSIX, you face some challenges compared to a traditional testing scenario. Typically unit testing is included as part of the build pipeline, since tests are executed against the code of your application. However, a MSIX package can't be deployed without being signed and, based on what we have just learned, we can't do the signing operation in the build pipeline.

As such, we need to change a bit the architecture we have seen and split the release pipeline into 2 different stages:

 

  • A stage for the UI testing. This stage will take care of downloading the MSIX package produced by the build pipeline, sign it, install it on the hosted agent and then run the UI tests we have built using WinAppDriver.
  • A stage for the actually deploy. This stage will take care of deploying the signed MSIX package to whatever platform we want to use for distribution. This stage will be executed only if the previous one has completed successfully.

In this blog post we're going to build all the components which make this architecture possible. I will assume that you already have an Azure DevOps account. If not, you can create one for free on the official website. Don't worry! Despite the platform contains "Azure" in the name, it isn't directly tight to an Azure subscription. You can create a free account even without owning an Azure subscription or having to provide a credit card.

 

Let's start!

 

The build pipeline

Let's start to create the build pipeline. Once you're in your project on Azure DevOps, move to the Pipelines → Builds section and choose the option to create a new one. As first step, you will have to choose the repository where your code is hosted. This is the repository which contains our whole solution, which includes both the WPF application and the tests. It's the one we have built on the previous post, which is available here for your reference. Then you will be asked to choose a starting template.

 

pipelinetemplate.png

 

The best one for our scenario is Universal Windows Platform, since it will contain all the steps to create a MSIX package, regardless if it's a pure UWP app or a Win32 app packaged with the Windows Application Packaging Project, like our scenario. The option will create a template based on YAML, which is a markup language used to enable the Infrastructure as code approach, where the pipeline is created through a definition file rather than manual processes. This way, the definition of the pipeline can be treated like any other file of the project, included in the repository and evolve with your code as the requirements change. This is how the template looks like:

 

# Universal Windows Platform
# Build a Universal Windows Platform project using Visual Studio.
# Add steps that test and distribute an app, save build artifacts, and more:
# https://aka.ms/yaml

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  solution: '**/*.sln'
  buildPlatform: 'x86|x64|ARM'
  buildConfiguration: 'Release'
  appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\'

steps:
- task: NuGetToolInstaller@1

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

- task: VSBuild@1
  inputs:
    platform: 'x86'
    solution: '$(solution)'
    configuration: '$(buildConfiguration)'
    msbuildArgs: '/p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload'

This template is a good starting point, but it lacks some important tasks, like publishing the actual output (the MSIX package) so that it can be picked up by the release pipeline.

Let's do a few tweaks:

 

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  buildPlatform: 'x86'
  buildConfiguration: 'Release'
  appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\'

steps:
- task: VSBuild@1
  inputs:
    platform: '$(buildPlatform)'
    solution: '**/*.sln'
    configuration: '$(buildConfiguration)'
    msbuildArgs: '/restore /p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=SideloadOnly /p:AppxPackageSigningEnabled=false'

- task: PublishBuildArtifacts@1
  displayName: 'Publish artifact: drop'
  inputs:
    PathtoPublish: '$(appxPackageDir)'
  condition: succeededOrFailed()

Here is the list of changes we have done:

 

  1. We have reduced the number of supported build platforms, since some of the default ones aren't suitable for a WPF application, like ARM. As such, we have set the variable buildPlatform to x86 only.
  2. We have removed the tasks to install NuGet and restore the packages. A separate task, in fact, isn't needed anymore, since Visual Studio can do it on its own. We just have to add the /restore parameter to the build arguments, which are specified in the msbuildArgs property of the VSBuild@1 task.
  3. In my scenario, I'm planning to deploy the application on an Azure website using the App Installer technology instead of using the Microsoft Store. As such, I've set the /p:UapAppxPackageBuildMode parameter to SideloadOnly. This way, Visual Studio will generate only the .msix / .msixbundle files and not the .msixupload one, which is only for the Store.
  4. We've set the /p:AppxPackageSigningEnabled parameter to false, since we don't want to do the signing as part of the build process.
  5. We've added a task to publish the artifacts (the MSIX package) in a folder hosted on Azure DevOps called drop. This way, the release pipeline will be able to pick the generated MSIX package.

However, it isn't enough. We need to do a few additional things to properly support the MSIX / UI testing scenario.

 

Setting the MSIX package version

When you build a MSIX package using a CI/CD approach, an important requirement is to update the version number in the manifest every time a new package is created. If you rely on a manual approach (eg: changing the version in the manifest before committing the new code) you open the door to many potential problems. It's enough to forget to change the version to trigger the release of a new package with the same version number as the previous one, breaking the update chain. The easiest way to do it is by leveraging a 3rd party extension available on the Azure DevOps Marketplace, called Manifest Versioning Build Tasks by Richard Fennel. Once you have installed it on your Azure DevOps account, you can just add the following step in the YAML before the one which performs the build:

 

- task: VersionAPPX@2
  displayName: 'Version MSIX'

However this isn't enough. This task, in fact, takes care of setting a version number based on the build number generated by Azure DevOps which, by default, has the following syntax:

 

$(date:yyyyMMdd)$(rev:.r)

This expression is translated with a number like 20190205.1. The problem is that this syntax isn't suitable for a MSIX package, since the manifest requires a version number with the expression x.y.z.0 (for example, 1.2.5.0). As such, we need to change the default version number, by adding the following entry before the steps section of the YAML file:

 

name: $(date:yyyy).$(Month)$(rev:.r).0

This way, at every build, Azure DevOps will generate a build number like 2019.2.1.0, which is perfect for MSIX versioning.

 

Publish the tests library

The changes we have made so far would have been required by any CI/CD implementation for MSIX. The following one, instead, is specific to our scenario, where the solution contains also UI tests. When we move the testing session from the build pipeline to the release pipeline, we hit an issue. In order to run the tests, we need to compile the project which contains the tests, so that we can get a DLL which contains our test class. However, since we are in the release pipeline, we don't have access anymore to the source code of the project, but only to the artifacts published by the build pipeline. As such, other than publishing the MSIX package as an artifact, we need also to publish the DLL which contains our test suite so that the test runner can pick it.

To do this, we can add, as final step, another task to publish a build artifact:

 

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'WpfUiTesting.Tests\bin\Release\'
    ArtifactName: 'tests'
  condition: succeededOrFailed()

We're going to create a new artifact, called tests, where we're going to store the compilation output of the test project (WpfUiTesting.Tests).

 

The full YAML

This is the final YAML file after all our changes:

 

trigger:
- master

pool:
  vmImage: 'windows-latest'

variables:
  buildPlatform: 'x86'
  buildConfiguration: 'Release'
  appxPackageDir: '$(build.artifactStagingDirectory)\AppxPackages\\'

name: $(date:yyyy).$(Month)$(rev:.r).0

steps:
- task: VersionAPPX@2
  displayName: 'Version MSIX'

- task: VSBuild@1
  inputs:
    platform: '$(buildPlatform)'
    solution: '**/*.sln'
    configuration: '$(buildConfiguration)'
    msbuildArgs: '/restore /p:AppxBundlePlatforms="$(buildPlatform)" /p:AppxPackageDir="$(appxPackageDir)" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=SideloadOnly /p:AppxPackageSigningEnabled=false'

- task: PublishBuildArtifacts@1
  displayName: 'Publish artifact: drop'
  inputs:
    PathtoPublish: '$(appxPackageDir)'
  condition: succeededOrFailed()

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: 'WpfUiTesting.Tests\bin\Release\'
    ArtifactName: 'tests'
  condition: succeededOrFailed()

If we now run the build (saving the YAML file will be enough to trigger a new execution) and everything goes well, at the end of the process we should get two artifacts:

  • A folder called drop, which contains the unsigned MSIX package.
  • A folder called tests, which contains the DLL with our tests, plus all the testing dependencies like MSTest or the Appium SDK

artifacts.png

 

Now it's time to build our release pipeline!

The release pipeline - The UI testing stage

As mentioned in the beginning of the post, our pipeline will be made by two different stages. In this section, we're going to focus on the one which performs the UI testing. Only if the tests are all green, we'll move to the next stage to do the actual deployment.

Go back to the Azure DevOps dashboard of your project and move to Pipelines → Releases and create a new one. As first step, you will be asked to choose one of the available templates. Choose Empty job, since we're going to start from scratch:

 

emptyjob.png

Give to the stage a meaningful name (for example, UI testing), then close the panel. You should see a screen like the following one:

 

newreleasepipeline.png

As first step, let's add an artifact, so that the various stages we're going to build can access to the output of the build pipeline we have previously built. Click on the Add an artifact box and choose, in the Source (build pipeline) field, the name of the build pipeline we have previously built. Feel free to keep all the default options that will be filled.

 

addartifact.png

Now click on the lighting icon on the artifact and set the Continous deloyment trigger switch to Enabled.

 

continuousdeploymenttrigger.png

 

Thanks to this option, every time the build pipeline will complete successfully, the release pipeline will be automatically triggered. Once you're back to the pipeline overview, click on the 1 job, 0 task link under the stage name:

 

jobtasks.png

We will get access to the deployment process, where we're going to specify all the steps we want to perform. It's similar to what we did with the build pipeline, the only difference is that the release pipeline creation is UI based, so we won't write YAML this time. First click on Agent job and change the Azure Specification dropdown to windows-2019. We want to use the most recent version of Windows and Visual Studio. Now click on the + button near the Agent job to start adding the various tasks we're going to perform. This is the flow we're going to implement:

  1. We're going to sign the MSIX package produced by the build pipeline.
  2. We're going to install it on the Windows hosted agent which is running the pipeline.
  3. We're going to launch WinAppDriver and run the tests.

Let's start!

 

The code signing

The easiest way to sign your MSIX package is using a 3rd party extension developed by Stefan Kert, which is available on the Marketplace. Once you have installed it on your account, you can add a Code signing task which, under the hood, will use the signtool utility to sign the package with the certificate you have provided. The bonus of this extension is that it uses Secure Files to store the certificate. This means that you will be able to use it inside a pipeline, but you won't be able to download it or copy somewhere else. Even if you give access to the pipeline to someone else, they won't be able to reuse your certificate to sign other applications.

 

There are three important fields to edit in the settings:

 

codesigning.png

 

  1. In the Secure File field choose the PFX file which contains the certificate you want to use to sign the MSIX package. You can click on the settings icon near the field to upload a new one. Remember that, as per guidelines, the subject of the certificate must match the publisher name in the manifest, otherwise the signing operation will fail.
  2. In the Secure File Password field you need to specify the certificate's password. Instead of adding it here in clear, it's better to create a new variable and define it later. In my case, I've created a variable called $(PfxPassword).
  3. In the File()s to sign field you need to specify which file (or files) you want to sign. In our case, we want to sign the file with .msixbundle extension that will be produced by the build pipeline. Since there will be only one, we can just use the expression */.msibundle to sign all the files with this extension included in any artifacts folder.

After you have saved the task, you can click on the Variables tab in the pipeline to store the password. Just add a new item with the same name you have chosen in the task (PfxPassword, in my case) and, as value, the password. For extra security, click on the lock icon near the value so that it will be masked.

 

variables.png

Download and install the certificate

This step is required only if you're signing your application with a certificate which hasn't been released by a public certification authority, but it's an internal enterprise or self-signing certificate. In the first scenario, in fact, being released by a public CA, it will be already trusted by Windows and, as such, you can directly proceed to install the application on the hosted agent.

 

If this isn't your scenario, then, we need to make the certificate trusted by the hosted agent before sideloading the MSIX package, otherwise the operation will fail. The first step is to download the certificate on the machine. For this purpose, we can use the Download secure file task:

 

DownloadSecureFile.png

There are two important things to configure here:

  1. In the Secure File field you must choose (or upload, if it isn't available) the public certificate which is associated to the private certificate you have used in the previous task to sign the package (the file with .cer extension).
  2. In the Reference name field, you need to assign a name to the file. This way, the certificate will be accessible by the pipeline using the variable $(xyz.secureFilePath), where xyz is the name you have assigned. In my case, it will be $(certificate.secureFilePath).

The next step is to add a PowerShell script that will take care of installing this certificate on the hosted agent. Click again on the + sign near the Agent job and add a task of type PowerShell script.

 

ImportCertificate.png

Choose Inline and copy and paste the following script:

 

Import-Certificate -Filepath $(certificate.secureFilePath) -CertStoreLocation cert:\LocalMachine\TrustedPeople

We're using the Import-Certificate command to import the certificate we have just uploaded as secure file to the Trusted People store.

 

Install the MSIX package

To install the MSIX package we need to add another PowerShell Script task, which will use the Add-AppPackage command followed by the file name. However, in our scenario we don't have a fixed name, since Visual Studio generates MSIX packages using, as name, the convention app name_version_CPU architecture (for example, WpfUiTesting.Package_2019.2.1.0_x86). Since it includes the version, the name will change at every build. To workaround this problem we can replace the version number in the file name with the variable $(Build.BuildNumber) , which will be replaced by the current build number.

This is an example of the script to install the package:

 

Add-AppPackage -Path "WpfUiTesting.Package_$(Build.BuildNumber)_x86.msixbundle"

In order for the task to find the package, you need to expand the Advanced section and set the Working Directory to the folder where the build artifact is copied, like:

 

$(System.DefaultWorkingDirectory)/_CI - CD/drop/WpfUiTesting.Package_$(Build.BuildNumber)_Test

In my scenario, _CI - CD is the name of the build pipeline, while WpfUiTesting.Package is the name of the packaged version of my WPF app. You can click on the three dots near the field if you want to explore the folder with the artifacts, so that you can find the right one. Also in this case, however, remember to replace the fixed version number with the the build number's variable, since the folder name generated by Visual Studio includes it.

 

Perform the UI tests

Now that the MSIX application is installed on the hosted agent, we can finally run the UI tests. As first step, we need to run the WinAppDriver service, otherwise the Appium SDK won't be able to launch and interact with the application. As already mentioned, WinAppDriver is already installed on the hosted agent, so we just need to start it using one of the available tasks called WinAppDriver. Once we have added it to our pipeline, all we need to do is to choose which kind of command we want to execute, in this case Start WinAppDriver.

 

StartWinAppDriver.png

 

Now we're ready to start our tests, by adding a new task of type Visual Studio test:

 

visualstudiotest.png

 

The task will pick up the DLL we have produced in the build pipeline and stored in the tests folder. We just need to specify the search criteria in the Test files field. The easiest way is to use pattern matching. For example, in my sample project the test suite is called WpfUiTesting.Tests, so I've used the *test*.dll pattern to look for all the DLLs in the folder which contain the test keyword. This task, under the hood, will leverage a process called Vstest.console, which is a console-based test runner included in Visual Studio.

The last step is to stop WinAppDriver once we have completed the testing. We just need to again the WinAppDriver task but, this time, we need to choose Stop WinAppDriver as action.

 

stopwinappdriver.png

 

Running the release pipeline

That's it! Now you can test the release pipeline, either by manually clicking the Create release button or by committing new code to the repository which, due to the CI/CD configuration, will trigger a new build followed by a new release. During the execution of the release pipeline, the test will be executed and the same "voodoo magic" that we have seen on our PC will happen also on the hosted agent: the application will be launched and the interactions we have specified using the Appium SDK will be triggered. Of course, we won't actually see the test happening, since we don't have a visual connection to the hosted agent (like a remote session). However, we'll be able to follow the various tasks using the Azure DevOps log. At the end of the execution, the pipeline will succeed or fail based on the outcome of the test suite. Regardless, you will be able to see the details about the tests in the dashboard:

 

failedtests.png

In the above screenshot, for example, you can see that the testing session has failed: 1 test didn't pass, which accounts for 50% of the whole test suite. If we click on it, we can see all the details we need to understand why the test has failed. As you can see in the screenshot below, these are the same information that Visual Studio was reporting us through Test Explorer on our local machine:

 

testexplorer.png

 

The release pipeline - The deploy

Now that we have our UI testing stage up & running, we can add a new stage to perform the actual deploy. Just go back to the edit mode of the release pipeline, choose Add → New stage and give it a meaningful name (like Deploy). Then click again on the label 1 job, 0 tasks to start adding the tasks that will need to be performed. The only fixed task to add here is the code signing one, which is the exact same one we have added in the UI testing stage. Every stage, in fact, starts from the artifacts published by the build pipeline, so the starting point is again an unsigned MSIX package. Before deploying it, we need to sign it. I won't repeat the steps, since we need to use the same exact configuration we have used in the UI testing stage.

The next step is to add a task which does the actual deployment. I won't provide step by step instructions here, because it all depends by which is your deployment scenario:

  • If you're publishing on the Store, you can use the task called Windows Store - Publish, which will use the Store APIs to do an automatic submission. You will be asked to add, as service endpoint, your connection with your Partner Center account, followed by all the information about the app, like the app id.
  • If you're using sideloading and App Installer, you can deploy to Azure using the Azure File Copy task (if you want to use the static website feature offered by Azure Storage and blobs) or the Azure App Service Deploy one (in case you want to host the package using a full website). Or, if you aren't using Azure, you can use the generic FTP Upload task to upload the package to any hosting.
  • If you're deploying the application to a small set of testers, you can use Visual Studio App Center by leveraging the App Center distribute task.

For example, in my scenario I'm deploying the WPF application to a blob storage on Azure, so this is how my deploy stage looks like:

 

deploystage.png

 

At the end of the process, the whole release pipeline should look like this:

 

releasepipeline.png

 

Since the Deploy stage is defined after the UI Testing one, the actual deploy will be performed only if all the tests are passing. If any of the test should fail, the whole UI testing stage will fail, meaning that the deploy one won't be executed. Smart, isn't it?

Wrapping up

It's been a long journey! But we have achieved our goal: we have integrated UI testing for our WPF application inside a CI/CD pipeline on Azure DevOps. From now on, every time we're going to commit new code to the repository, the following actions will happen:

  • A build pipeline will compile the main application and package it as MSIX. At the same time, also the UI tests will be compiled in a dedicated DLL.
  • The first stage of the release pipeline will download the generated MSIX package, it will sign it and it will install it on the hosted agent. Then, it will execute the UI tests, thanks to the WinAppDriver service being pre installed on all the Windows based hosted agents.
  • If all the tests are green, the release pipeline will move to the second stage: the MSIX package will be downloaded again, signed and then deployed to your platform of choice (Store, Visual Studio App Center, website, etc.).

This workflow will ensure that the quality bar is always met and the whole test suite is executed every time we make any change to the source code, no matter how small or big.

As a reminder, you can find the full source code of the sample project, including the YAML file for the build pipeline, on GitHub.

 

Happy testing!