locked
CodedUI for Windows Phone Universal app: Get app version from app package RRS feed

  • Question

  • Hi,

    I am writing coded UI tests in VS 2015 and I am targeting Windows Phone Universal app. I have created Coded UI TestProject (Windows Phone) from New Project\Universal\Coded UI Test Project (Windows Phone). And I am testing it on Windows 10 Technical Preview for phones. 

    How can I read app version from app package?

    When writing coded UI tests for Desktop app I was using PackagerManager class but now it is not available. When I want to access loaded assemblies I get "The process has no package identity."

    Regards,

    Cvorak 2011

    Friday, October 30, 2015 10:11 AM

Answers

All replies

  • Hi Cvorak 2011,

    Since the coded UI test supports the handle-coding test, so I think you could use the same way as the windows phone developer in your test code.

    I found some documents which shared us the suggestion about how to get the Get the application version from the Package.appxmanifest even if one document was related to the old Windows 8/WinRT apps.

    https://msdn.microsoft.com/en-us/library/windows/apps/windows.applicationmodel.packageversion?f=255&MSPPError=-2147217396&cs-save-lang=1&cs-lang=csharp#code-snippet-2

    http://www.michielpost.nl/PostDetail_67.aspx

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, November 2, 2015 12:03 PM
  • Hi Jack,

    thank you for reply. The approach you suggested I have already tried and I couldn't make it work. Coded UI test project is not a package and when I want to read current package I get exception "The process has no package identity."

    I was using PackageManager class from Windows.Management.Deployment from Windows assembly when I was developing coded UI test for Windows Universal. I would enumerate all packages and find application package by name and then read app version from particular package. This approach is not available when I create  Coded UI Test Project (Windows Phone) from New Project\Universal\Coded UI Test Project (Windows Phone). Windows assembly for Windows Phone 8.1 which I use for developing tests don't have PackageManager class.

    Regards,

    Cvorak 2011

    Tuesday, November 3, 2015 8:45 AM
  • Thanks for your friendly response, Cvorak 2011!

    You are right, based on this document here:

    https://msdn.microsoft.com/en-us/library/windows.management.deployment.packagemanager.aspx?f=255&MSPPError=-2147217396

    It really doesn't support the specific windows 8/8.1 apps.

    If the way to read the version in windows phone app doesn't work in coded UI test project, one idea is that you could use the custom code to read the XML file of that Package.appxmanifest, and then read the value of the version as the xml file, it is the better way I could get now.

    If it still has the limitation or it is not the way you want to get, I suggest you submit a feature request here:

    http://visualstudio.uservoice.com/forums/121579-visual-studio You can send your idea there and people can vote.

    Of course, the PackageManager class really doesn't work for it now, for this issue, you can submit this feedback to Microsoft Connect feedback portal: http://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx,Microsoft engineers will evaluate them seriously. Thanks for your understanding.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 4, 2015 8:25 AM
  • Hi Jack,

    thanks for suggestion but how can I access Package.appxmanifest at runtime?

    This approach:

    StorageFile file = await Package.Current.InstalledLocation.GetFileAsync("AppxManifest.xml");

    won't work since coded UI project is not package.

    Regards,

    Cvorak 2011

    Tuesday, November 10, 2015 2:55 PM
  • thanks for suggestion but how can I access Package.appxmanifest at runtime?

    This approach:

    StorageFile file = await Package.Current.InstalledLocation.GetFileAsync("AppxManifest.xml");

    won't work since coded UI project is not package.

    To get the issue confirmed and diagnose by product team, would you please create connect report for it? You will get email notification for update.http://connect.microsoft.com/VisualStudio/feedback/CreateFeedback.aspx

    I know that we could Reading the AppxManifest.xml as Runtime in the development app, but not very sure that whether it has this feature in coded UI tests.

    http://tonychampion.net/blog/index.php/2013/01/examining-the-windows-store-apps-appxmanifest-at-runtime/

    But if it really has this limitation, I suggest you submit a feedback in the connect report.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, November 11, 2015 6:14 AM