This blog assumes that you have a prior understand of functional testing with Coded UI Test on Windows Store. If not, please go through the introduction blog for Windows Store Apps. Here I would cover troubleshooting issues with the XamlWindow.Launch() API that has been explained in detail here. To summarize from the later blog the user would get the automationID of the application under test by launching the coded ui test builder and querying the properties of the pinned tile. This automationID would then be provided in the XamlWindow.Launch() API to launch the app. We heard back from customers that, this does not work for Apps in Windows 10. I’l try to explain why and provide a workaround to get this going.
The return value of the API that the Coded UI Test engine uses internally to get the apps automation ID has changed in windows 10. Hence on querying the automationID for most apps you would get something similar to the below
Using this in playback with a XamlWindow.Launch(“tile-5398e7b2-2ad4-4393-a267-99e25bddb60e_b3rhdqcqv1gj2!AppApp”) you would see the below exception:
“Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException: Exception occurred while trying to launch the app. Verify that the app is installed: Package was not found.”
This happens because the automationID that the builder reports needs to be stripped off of certain tags which here, are the “tile-” prefix and the “App” postfix. Stripping that out, you would end up with the below automationID:
Now, a XamlWindow.Launch(“5398e7b2-2ad4-4393-a267-99e25bddb60e_b3rhdqcqv1gj2!App”) would launch the app under test and the test can then continue operating on controls in the app.
Hope that helps!