instrumentation fail on time in code ignores limit

Mobile Testing, Android App Testing.
zivshapirawork
Posts: 62
Joined: Wed Sep 24, 2014 7:47 am
Location: Israel

instrumentation fail on time in code ignores limit

Post by zivshapirawork » Mon Mar 23, 2015 1:25 pm

I tried to instrument an apk file using Ranorex 5.3.0 and RC4 apktool.

I received the following error that the instrumentation did not complete in the default time (2 min)
System.TimeoutException: Process did not finish within the specified timeout of '00:02:00'.
at Ranorex.Core.ProcessRunner.RunShortProcess(Boolean showWindow, TimeSpan timeout, IList`1 appendToPath)
at Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.CompileApkFile(String sourceApkFilePath, IPathService pathService)
at Ranorex.Plugin.Mobile.Utils.BackgroundWorkerSupported.ExecuteBgwCode[TArg0,TArg1](BgwDelegate`2 methodDelegate, Int32 doneProgress, String progressText, TArg0 arg0, TArg1 arg1, BackgroundWorker bgw)
at Ranorex.Plugin.Mobile.Tools.Android.Instrumentation.ApkFileInstrumenter.Instrument(String apkFilePath, Int32 port, InstrumentApkOptions deployOptions, BackgroundWorker bgw)
at Ranorex.Controls.Instrumentation.Workers.AndroidWorker.Run()
at Ranorex.Controls.AndroidInstrumentProgressPage.bgw_DoWork(Object sender, DoWorkEventArgs e)
I wrote instrumentation code in a recording, so that I can add more time to the default.

Code: Select all

using System.Threading;
using WinForms = System.Windows.Forms;

using Ranorex;
using Ranorex.Core;
using Ranorex.Core.Testing;

namespace ParkinsonAutomation
{
    public partial class DeployAppToDevice
    {
        /// <summary>
        /// This method gets called right after the recording has been started.
        /// It can be used to execute recording specific initialization code.
        /// </summary>
        private void Init()
        {
            // Your recording specific initialization code goes here.
        }

        public void DeployAppToDevice_Deploy_Android_App(string apkname)
        {
        	var _ts = new TimeSpan(0,20,0);
            Report.Log(ReportLevel.Info, "Application", "Deploying android app 'C:\\Users\\user\\Downloads\\" + apkname + ".apk' to device 'automation-android-1'.");

            Host.Local.InstrumentAndDeployAndroidApp("automation-android-1", 
                                                     "C:\\Users\\user\\Downloads\\" + apkname + ".apk", 
                                                     true, 
                                                     Host.DeploymentModes.Usb,
                                                     new Duration(_ts)
                                                    );
        }

    }
}
although I had coded 20 minutes, running the recording still failed after 2 minutes (below) and the error is the same as from the Ranorex IDE instrumentation option.

has anyone encountered the issue of instrumentation code ignoring the allocated duration?
Instrumentation failed. Error:
Process did not finish within the specified timeout of '00:02:00'.

Info: Exec: C:\Program Files\Java\jre7\bin\java.exe -jar "C:\Program Files (x86)\Ranorex 5.3\Bin\RxEnv\Android\tools\apkTool\apktool.jar" d "C:\Users\zshapira\AppData\Local\RanorexStudio5\RxEnv\Android\temp\xxxxxxx.apk" -f -o "C:\Users\zshapira\AppData\Local\RANORE~1\RxEnv\Android\temp\decomp"
Info: Decompiling APK File.
Info: Processing file 'xxxx.smali' (Pass2).
...
...
...
Info: Recompiling APK File.

Ranorex.Instrumentation.exe /help -- Display general help.
Ranorex.Instrumentation.exe /pagename:n /help -- display specific help.

d, device The name of the device to that the APK file shall be
deployed. This parameter is not required if deploymode is set
to 'NoDeploy'.

a, apkfile Required. The path where the APK file resides.

s, skip Default is False. Set this switch to skip APK file
instrumentation prior to deploying.

dm, deploymode Possible Values: WiFi, Usb, NoDeploy, Auto. Default is Auto.
Specifies how the apk file shall be deployed. Set to nodeploy
if the file shall not be deployed to the device. Auto means
the connection mechanism used to configure the device will be
used.

o, outfile Sets a custom output location for the instrumented file. This
can be a directory or a file path. Read/Write permission is
required for this path. If a directory was specified, (to
specify a directory add a trailing '\') the process will
place the APK file in it with the -instrumented suffix added
to the source file name. If the file already exists it will
be overwritten. This option only has a effect if an APK is
instrumented (no skip).

p, pagename Default is UserSelect. Set this option to directly navigate
to a specific page. Is also required for automated command
line based instrumentation. Pages are: android, chrome,
firefox, flex, ios, java, safari. Note: The default 'Select'
is not supported in the command line.

?, help Default is False. Displays command line arguments help.

lucian.teodorescu
Posts: 82
Joined: Fri Oct 24, 2014 10:58 am
Location: Bucharest

Re: instrumentation fail on time in code ignores limit

Post by lucian.teodorescu » Mon Mar 23, 2015 2:21 pm

Hi Ziv,

Did you try setting the "Instrument timeout" to 20m in Global Settings>Plugins/Mobile?

Give it a try and let us know the results.

Lucian
Lucian Teodorescu
NetSun Software

zivshapirawork
Posts: 62
Joined: Wed Sep 24, 2014 7:47 am
Location: Israel

Re: instrumentation fail on time in code ignores limit

Post by zivshapirawork » Mon Mar 23, 2015 3:49 pm

Hi Lucian

Thank you for the guidance. Changing the Global Settings solved the issue both via Ranorex and via code :)

I am leaving this thread open, because it is reporting an issue with the instrumentation via the code, which seems to ignore the given duration in the code and use the global settings instead, unless I am missing something.

/ziv

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: instrumentation fail on time in code ignores limit

Post by Support Team » Thu Mar 26, 2015 2:00 pm

Hello Ziv,

Thank you for reporting this issue, we will analyze it and try to fix it as soon as possible.

Regards,
Robert
.
Image

zivshapirawork
Posts: 62
Joined: Wed Sep 24, 2014 7:47 am
Location: Israel

Re: instrumentation fail on time in code ignores limit

Post by zivshapirawork » Mon Jul 20, 2015 12:05 pm

Hi has anything happened with this? using Ranorex 5.4.0 and getting the issue

Code: Select all

	var _ts = new TimeSpan(0,20,0);

	Host.Local.InstrumentAndDeployAndroidApp(devicename,
			                                         apkname + ".apk",
			                                         true,
			                                         Host.DeploymentModes.Usb,
			                                         new Duration(_ts), 
			                                         o
			                                        );
and the error for fail after 2 min even though the timeout is 20 min. Deployment from the studio is ok.
System.Exception : Instrumentation failed. Error:
Process did not finish within the specified timeout of '00:02:00'.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: instrumentation fail on time in code ignores limit

Post by Support Team » Tue Jul 21, 2015 8:29 am

Hello Ziv,

We are still working on this known issue. I will update the forum as soon as we found a solution.

Thank you for your patience.

Regards,
Robert
.
Image