Skip to content

Instantly share code, notes, and snippets.

@bartekpacia
Last active July 22, 2023 16:51
Show Gist options
  • Save bartekpacia/77a6c383362906f0f7d80ed2d9f28164 to your computer and use it in GitHub Desktop.
Save bartekpacia/77a6c383362906f0f7d80ed2d9f28164 to your computer and use it in GitHub Desktop.
Decode test-results.pb file generated by ./gradlew connectedAndroidTest
# display in protoc "text format" without keys
protoc --decode_raw < test-result.pb
# display in protoc "text format" with keys (doesn't work and I don't know why)
protoc --decode android.am.ResultsBundleEntry instrumentation_data.proto < test-result.pb
# print in json using https://github.com/iamazeem/proto-convert
proto-convert \
--mode b2j \
--proto instrumentation_data.proto \
--msgtype android.am.ResultsBundleEntry \
--input test-result.pb \
--output test-result.json
# also try out --verbose
// https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/cmds/am/proto/instrumentation_data.proto
/*
* Copyright (C) 2016 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto2";
package android.am;
option java_package = "com.android.commands.am";
message ResultsBundleEntry {
optional string key = 1;
optional string value_string = 2;
optional sint32 value_int = 3;
optional float value_float = 4;
optional double value_double = 5;
optional sint64 value_long = 6;
optional ResultsBundle value_bundle = 7;
optional bytes value_bytes = 8;
}
message ResultsBundle {
repeated ResultsBundleEntry entries = 1;
}
message TestStatus {
optional sint32 result_code = 3;
optional ResultsBundle results = 4;
optional string logcat = 5;
}
enum SessionStatusCode {
/**
* The command ran successfully. This does not imply that the tests passed.
*/
SESSION_FINISHED = 0;
/**
* There was an unrecoverable error running the tests.
*/
SESSION_ABORTED = 1;
}
message SessionStatus {
optional SessionStatusCode status_code = 1;
optional string error_text = 2;
optional sint32 result_code = 3;
optional ResultsBundle results = 4;
}
message Session {
repeated TestStatus test_status = 1;
optional SessionStatus session_status = 2;
}
�"�
4
class+pl.leancode.patrol.example.MainActivityTest
current

idAndroidJUnitRunner
numtests
7
stream-
pl.leancode.patrol.example.MainActivityTest:
P
testHsends a notification, verifies that it is visible and taps on it by text
��"�
4
class+pl.leancode.patrol.example.MainActivityTest
current

idAndroidJUnitRunner
numtests
stream.
P
testHsends a notification, verifies that it is visible and taps on it by text*ʃ--------- beginning of main
01-13 17:46:25.911 10163 31475 31507 I flutter : 00:12 +3: All tests passed!
01-13 17:46:25.916 10146 1417 4136 W MediaProvider: isAppCloneUserPair for user 0: false
01-13 17:46:25.918 10146 1417 4136 V MediaProvider: Inserted id:1000000025 less than next row id backup:1000001000.
01-13 17:46:25.923 10163 31475 31475 I MonitoringInstr: Finishing activity: pl.leancode.patrol.example.MainActivity@d1ad129
01-13 17:46:25.924 1000 386 454 D goldfish-address-space: claimShared: Ask to claim region [0x1ef3b8000 0x1efa0c000]
01-13 17:46:25.930 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:25.931 10163 31475 31475 D LifecycleMonitor: Lifecycle status change: pl.leancode.patrol.example.MainActivity@d1ad129 in: PAUSED
01-13 17:46:25.942 10136 1109 1109 D MainContentCaptureSession: Flushing 1 event(s) for act:com.google.android.apps.nexuslauncher/.NexusLauncherActivity [state=2 (ACTIVE), disabled=false], reason=FULL
01-13 17:46:25.947 1002 852 1094 D BtGatt.ScanManager: uid 10108 isForeground true scanMode -1
01-13 17:46:25.947 1002 852 1094 D BtGatt.ScanManager: uid 10108 isForeground true scanMode -1
01-13 17:46:25.949 10108 921 27261 I NetworkScheduler.Stats: Task com.google.android.gms/com.google.android.gms.ipa.base.IpaGcmTaskService started execution. cause:9 exec_start_elapsed_seconds: 19727 [CONTEXT service_id=218 ]
01-13 17:46:25.950 10107 1420 1648 I AiAiEcho: Predicting[0]:
01-13 17:46:25.950 10107 1420 1648 I AiAiEcho: Ranked targets strategy: SORT, count: 0, ranking metadata:
01-13 17:46:25.950 10107 1420 1648 I AiAiEcho: #postPredictionTargets: Sending updates to UISurface lockscreen with targets# 0
01-13 17:46:25.950 10107 1420 1648 I AiAiEcho: #postPredictionTargets: Sending updates to UISurface home with targets# 0
01-13 17:46:25.950 10107 1420 1648 I AiAiEcho: #postPredictionTargets: Sending updates to UISurface media_data_manager with targets# 0
01-13 17:46:25.951 10109 1431 1985 I AssistantForeground: (REDACTED) Get launcher package: %s
01-13 17:46:25.952 10108 921 27261 I NetworkScheduler.Stats: Task com.google.android.gms/com.google.android.gms.ipa.base.IpaGcmTaskService finished executing. cause:9 result: 1 elapsed_millis: 14 uptime_millis: 14 exec_start_elapsed_seconds: 19727 [CONTEXT service_id=218 ]
01-13 17:46:25.954 1000 411 411 I BpBinder: onLastStrongRef automatically unlinking death recipients: <uncached descriptor>
01-13 17:46:25.958 1000 386 454 D goldfish-address-space: claimShared: Ask to claim region [0x1f2d18000 0x1f36fc000]
01-13 17:46:25.959 1000 386 454 D goldfish-address-space: claimShared: Ask to claim region [0x1f09a4000 0x1f1388000]
01-13 17:46:25.959 1000 386 454 D goldfish-address-space: claimShared: Ask to claim region [0x1f1388000 0x1f1d6c000]
01-13 17:46:25.961 1000 386 454 D goldfish-address-space: claimShared: Ask to claim region [0x1f6a6c000 0x1f7450000]
01-13 17:46:25.965 1000 386 454 D goldfish-address-space: claimShared: Ask to claim region [0x1f7450000 0x1f7e34000]
01-13 17:46:25.966 1000 386 454 D goldfish-address-space: claimShared: Ask to claim region [0x1f4000000 0x1f49e4000]
01-13 17:46:25.966 10109 1431 1431 I GsaVoiceInteractionSrv: Handling ACTION_START_HOTWORD
01-13 17:46:25.967 10109 1431 1951 I GsaVoiceInteractionSrv: (REDACTED) disregardVoiceMatch: %b
01-13 17:46:25.967 10109 1431 1951 I GsaVoiceInteractionSrv: Cannot start hotword, hotword has been explicitly disabled.
01-13 17:46:25.972 10136 1109 1109 E BcSmartspaceCard: No tap action can be set up
01-13 17:46:25.972 1000 411 465 W TransactionTracing: Could not find layer handle 0xb400007991d3a7b0
01-13 17:46:25.972 1000 411 465 W TransactionTracing: Could not find layer handle 0xb400007991d3de10
01-13 17:46:25.973 10136 1109 1109 D MainContentCaptureSession: Flushing 2 event(s) for act:com.google.android.apps.nexuslauncher/.NexusLauncherActivity [state=2 (ACTIVE), disabled=false], reason=FULL
01-13 17:46:25.974 10136 1109 1109 D MainContentCaptureSession: Flushing 32 event(s) for act:com.google.android.apps.nexuslauncher/.NexusLauncherActivity [state=2 (ACTIVE), disabled=false], reason=FULL
01-13 17:46:25.981 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:25.991 1000 411 1290 E SurfaceFlinger: Only WindowManager is allowed to use eEarlyWakeup[Start|End] flags
01-13 17:46:26.004 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.004 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.007 10114 1374 1374 I GoogleInputMethodService: GoogleInputMethodService.onFinishInput():3220
01-13 17:46:26.007 10136 1109 1109 D MainContentCaptureSession: Flushing 0 event(s) for act:com.google.android.apps.nexuslauncher/.NexusLauncherActivity [state=2 (ACTIVE), disabled=false], reason=VIEW_ROOT
01-13 17:46:26.007 10107 1420 1420 W ContentCaptureService: handleSendEvents() received empty list of events
01-13 17:46:26.008 10114 1374 1374 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2114 repeatCheckTimes = 0, unlocked = true
01-13 17:46:26.008 10114 1374 1374 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1919 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=com.google.android.apps.nexuslauncher fieldId=-1 fieldName=null extras=null}, false)
01-13 17:46:26.008 10114 1374 1374 I GoogleInputMethodService: GoogleInputMethodService.updateDeviceLockedStatus():2114 repeatCheckTimes = 2, unlocked = true
01-13 17:46:26.021 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.021 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.021 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.021 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.021 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.021 1000 411 465 W TransactionTracing: Could not find layer handle 0xb400007991d3d630
01-13 17:46:26.032 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.038 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.038 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.038 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.038 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.038 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.055 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.055 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.055 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.055 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.055 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.071 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.071 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.071 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.071 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.071 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.084 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.088 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.088 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.088 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.088 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.088 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.107 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.107 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.107 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.107 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.107 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.122 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.122 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.122 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.122 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.122 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.135 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.137 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.137 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.137 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.137 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.137 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.156 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.156 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.156 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.156 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.156 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.173 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.173 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.173 1000 387 506 I RanchuHwc: validateDisplay: layer 353 CompositionType 1, fallback to client
01-13 17:46:26.173 1000 387 506 I RanchuHwc: validateDisplay: layer 350 CompositionType 1, fallback to client
01-13 17:46:26.173 1000 387 506 I RanchuHwc: validateDisplay: layer 349 CompositionType 1, fallback to client
01-13 17:46:26.186 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.187 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.187 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.204 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.204 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.223 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.223 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.238 1000 387 506 I RanchuHwc: validateDisplay: layer 351 CompositionType 1, fallback to client
01-13 17:46:26.238 1000 387 506 I RanchuHwc: validateDisplay: layer 352 CompositionType 1, fallback to client
01-13 17:46:26.238 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.273 1000 411 662 E SurfaceFlinger: Only WindowManager is allowed to use eEarlyWakeup[Start|End] flags
01-13 17:46:26.289 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.321 1000 411 465 W TransactionTracing: Could not find layer id -1
01-13 17:46:26.339 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.390 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.440 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
--------- beginning of system
01-13 17:46:26.460 1000 574 574 W AccessibilityManagerService: wait for adding window timeout: 592
01-13 17:46:26.472 1000 411 465 W TransactionTracing: Could not find layer id -1
01-13 17:46:26.472 1000 411 465 W TransactionTracing: Could not find layer id -1
01-13 17:46:26.491 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.541 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.556 1000 411 465 W TransactionTracing: Could not find layer id -1
01-13 17:46:26.573 10136 1109 1109 D MainContentCaptureSession: Flushing 1 event(s) for act:com.google.android.apps.nexuslauncher/.NexusLauncherActivity [state=2 (ACTIVE), disabled=false], reason=FULL
01-13 17:46:26.573 10136 1109 1109 D MainContentCaptureSession: Flushing 2 event(s) for act:com.google.android.apps.nexuslauncher/.NexusLauncherActivity [state=2 (ACTIVE), disabled=false], reason=FULL
01-13 17:46:26.591 10163 31475 31494 I MonitoringInstr: Unstopped activity count: 1
01-13 17:46:26.615 10163 31475 31475 D LifecycleMonitor: Lifecycle status change: pl.leancode.patrol.example.MainActivity@d1ad129 in: STOPPED
01-13 17:46:26.618 10163 31475 31475 D FlutterGeolocator: Detaching Geolocator from activity
01-13 17:46:26.619 10163 31475 31475 D FlutterGeolocator: Flutter engine disconnected. Connected engine count 0
01-13 17:46:26.620 10163 31475 31475 D FlutterGeolocator: Disposing Geolocator services
01-13 17:46:26.620 10163 31475 31475 E FlutterGeolocator: Geolocator position updates stopped
01-13 17:46:26.620 10163 31475 31475 D FlutterGeolocator: Stopping location service.
01-13 17:46:26.636 10163 31475 31475 D LifecycleMonitor: Lifecycle status change: pl.leancode.patrol.example.MainActivity@d1ad129 in: DESTROYED
01-13 17:46:26.637 1000 574 2080 D CoreBackPreview: Window{798eace u0 pl.leancode.patrol.example/pl.leancode.patrol.example.MainActivity}: Setting back callback null
01-13 17:46:26.639 1000 574 2080 W InputManager-JNI: Input channel object '798eace pl.leancode.patrol.example/pl.leancode.patrol.example.MainActivity (client)' was disposed without first being removed with the input manager!
01-13 17:46:26.641 10163 31475 31475 D FlutterGeolocator: Unbinding from location service.
01-13 17:46:26.641 10163 31475 31475 D FlutterGeolocator: Destroying location service.
01-13 17:46:26.641 10163 31475 31475 D FlutterGeolocator: Stopping location service.
01-13 17:46:26.641 10163 31475 31475 D FlutterGeolocator: Destroyed location service.
01-13 17:46:26.642 10163 31475 31494 I TestRunner: finished: sends a notification, verifies that it is visible and taps on it by text(pl.leancode.patrol.example.MainActivityTest)
01-13 17:46:26.654 1000 411 465 W TransactionTracing: Could not find layer handle 0xb400007991d3df90
01-13 17:46:26.654 1000 411 465 W TransactionTracing: Could not find layer handle 0xb400007991d33b50
01-13 17:46:26.654 1000 411 465 W TransactionTracing: Could not find layer handle 0xb400007991d36970
01-13 17:46:26.654 1000 411 465 W TransactionTracing: Could not find layer handle 0xb400007991d3e890
01-13 17:46:26.654 1000 411 465 W TransactionTracing: Could not find layer handle 0xb400007991d3e890
�"�
4
class+pl.leancode.patrol.example.MainActivityTest
current

idAndroidJUnitRunner
numtests

stream
Q
testIsends a notification, verifies that it is visible and taps on it by index
�"�
4
class+pl.leancode.patrol.example.MainActivityTest
current

idAndroidJUnitRunner
numtests
stream.
Q
testIsends a notification, verifies that it is visible and taps on it by index*�--------- beginning of kernel
01-13 17:46:26.672 logd 229 229 I logd : logdr: UID=2000 GID=2000 PID=31595 n tail=0 logMask=99 pid=0 start=1673628385911000000ns deadline=0ns
--------- beginning of main
01-13 17:46:26.670 10163 31475 31494 I TestRunner: started: sends a notification, verifies that it is visible and taps on it by index(pl.leancode.patrol.example.MainActivityTest)
01-13 17:46:26.671 10163 31475 31494 I TestRunner: finished: sends a notification, verifies that it is visible and taps on it by index(pl.leancode.patrol.example.MainActivityTest)
."*
(
stream
Time: 13.447
OK (2 tests)
@bartekpacia
Copy link
Author

bartekpacia commented Jul 22, 2023

This doesn't work for some reason.

I'm investigating how Android Studio does this: code link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment