cannot record test using the apk file

19 posts, 0 answers
  1. Mohamed Rushdi
    Mohamed Rushdi avatar
    10 posts
    Member since:
    Mar 2018

    Posted 21 Mar Link to this post

    Hi,

    I am trying test  a native app using test studio mobile testing (android). the app is installing in the device but when I click the record button, a error message is displaying saying "command to message server time out". before recording, I did the below steps

    1.installed the agent app from the android app store in to the mobile device

    2. connected the device and configured the android app to be testable using the build in configuration

    3. selected the device for recording and selected the app identifier 

     

    can you please tell me why is this happening. Is it a issue in the apk i am using?

     

    you can download the apk file from the below link

    https://www.dropbox.com/s/h0xip5bq9y73hu3/Assura%20Premium%201.5.4.apk?dl=0

  2. Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    308 posts

    Posted 26 Mar Link to this post

    Hi Mohamed,

    Thank you for providing case-related information and the apk of the application. 

    It seems that the application is developed on Titanium developments environment. Please, note that this environment is not officially supported in Test Studio. 

    Despite that, we could not reproduce the reported problem. If using the provided apk, performing the built-in configuration and connecting using the Wi-Fi or USB - a sample test has been recorded successfully.

    Best Regards,
    Nikolay Petrov
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Mohamed Rushdi
    Mohamed Rushdi avatar
    10 posts
    Member since:
    Mar 2018

    Posted 26 Mar in reply to Nikolay Petrov Link to this post

    Hi,

    Thank you for your reply.  

    Can you also please let me know why the below apk is not working in test studio too. I did all the necessary configurations and i clicked the record button, but the app is not responding.

    I am having a hard time finding the root cause. the below app is developed in a xamarin environment.

    https://www.dropbox.com/s/bv86ndg8ff25ee4/Assura%20One%201.18.3.121.apk?dl=0

    Regards,

    Rushdi

     

  4. Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    308 posts

    Posted 29 Mar Link to this post

    Hi Rushdi,

    Thank you for the additional information provided.

    We were not able to reproduce the problem on our end so I suggest that the problem could be related to the communication between the device and message server. Can you change the way you are using to connect the device to the server? If using USB connection to change it to Wi-Fi for example. Please, note that if using Wi-Fi the device and the message server have to be on the same local network to be able to connect normally. 

    Since it is a Xamarin Android application did you try to configure it as described here?

    Can you connect, record and execute another sample application using the same device? What is the device model/Android version?

    If using another device or emulator - can you reproduce this problem?

    Best Regards,
    Nikolay Petrov
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  5. Mohamed Rushdi
    Mohamed Rushdi avatar
    10 posts
    Member since:
    Mar 2018

    Posted 04 Apr in reply to Nikolay Petrov Link to this post

    Hi,

    Thank you very much for the reply. Now the issue is sorted. the app is launching successfully in the real device. However, sometimes tests are not recording and it is displaying a message saying that "dom tree is out of sink"

    I was also looking in to how it works in emulators and now currently I am facing a issue. when I try to install the app in the emulator, I am getting a error message(image 01). Note: I installed the app agent in the emulator.

    I also found that all the time the test studio is having a hard time detecting the emulator. example:emulator is not displaying in the connected device when configuring it or it shows the emulator and suddenly emulator disappears in the configuration window. I am using android studio emulator. 

    Can you please look in to these issues and let me know. you can download the xamrin apk from below link. note: the configuration is done in the apk file

    https://www.dropbox.com/sh/cnchhng9k2jyikg/AACxQVfRWhGeq_kXP5HAaC5ba?dl=0

     

    Regards,

    Rushdi

     

     

     

  6. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    942 posts

    Posted 09 Apr Link to this post

    Hello Mohamed,

    Let me please step in this discussion as my colleague is out of the office. 

    Thank you for all details shared along with the apk file. The shared folder is accessible on our end as well. Please allow us some time to review the behavior of the configured application and we will get back to you. 

    Thanks in advance! 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  7. Shtilianov
    Admin
    Shtilianov avatar
    11 posts

    Posted 11 Apr Link to this post

    Hello Mohhamed,

    I'm sorry for the delay in our response. I'll adress your problems in points:

    1. "Out of sync" error in the DOM tree simply means that you have opened a new view in the app and the DOM tree you are seeing in the UI needs to be refreshed in order to see new elements from the new view. You probably have noticed that the "out of sync" message appears when you tap some navigation button or load a new menu or something similar. Simply press the refresh button in the DOM tree pane. Here you can see a legend of the different buttons found in the DOM tree UI: DOM tree UI.

    2. Not recording steps is probably connected with problem 1. I assume that steps are not recorded because you have accessed a screen that contains web elements. What you need to do is refresh the DOM tree (see problem 1) and a drop down will appear where you can switch between web DOM tree and native DOM tree. Here the problem is that when you have web elements we go into hybrid test territory and you have to use hybrid android test type. Check this article for more details. This is my assumption of course, if I'm not correct, can you please send me a screenshot of the exact screen where recording stops working and also a screenshot of the DOM tree that will load when you are on that screen (after you refresh it).

    3. Emulator problems. Unforetuentaly this is a complicated problem because we rely on adb.exe which is the only way we can access android devices and we have no control over its functions. From what I see in the screenshot, there is some kind of a version mismatch between the adb.exe and the API level of the android emulator. There are a lot things that could go wrong and i can recommend three solutions:
    - Try to create a new emulator with latest android.
    - Use the android instrumenation to output the .apk in the file system and then install in the emulator using the adb command line options.
    The command is "adb.exe install "appName.apk"". Also you'll need to uninstall the app from the emulator using "adb uninstall <package_name>"
    - Use the build that we'll release next week where we have updated the adb.exe to its latest version. You can also manually do that if you desire by installing the latest version of the android SDK and manually replacing the adb.exe we use found here: C:\Program Files (x86)\Progress\Test Studio\Bin\MobileStudio\AndroidAdb
    Note that you also need to replace the two adb .dll-s there.

    I hope this helps, send us any other question you have and we'll try to help.

    Regards,
    Miroslav
    Progress 

  8. Mohamed Rushdi
    Mohamed Rushdi avatar
    10 posts
    Member since:
    Mar 2018

    Posted 12 Apr in reply to Shtilianov Link to this post

    Hi,

    Thank you very much for the reply.

    Android Emulator-: This sorted some of my issues related to android emulator and dom tree issue.

    Real Device-: As you mentioned in the previous email the new elements displaying when refreshed the dome tree. However i found out that, some of the functions in the mobile app cannot be automated the normal way. the interesting thing is, i also couldn't find the elements related to that specific function in the DOM tree. Please see below test step to reproduce it:

    Issue 1:

    Install the App and open it

    Enter the System URL as : https://tst-lwa-phase1c.assurasoftware.co.nz/

    Enter the user name and password

    Select the "Rushdi H&S" App configaration and click done

    Select New event

    Select Reported By

    Click on the + mark

    Select Create Staff (this step cannot be automated. couldn't find elements in the dom tree. screenshot attached) 

     

    Issue 2:

    select new safety observation 

    click on observation type

    select something from the list (this step cannot be automated. couldn't find elements from the dom tree)

    can you please let me know why I cannot automate the above 2 scenarios. screenshots are attached. I will send the login details to Mark.DaCosta@progress.com

    you can use the below link to download the app 

    https://www.dropbox.com/sh/cnchhng9k2jyikg/AACxQVfRWhGeq_kXP5HAaC5ba?dl=0

     

    Regards,

    Rushdi


  9. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    942 posts

    Posted 17 Apr Link to this post

    Hi Rushdi,

    Thanks for the shared details. 

    I managed to access the shared folder and the application. Though could you please let me know what concerns you have to share the login credentials with us? 

    Apart from that I reviewed the scenarios you described and it seems that you are trying to automate dialogs which are not part of the application but are system dialogs. Therefore there is no straight forward action to handle these. 

    Since we had faced a similar to that issue the engineering team has prepared a workaround which will be possibly applicable for your scenario as well. Please find attached two archives containing a sample project and two bat files.

    The bat files are referred in the project from the folder C:\Work\. Of course, you could store these to any other location but you will need to adjust it in the code solution.

    Basically the code gets all elements on the device screen and stores them to a xml file initially on the device itself. Then this file is copied to the working directory C:\Work\. Then it is parsed and the button in question is located by its name in the sample. Using its coordinates then allows you to find the center and tap on it.

    Please note that the example code in the project needs to be adjusted as per the specifics of the dialog and buttons you need to handle.

    Please have a look at the proposed solution and if it will be applicable for you as well. Otherwise if you would need further assistance I would like to kindly ask you to send us credential for the sample application. 

    Thanks in advance for your time and cooperation! 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  10. Mohamed Rushdi
    Mohamed Rushdi avatar
    10 posts
    Member since:
    Mar 2018

    Posted 17 Apr in reply to Elena Tsvetkova Link to this post

    Hi ,

    Thank you for your reply. 

    I tried the code  you gave me and still I am having the above issue. 

    Regarding the Login credentials: we don't  have any problem giving you the login credentials but not in public forum. We would prefer to share it privately. Much appreciated if you could let me know a way to send you the login credentials directly by email or another way.

    Regards,

    Rushdi

     

     

     

  11. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    942 posts

    Posted 20 Apr Link to this post

    Hello Rushdi,

    I now understand you concerns for sharing the credentials. Therefore I have requested these from Mark DaCosta whom you mentioned had sent these already. Once I get these I will review the application and will get back to you. Thanks! 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  12. Mohamed Rushdi
    Mohamed Rushdi avatar
    10 posts
    Member since:
    Mar 2018

    Posted 22 Apr in reply to Elena Tsvetkova Link to this post

    Hi,

    can you please use the " https://tst-lwa-phase4-tz.assurasoftware.co.nz " as the System URL when logging in to the app because Currently we have some some issues in the other test environment which I have mention in my post on Apr 12.

    you can use the same logging and password that I send. I have mentioned the test steps again below with the correct URL(only the System URL has changed, rest of the steps are same). Please follow the below test steps to reproduce the issues

     

    Issue 1:
    Install the App and open it
    Enter the System URL as : https://tst-lwa-phase4-tz.assurasoftware.co.nz
    Enter the user name and password
    Select the "Rushdi H&S" App configaration and click done
    Select New event
    Select Reported By
    Click on the + mark
    Select Create Staff (this step cannot be automated. couldn't find elements in the dom tree. screenshot attached) 

    Issue 2:
    select new safety observation 
    click on observation type
    select something from the list (this step cannot be automated. couldn't find elements from the dom tree)

     

    Regards,

    Rushdi

  13. Shtilianov
    Admin
    Shtilianov avatar
    11 posts

    Posted 24 Apr Link to this post

    Hi Mohamed,

    I have verified that the options menu is indeed in a system dialog and not a part of the app UI, that's the reason why it's not visible in the DOM and not recorded. 
    The script Elena sent you works and I have attached an example with your app. Open the attached project and examine the android test, I have create two examples at the end. One is dynamicaly tapping on the "Create staff" option by name, the other uses coordinates.

    Note that to do this I use adb. I assume that in the windows PATH, android platform-tools are present (where adb.exe is). I realised that may not be the case so I also included a slightly updated version of the .cmd files where I use the adb.exe from the default location (you can also point the scripts to the adb.exe we install with mobile studio here: C:\Program Files (x86)\Progress\Test Studio\Bin\MobileStudio\AndroidAdb.
    Please try to run the test, the areas you have to watch closely are:
    1. Is adb.exe found.
    2. The correct paths are set in the script (where it searches for the .cmd file which makes the UI dump). You can check the comments in the DismissPopUp file where I explain what I'm doing.

    You can easily reuse this script in other situation as well. 

    Regards,
    Miroslav
    Progress
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  14. Mohamed Rushdi
    Mohamed Rushdi avatar
    10 posts
    Member since:
    Mar 2018

    Posted 08 May in reply to Shtilianov Link to this post

    Hi,

    Thank You very much for the reply. I successfully manged to automate a system dialog which is not a part of the app ui. However, I encountered several other issue when doing it.

    Issue 01: the coded step successfully passes if there is only one coded step included in the test case. But if there is more than one coded step in the test cases, Its failing (Its failing in the first coded step). please look in to the attached screenshot examples of a test case that has two coded step. This test cases fails in the step 10 coded step. However If I remove the step 22 coded step and try again, its passing the coded step 10. can you please look in to this and let me know.

    Issue 2: The .cmd files that was given by you were not working but the .cmd files that was given by Elena Tsvetkova was working. I am not sure why is that but I noticed that you have mentioned that you have slightly updated the .cmd files. can you please let me know what is the difference between these .cmd files.can you also please explain me the below that you have mentioned in the previous post. My current path of the plat form tools are C:\Users\rushdi.ali\AppData\Local\Android\Sdk\platform-tools

    "you can also point the scripts to the adb.exe we install with mobile studio here: C:\Program Files (x86)\Progress\Test Studio\Bin\MobileStudio\AndroidAdb."

     

    Regards,

    Rushdi

     

  15. Shtilianov
    Admin
    Shtilianov avatar
    11 posts

    Posted 11 May Link to this post

    Hi Mohamed,

    Thanks for your cooperation. 

    I will need some further details on your end to be able to provide additional advice. Please find below my comments. 

    issue01: Can you tell me where exactly you get the failure, during compilation or runtime. It seems it's a compilation error you are getting but you have to check what exactly is that error and send it to me. The described behavior is very weird. 

    issue02: I've just changed the path to the adb used in the .cmd file. You can edit it freely as you see it in a text editor like Notepad. What's inside the .cmd file is just a command that runs the adb with some parameters that get the UI dump from the attached device, you can decide on how to access the adb tool (using a hard-coded path, include a path to it in the system PATH). My update was to point to the adb.exe we provide with the installation of Test Studio (we do that in case you are trying to run tests on a machine that has no android sdk). You can choose to use it or use the one provided with the android sdk, just edit the paths in the .cmd files.

    Regards,
    Miroslav
    Progress
  16. Mohamed Rushdi
    Mohamed Rushdi avatar
    10 posts
    Member since:
    Mar 2018

    Posted 15 May in reply to Shtilianov Link to this post

    Hi,

    Thank You for your reply.

    Issue 01 reply: I am getting a error message called "Length cannot be less than zero. parameter name: Length". Can you please look in to this issue and let me know. I have attached a screenshot of this (image01)

    I have several other questionsI want to ask.

    Q1:  can you please tell, how did you find the coordinate number when you trying to automate a dialogs which is not part of the ui using coordinates. I have attached a screenshot of the sample project you gave. Please look in to image 2 screenshot

    Q2: currently the code you gave me related to the system dialogs that are not part of the app UI, are automated using "by name". I want to know whether how can i automate these system dialogs using xpath or css selector or ID etc..

    Q3: how can i set a text value in a text field using code and dynamically tapping

    Q4: how can I verify the above system dialogs that are not part of the UI. example: I want to verify whether the create staff exist in the popup menu which is not part of the app ui  or whether the create staff is visible or not.

    Q5: As Q4, how can i verify as attached screenshot Image 03

    Q5: how can i automate the android keyboard. Example: I want to automate tapping the keys in the keyboard? . look in to the screenshot Image 03

    Regards,

     

    Rushdi




     

     

  17. Shtilianov
    Admin
    Shtilianov avatar
    11 posts

    Posted 18 May Link to this post

    Hi Mohamed,

    Please find below my comments on each of the topics. 

    Issue01: This is a known issue with adb where if you run the command I use to get the UI really fast, the second time it fails to output anything.

    while (!System.IO.File.Exists(xmlDefault) && n < 5000) {
    System.Threading.Thread.Sleep(1000);
    Process.Start(startInfo);
    }

    This part here should take care of this problem by retrying the get UI command until we have a xml with the UI but I'm not sure why it's not working in your case, I'll need some more time to see if I can reproduce it.

    Bottom line, the error comes from the fact that the code is not finding the required data from the xml (xml file does not exist or it's empty). Can you send me the exact test you are using so that I can check if there is something out of order there. 
    It can be a sync issue or it's possible that somehow we delete the xml from where we get the element coordinates...or the xml file is created, the script continues but the file is empty for some reason. 

    Q1: I get it from the device UI. The adb tool has the ability to get the whole UI you see on the phone screen in xml format. In there you can see the different UI controls and every one of them has screen coordinates. So it's easy to get the exact center of the element you need using those coordinates (or directly use them in the code).

    Q2: What I actually do is finding the UI item in the xml mentioned above by name and then getting the coordinates. This means that in the case you run the same script on devices with different screens, the script will pass because we get the coordinates dynamically. You can easily use xpath the same way in the code file (Note how I load the xml as xml in the code. From that point forward you can use xml.selectnode by xpath expression). Basically you have the xml with the UI hierarchy, so you can use xpath to get a specific element and then get the coordinates in a similar way as I do it. I think "id" won't work though because it's no visible in the UI...you need to check it case by case, examining the xml that adb outputs.

    Q3: I'm not sure I understand that one, but my assumption is that you need a combination between entering text and then tapping on a system dialog ? Or you need to make a tap inside the textbox after you have set the text. If the textbox is part of the app, the recorded set text step should be OK because it includes a tap by default.

    Q4: 1. You can make a screenshot. 2. You can directly verify their status from the xml that adb outputs like in Q2 (by xpath, by name). After you make a screenshot you can convert it to base64string and compare it with another screenshot you have prepared in advance. You can check this example if you are interested in something like this: compare images in C#

    Q5: The create event should be visible in the DOM tree, looks like part of the app so we should be able to directly use the verify visible and verify exist steps. You can also put a screenshot compare if you think it's needed, it may be an overkill though. The items in the dropdown should be visible in the DOM tree, so you just have to find them and verify that an item with desired content (the city in this case) exists. You can even make a search query by textContent where the content is: farm123 - Sydney. If the elements is found that way, we can say 100% that this item exists in the dropdown.

    Q6: The android keyboard is problematic. You can try to keep it as simple as possible by just pressing a single button in the keyboard using adb and coordinates and then verifying the outcome. The keyboard will appear in the UI xml as an UI element, problem is that it appears just as keyboard class and you can't make a difference between the different keys in the keyboard. So some hard coded tap by coordinates will be needed here. Good news is that the keyboard will always appear at the bottom of the screen so tapping by coordinates should be robust.

    I hope all of the above will be helpful to you! 

    Regards,
    Miroslav
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  18. Mohamed Rushdi
    Mohamed Rushdi avatar
    10 posts
    Member since:
    Mar 2018

    Posted 22 May in reply to Shtilianov Link to this post

    Hi,

    Thank you very much for answering all of my questions. Most of my questions were solved but there are some I need further details.
    The issue01 is working now. what i did was change a small part of the code to "System.Threading.Thread.Sleep(10000)" and its working fine now.

    Further Explanation Needed:

    Q3: Sorry for not explaining it properly. I want to set a text in a Text box using code. The reason why I am doing this because sometimes the set text action is not recording when I tap the text box and type something. I am using a real phone to record tests. I have no idea why is this happening. I tried using the DOM tree method and I couldn't find any Set Text option in Action menu (Please look in to the attached image highlighted area in yellow). so that’s why I am planning to use a coded step to set a text in a text box. Can you please let me know how I can use coded step to set a text in a text box?

    Other Questions (This is related to IOS Automation):

    1. Can I use the Android automated tests in IOS. For example: I automated some test in Android. Now I want to execute the same tests in IOS. So can I use the Android test or do I need to create new tests for IOS from the beginning separately
    2. How can I automate functions that are not part of appUI in IOS? Is it the same way as Android or is it different?

     

    Regards,

    Rushdi

     

     

     

  19. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    942 posts

    Posted 28 May Link to this post

    Hi Rushdi,

    Thank you for your cooperation. I am glad to know you managed to fix the code to work on your end. 

    Please find my comments on your topics below: 

    Q3: Please note that you need to identify the android.widget.EditText element in the DOM tree to set text in as the android.widget.TextView is only a label and cannot accept text (please see the screenshot). 

    1. The iOS and Android tests cannot be reused and reverted between the two OS platforms. The iOS tests need to be newly recorded. 
    2. You could use the same coded approach my colleague had already shared with you in iOS tests as well and verify any dialogs which are not part of the application. 

    I hope this will be also helpful to you. In case of further queries, please do not hesitate to contact us again! 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top