cancel
Showing results for 
Search instead for 
Did you mean: 

TestComplete mobile noob on Android

Highlighted
Super Contributor

TestComplete mobile noob on Android

I have been able to instrument and deploy my mobile app (Cordova) to my device. I am able to run the app with TestComplete. I tried to record a script to login. This was recorded:

 

 

function Test2()
{
  Mobile.SetCurrent("Pixel");
  Aliases.Device.Process_obfuscated_new.RootLayout.Layout_NO_ID.WebView_comObfuscatedMobileAppKeypadHandler.Page_androidassetwwwdefaultindex.Wait();
}

I ran it for fun despite looking like it does not do anything. Indeed, it does not do anything.

 

 

I looked in the object spy to point to the user name. I can only point to

 

Aliases.Device.Process_obfuscated_new.RootLayout.Layout_NO_ID.WebView_comObfuscatedeMobileAppKeypadHandler

 

The red highlight is around the entire app window.

 

How do I get TestComplete to "see" objects within this window? Thanks

5 REPLIES 5
Highlighted
Community Hero

Re: TestComplete mobile noob on Android

Highlighted
Community Hero

Re: TestComplete mobile noob on Android

Hi,

 

One more thing I would recommend to try is to use not obfuscated build of the tested application.

(Yes, I agree that those will be two different applications and additional (manual) testing for the obfuscated application must be done to ensure that application does not crash after been obfuscated with the given obfuscation settings. The good news is that no functional testing is usually needed in this case. Just a quick verification that application does not crash, shortcuts are working, text is displayed as expected, etc.)

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Community Hero

Re: TestComplete mobile noob on Android

On top of what others have said, it looks like your application is using some kind of custom WebView as opposed to native Android controls.

 

See https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/mobile/android/contr... to setup your project to work with it. 


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Highlighted
Super Contributor

Re: TestComplete mobile noob on Android

Ok, I was given the instrumented app by someone else who cannot remember how it was done. I had read through the tutorial but skipped that part thinking it was done properly. I am not sure given this sentence in the instrumentation documentation.

 

" However, in this case, you will be able to create only image-based tests. " 

 

I will redo this. Thanks for your help.

 

S

Highlighted
Community Hero

Re: TestComplete mobile noob on Android

Hi,

 

I was given the instrumented app by someone else who cannot remember how it was done.

Note, that application must be instrumented using the same version of TestComplete that will be used to run the test.

 

P.S. Sample code to check instrumentation:

//-----------------------------------------------------------------------------

// From: http://blog.falafel.com/instrumenting-android-apps-ii/
// From: http://blog.falafel.com/instrumenting-android-apps-iii/
function AppInstrumentationVerify(strAppName : string; bStopTestRun : OleVariant = true) : OleVariant;
  var app : OleVariant;
  var boolResult : OleVariant;
  var strMsg : string;
begin
  app := evaluate(aqString.Format('TestedApps.%s;', strAppName));
  if (not app.Instrumented) then
  begin
    app.UseCustomCertificate := false;
    app.BackupOriginalAPK := true;
    boolResult := app.Instrument();
    if (boolResult) then
      Log.Message(aqString.Format(
          '%s tested application has not been instrumented so TestComplete did this to get access to its internals',
          aqString.Quote(strAppName)), strAppName)
    else
      Log.Warning(aqString.Format(
          'TestComplete failed to instrument the %s tested application',
          aqString.Quote(strAppName)), strAppName);
  end;

  boolResult := app.InstrumentedWithSupportedVersion;
  if (not boolResult) then
  begin
    if (bStopTestRun) then
      strMsg := ' Test run stopped.'
    else
      strMsg := '';
    Log.Warning(aqString.Format(
        '%s instrumentation is NOT compatible with TestComplete v.%i.%i.%s',
        app.APKFileName, getRunningTCMajorVersion(), getRunningTCMinorVersion(), strMsg), app.APKFileName);
    if (bStopTestRun) then
      Runner.Stop(false);
  end;

  result := boolResult;
end;
//-----------------------------------------------------------------------------
Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!
Top Kudoed Authors