Kobiton integration in Katalon Studio – Application start

Question

How can I start the mobile application (Android) at the beginning of the TestCase which is executed on the Kobiton cloud device ?

When I try to start the application with:

Mobile.startApplication(GlobalVariable.AndroidAppFile, true)

and execute TestCase by selecting the desired Kobiton device, the execution always fails with an error:

Test Cases/Android/TESTS/New Test Case FAILED because (of) Unable to start app at: '.\Apps\MyApp.apk'
(Root cause: java.lang.NullPointerException: Name is null)

I know that I’m using the local *.apk file path in the keyword but I expected at first that the app will be uploaded to the Kobiton service and installed to the device.

What is the right approach to test a mobile app on the Kobiton device ? Should I create a new AppiumDriver instance with the desired capabilities ? If so, then why can I choose the Kobiton device as a target in the Katalon studio ?

in progress 2
Execution 11 Answer 621 views

About the Author

Answers ( 11 )

  1. This comment is edited.

    Hi there,

    We’ve asked Kobiton and they confirm there is currently no way to make a bridge connection between your local machine and Kobiton devices.

    In this case, you can do the following steps:

    1. Upload your application to Kobiton device on manual interface: http://prntscr.com/ekjf5z
    2. Find appPackage and appActivity of your application: http://toolsqa.com/mobile-automation/appium/how-to-find-apppackage-and-appactivity-for-apk-file/
    3. Set desired capabilites using appPackage and appActivity of your application, e.g:

    capabilities.setCapability(“appPackage”, “com.android.collagemaker”);
    capabilities.setCapability(“appActivity”, “com.android.collagemake.MainActivity”);

    • Hi and thanks for the answer.

      Actually, I thought it would be that way. Launching the device on Kobiton and obtaining the package/activity name is not a problem, but I don’t crearly understand the point 3.

      For which execution type (target) in Katalon Studio I should set my desired capabilities and which execution type should I run ? For example should I:

      A) Define capabilities for a execution type “Remote” connected to the Kobiton server URL and execute test for “Remote” type.

      B) Define capabilities in a custom keyword and assign them to the driver (how?) and then run the execution type “Kobiton device” ?

      If you give me an example how to execute my tests in the Katalon Studio for the launched Kobiton device with installed app I will be very grateful.

      Thanks again.

      • This comment is edited.

        Hi there,

        Sorry for the missing info we gave there. In order to do step 3 easily in Katalon Studio, you just need to set capabilities that you get from Kobiton automation settings on ‘Remote’ settings (Project > Settings > Execution > Default > WebUI > Remote Web) :

        https://docs.katalon.com/display/KD/Execution+Settings

        Example:

        – Get automation settings from specific Kobiton device: http://prnt.sc/ekpa4v
        – Set capabilities in ‘ Remote’ settings: http://prnt.sc/ekpcpn . Remember to include appPackage and appActivity value also.
        – Execute test script using ‘Remote’ option.

        Hope this guide is useful enough for you :).

  2. Hi again and sorry for late response,

    I tried the approach described for the third step, but still experiencing the same error when running the test:

    Root cause: java.lang.NullPointerException: Name is null

    This error occurs in test every time I use some keyword from the Katalon Mobile API, e.g.:

    Mobile.verifyElementVisible(findTestObject('some_repo_element'), GlobalVariable.timeout)

    I believe this is due to the fact, that the appium driver used by the Katalon Mobile API is not initialized when running the tests with “Remote” option.

    I have a bunch of tests written for my real mobile Device (works fine) and I want to run these tests against Kobiton device.

    Could you please provide a code example of a small test (e.g. launching the app and the closing it) for native Android mobile app running remotely on a Kobiton device ?

    It would be very helpful to me.

    Thank you so much.

  3. Hi there,

    maybe I wasn’t so clear in my previous post so that I’ll ask in a diffrent way.

    Is there any possible way to run tests in Katalon with Remote execution option and test the native (browserName in capabilities is not defined) Android app with the usage of Katalon’s Mobile keywords ?

    It seems to me that this is not currently possible (or I don’t know how to do this), because the Remote execution option (and Kobiton option as well) is initiated always as a WebUI testing of web browser page.

    Thank you for any possible information.

  4. Have the same problem while trying to run a test written for Android native app through Kobiton Device.

    Unable to start app,  java.lang.NullPointerException: Name is null

    • This comment is edited.

      You can’t use your LOCAL application for execution with Kobiton cloud device due to the application is being available on your machine only, and Kobiton can’t access to your local environment. That error message indicates that root cause and it will be improved in next releases.

      I think Kobiton doesn’t support adding a gateway between your local environment and Kobiton cloud device yet.

      Thanks

      • Thanks for the quick response. Kobiton provides these automation settings:
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(“sessionName”, “Automation test session”);
        capabilities.setCapability(“sessionDescription”, “”);
        capabilities.setCapability(“deviceOrientation”, “portrait”);
        capabilities.setCapability(“captureScreenshots”, true);
        capabilities.setCapability(“app”, “<APP_URL>”);
        capabilities.setCapability(“deviceGroup”, “KOBITON”);
        capabilities.setCapability(“deviceName”, “Galaxy C5”);
        capabilities.setCapability(“platformVersion”, “6.0.1”);
        capabilities.setCapability(“platformName”, “Android”);

        but under Project Settings/Execution/Mobile there is no Kobiton option to add these.

    • Hi there,

      To set these options, you need to set it through ‘Remote’ settings and execute with Remote option

      Remote Web URL: It is Kobiton Server URL
      Other settings: Generated values you get from Kobiton

      Example: http://prntscr.com/f8vxa3

      Thanks

      • Hi there,

        I figured this solution as well but the main problem is in fact that running the tests with “Remote” option throws the mentioned error when you are using the Mobile keywords in test steps.

        It appears that running the tests with “Remote” option works only with the WebUI keywords.

        So that when you write local Android tests with the use of Mobile keywords, you cannot run these tests with “Remote” option against Kobiton URL.

  5. Hi there,

    We will adjust ‘Start Application’ to improve this one, so that you can pass in your generated Kobiton id and it can execute test script on kobiton device

    Thanks

Leave an answer