Search Unity

How to run Test on a device from apk directly.

Discussion in 'Testing & Automation' started by caudras, Jul 8, 2022.

  1. caudras

    caudras

    Joined:
    Apr 11, 2022
    Posts:
    4
    Hello,

    I am using Unity TestRunner 2.0.1-pre18 and I want to run the tests from an apk directly installed on a Android device.

    problem:
    Every time, I run a test from command line the Editor build the apk first before running the tests.

    Current situation:
    I am able to build the apk with the test inside but I don't know how to run them directly on the device without rebuilding the apk every time.
     
  2. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
    Hey @caudras, I'm looking into developing this as well. Can you provide any documentation that points to how you actually do unit testing on a device?
     
  3. caudras

    caudras

    Joined:
    Apr 11, 2022
    Posts:
    4
  4. Warnecke

    Warnecke

    Unity Technologies

    Joined:
    Nov 28, 2017
    Posts:
    92
    The test launcher is build into the scene in the apk and should start up automatically when the apk is launched, so you should see it try to run the tests whenever it is launched. If the editor is open, then you should see the test results being send to the test runner window, even when not initialized from there.
    If you want an alternative way of receiving the test results, then you can create a TestRunCallback.
     
  5. caudras

    caudras

    Joined:
    Apr 11, 2022
    Posts:
    4
    Sorry for the delay. Thank you I will try that.
    Also how can I tell the which test I want to run ? I would like to be able to tell by command line that I want to run a particular test, is it possible ?
     
  6. trooper

    trooper

    Joined:
    Aug 21, 2009
    Posts:
    748
    Did you ever figure this out? Is Unity Test Framework viable to run single tests on device from command line?
     
  7. Warnecke

    Warnecke

    Unity Technologies

    Joined:
    Nov 28, 2017
    Posts:
    92