Bluetooth: add failed reason to test_device_found and test_device_lost
Currently, when test_device_found failed, we only shows
"failed: test_device_found (None)" in both terminal. This makes it hard
to categorize different types of error on Stainless.
This patch adds the failed reason to test_device_found and
test_device_lost. A failed test would look like this:
"failed: test_device_found ({'Found events': 0, 'Expected events': 1})"
BUG=None
TEST=run bluetooth_AdapterAdvMonitor
Change-Id: I7156d087562b9ef856bdefaa253933184bc8849d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2936580
Reviewed-by: Manish Mandlik <mmandlik@chromium.org>
Reviewed-by: Yun-Hao Chung <howardchung@chromium.org>
Reviewed-by: Archie Pusaka <apusaka@chromium.org>
Tested-by: Manish Mandlik <mmandlik@chromium.org>
Commit-Queue: Yun-Hao Chung <howardchung@chromium.org>
diff --git a/server/cros/bluetooth/bluetooth_adapter_adv_monitor_tests.py b/server/cros/bluetooth/bluetooth_adapter_adv_monitor_tests.py
index 1bf6bd9..ace4dda 100644
--- a/server/cros/bluetooth/bluetooth_adapter_adv_monitor_tests.py
+++ b/server/cros/bluetooth/bluetooth_adapter_adv_monitor_tests.py
@@ -538,8 +538,18 @@
checked_count = self.get_event_count(app_id, monitor_id, 'DeviceFound')
if count == self.MULTIPLE_EVENTS:
+ self.results = {
+ 'Found events': checked_count,
+ 'Expected events': 'multiple'
+ }
+
return checked_count > 0
+ self.results = {
+ 'Found events': checked_count,
+ 'Expected events': count
+ }
+
return checked_count == count
@@ -565,8 +575,18 @@
checked_count = self.get_event_count(app_id, monitor_id, 'DeviceLost')
if count == self.MULTIPLE_EVENTS:
+ self.results = {
+ 'Found events': checked_count,
+ 'Expected events': 'multiple'
+ }
+
return checked_count > 1
+ self.results = {
+ 'Found events': checked_count,
+ 'Expected events': count
+ }
+
return checked_count == count