Opened 3 years ago

Closed 3 years ago

#4675 closed defect (fixed)

Can't run android tests from Android Studio

Reported by: asmirnov Assignee: asmirnov
Priority: P2 Milestone:
Module: Libadblockplus-Android Keywords:
Cc: Blocked By:
Blocking: Platform: Android
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29365787/

Description

Environment

One can run android tests in libadblockplus-android right from Android Studio. However now it's not working

How to reproduce

  1. Navigate to any test in org.adblockplus.libadblockplus.tests
  2. Click Run ... Test'
  3. Make sure you see the following:
    Testing started at 17:33 ...
    
    11/30 17:33:48: Launching testFilterCreation...()
    No apk changes detected since last installation, skipping installation of /Users/asmirnov/Documents/dev/src/libadblockplus-android.ssh/libadblockplus-android-tests/build/outputs/apk/libadblockplus-android-tests-debug.apk
    $ adb shell am force-stop org.adblockplus.libadblockplus.tests
    $ adb push /Users/asmirnov/Documents/dev/src/libadblockplus-android.ssh/libadblockplus-android-tests/build/outputs/apk/libadblockplus-android-tests-debug-androidTest.apk /data/local/tmp/org.adblockplus.libadblockplus.tests.test
    $ adb shell pm install -r "/data/local/tmp/org.adblockplus.libadblockplus.tests.test"
    WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
    	pkg: /data/local/tmp/org.adblockplus.libadblockplus.tests.test
    Success
    
    
    Running tests
    
    $ adb shell am instrument -w -r   -e debug false -e class org.adblockplus.libadblockplus.tests.FilterEngineTest#testFilterCreation org.adblockplus.libadblockplus.tests.test/android.test.InstrumentationTestRunner
    Client not ready yet..
    Started running tests
    Test running failed: Unable to find instrumentation info for: ComponentInfo{org.adblockplus.libadblockplus.tests.test/android.test.InstrumentationTestRunner}
    Empty test suite.
    
    

Observed behaviour

You got error message - no tests were started

Expected behaviour

The test is started and you can see test result (failed/passed) right in Android Studio.

Change History (4)

comment:1 Changed 3 years ago by asmirnov

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 3 years ago by asmirnov

after the changes in related code review the tests can be launched:

ok

Testing started at 17:47 ...

11/30 17:47:52: Launching testFilterCreation...()
$ adb push /Users/asmirnov/Documents/dev/src/libadblockplus-android.ssh/libadblockplus-android-tests/build/outputs/apk/libadblockplus-android-tests-debug.apk /data/local/tmp/org.adblockplus.libadblockplus.tests
$ adb shell pm install -r "/data/local/tmp/org.adblockplus.libadblockplus.tests"
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
	pkg: /data/local/tmp/org.adblockplus.libadblockplus.tests
Success


$ adb push /Users/asmirnov/Documents/dev/src/libadblockplus-android.ssh/libadblockplus-android-tests/build/outputs/apk/libadblockplus-android-tests-debug-androidTest-unaligned.apk /data/local/tmp/org.adblockplus.libadblockplus.tests.test
$ adb shell pm install -r "/data/local/tmp/org.adblockplus.libadblockplus.tests.test"
WARNING: linker: libdvm.so has text relocations. This is wasting memory and is a security risk. Please fix.
	pkg: /data/local/tmp/org.adblockplus.libadblockplus.tests.test
Success


Running tests

$ adb shell am instrument -w -r   -e debug false -e class org.adblockplus.libadblockplus.tests.FilterEngineTest#testFilterCreation org.adblockplus.libadblockplus.tests.test/android.test.InstrumentationTestRunner
Client not ready yet..
Started running tests
Tests ran to completion.

comment:3 Changed 3 years ago by abpbot

A commit referencing this issue has landed:
Issue 4675 - Can't run android tests from Android Studio

comment:4 Changed 3 years ago by asmirnov

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.