Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lambdatest integration java.lang.RuntimeException: Unable to instantiate instrumentation #2493

Open
DmytroChuchmaiBarges opened this issue Jan 16, 2025 · 5 comments
Assignees
Labels
device farms integration Related to issues with running patrol on device farms

Comments

@DmytroChuchmaiBarges
Copy link

DmytroChuchmaiBarges commented Jan 16, 2025

Steps to reproduce

  1. Write any patrol test, and make sure it is running with patrol_cli 3.4.1
  2. open /app/build.gradle and replace testInstrumentationRunner "pl.leancode.patrol.PatrolJUnitRunner" with pl.leancode.patrol.LambdaTestPatrolJUnitRunner
  3. run "patrol test --targets integration_test/your_test.dart --debug --verbose"
    expected: the tests should normally run
    actual: test don't run, an app is installed on emulator and then deleted
    when upload to LambdaTest, same behavior in the test logs, as in local test report

Actual results

When I build an app with testInstrumentationRunner "pl.leancode.patrol.LambdaTestPatrolJUnitRunner"
upload to lambdatest or run tests locally via "patrol test" command
it produces an error in test report:

java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{com.myapp.stage.test/pl.leancode.patrol.LambdaTestPatrolJUnitRunner}: java.lang.ClassNotFoundException: Didn't find class "pl.leancode.patrol.LambdaTestPatrolJUnitRunner"

Logs

Logs
java.lang.RuntimeException: Unable to instantiate instrumentation ComponentInfo{com.myapp.stage.test/pl.leancode.patrol.LambdaTestPatrolJUnitRunner}: java.lang.ClassNotFoundException: Didn't find class "pl.leancode.patrol.LambdaTestPatrolJUnitRunner"
on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.base.jar", zip file "/data/app/~mMW9Tm-zvsGOd0DDxE2vhA==/com.myapp.stage.test-ElPT892YUgrP1yN5Z3ZkSg==/base.apk", zip file "/data/app/~~JQpVigu8CctLgvcT3ao-qg==/com.myapp.stage.test-plChV-l37OLMbYeJfvtJiw==/base.apk"],nativeLibraryDirectories=[/system/lib64, /system_ext/lib64]]

Patrol version

patrol: 3.13.1

Patrol Doctor output

Patrol Doctor output
Patrol CLI version: 3.4.1
Flutter command: flutter 
  Flutter 3.24.4 • channel [user-branch]
Android: 
• Program adb found in /Users/dchuchmai/Library/Android/sdk/platform-tools/adb
• Env var $ANDROID_HOME set to /Users/dchuchmai/Library/Android/sdk
iOS / macOS: 
• Program xcodebuild found in /usr/bin/xcodebuild
• Program ideviceinstaller found in /opt/homebrew/bin/ideviceinstaller

Flutter Doctor output

Flutter Doctor output
[!] Flutter (Channel [user-branch], 3.24.4, on macOS 15.1.1 24B91 darwin-arm64, locale en-UA)
    ! Flutter version 3.24.4 on channel [user-branch] at /Users/dchuchmai/src/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    ! Upstream repository unknown source is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.95.3)
[✓] Connected device (4 available)
[✓] Network resources
@Paul2022-app
Copy link

Same Issue

@zoskar zoskar self-assigned this Jan 20, 2025
@zoskar
Copy link

zoskar commented Jan 22, 2025

Hi @DmytroChuchmaiBarges, thanks for the report. We will investigate that

@zoskar zoskar assigned fylyppo and unassigned zoskar Jan 22, 2025
@zoskar zoskar added the device farms integration Related to issues with running patrol on device farms label Jan 22, 2025
@DmytroChuchmaiBarges
Copy link
Author

patrol 3.14 and cli 3.5.0
I got following output from lambdatest:
`INSTRUMENTATION_STATUS: class=co.myapppackage.android.staging_new.MainActivityTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stream=
co.myapppackage.android.staging_new.MainActivityTest:
INSTRUMENTATION_STATUS: test=initializationError
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS: class=co.myapppackage.android.staging_new.MainActivityTest
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: stack=java.lang.RuntimeException: pl.leancode.patrol.contracts.PatrolAppServiceClientException: Invalid response 500, dial tcp 127.0.0.1:8082: connect: connection refused

at pl.leancode.patrol.PatrolJUnitRunner.listDartTests(PatrolJUnitRunner.java:126)
at co.myapppackage.android.staging_new.MainActivityTest.testCases(MainActivityTest.java:17)
... 21 trimmed

Caused by: pl.leancode.patrol.contracts.PatrolAppServiceClientException: Invalid response 500, dial tcp 127.0.0.1:8082: connect: connection refused

at pl.leancode.patrol.contracts.PatrolAppServiceClient.listDartTests(PatrolAppServiceClient.kt:18)
at pl.leancode.patrol.PatrolAppServiceClient.listDartTests(PatrolAppServiceClient.kt:46)
at pl.leancode.patrol.PatrolJUnitRunner.listDartTests(PatrolJUnitRunner.java:114)
... 23 more

INSTRUMENTATION_STATUS: stream=
Error in initializationError(co.myapppackage.android.staging_new.MainActivityTest):
java.lang.RuntimeException: pl.leancode.patrol.contracts.PatrolAppServiceClientException: Invalid response 500, dial tcp 127.0.0.1:8082: connect: connection refused

at pl.leancode.patrol.PatrolJUnitRunner.listDartTests(PatrolJUnitRunner.java:126)
at co.myapppackage.android.staging_new.MainActivityTest.testCases(MainActivityTest.java:17)
... 21 trimmed

Caused by: pl.leancode.patrol.contracts.PatrolAppServiceClientException: Invalid response 500, dial tcp 127.0.0.1:8082: connect: connection refused

at pl.leancode.patrol.contracts.PatrolAppServiceClient.performRequest(PatrolAppServiceClient.kt:47)
at pl.leancode.patrol.contracts.PatrolAppServiceClient.performRequest$default(PatrolAppServiceClient.kt:27)
at pl.leancode.patrol.contracts.PatrolAppServiceClient.listDartTests(PatrolAppServiceClient.kt:18)
at pl.leancode.patrol.PatrolAppServiceClient.listDartTests(PatrolAppServiceClient.kt:46)
at pl.leancode.patrol.PatrolJUnitRunner.listDartTests(PatrolJUnitRunner.java:114)
... 23 more

INSTRUMENTATION_STATUS: test=initializationError
INSTRUMENTATION_STATUS_CODE: -2`

@Paul2022-app
Copy link

I fixed it after running flutter clean

@DmytroChuchmaiBarges
Copy link
Author

I fixed it after running flutter clean

with 3.14 it builds fine but on LambdaTest it runs a very first test and fails the build, and the results show all (11 in my case) tests but when you open to watch video, it shows the video from that 1st test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
device farms integration Related to issues with running patrol on device farms
Projects
None yet
Development

No branches or pull requests

4 participants