Unable to run test on appium through python interpreter ,device id is not being recognized even after adb devicee configured

C:\Users\SHIVANSH\PycharmProjects\magic-test(real)\venv\Scripts\python.exe “C:\Program Files\JetBrains\PyCharm Community Edition 2020.3.3\plugins\python-ce\helpers\pycharm_jb_pytest_runner.py” --path C:/Users/SHIVANSH/PycharmProjects/magic-test(real)/src/spec/tests/iotfy_home_screen/test_sample.py
Testing started at 18:20 …
Launching pytest with arguments C:/Users/SHIVANSH/PycharmProjects/magic-test(real)/src/spec/tests/iotfy_home_screen/test_sample.py in C:\Users\SHIVANSH\PycharmProjects\magic-test(real)\src\spec\tests\iotfy_home_screen

============================= test session starts =============================
platform win32 – Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.1 – C:\Users\SHIVANSH\PycharmProjects\magic-test(real)\venv\Scripts\python.exe
cachedir: .pytest_cache
rootdir: C:\Users\SHIVANSH\PycharmProjects\magic-test(real), configfile: pytest.ini
plugins: allure-pytest-2.8.36, forked-1.3.0, html-reporter-0.0.9, json-0.4.0, parallel-0.1.0, rerunfailures-9.1.1, sugar-0.9.4, xdist-2.2.1
collecting … collected 3 items

test_sample.py::TestIotfyHome::test_data_reader ← src\spec\tests\base_test.py skip clear

test_sample.py::TestIotfyHome::test_verify_add_new_device_screen_from_button SKIPPED
Skipped: unconditional skip
Generate new instance
[DEBUG] Running command: adb devices |sed ‘2,2!d’ | awk ‘{print $1}’ > connected_android_devices
[DEBUG] output: b’’
[DEBUG] error: b"‘awk’ is not recognized as an internal or external command,\r\noperable program or batch file.\r\n"
[DEBUG] Running command: adb -s shell pm grant com.iotfy.smartthings android.permission.WRITE_EXTERNAL_STORAGE
[DEBUG] output: b’’
[DEBUG] error: b’adb.exe: unknown command pm\r\n’
[DEBUG] Running command: adb -s shell pm grant com.iotfy.smartthings android.permission.READ_EXTERNAL_STORAGE
[DEBUG] output: b’’
[DEBUG] error: b’adb.exe: unknown command pm\r\n’
[DEBUG] Running command: adb -s shell settings put global window_animation_scale 0
[DEBUG] output: b’’
[DEBUG] error: b’adb.exe: unknown command global\r\n’
[DEBUG] Running command: adb -s shell settings put global transition_animation_scale 0
[DEBUG] output: b’’
[DEBUG] error: b’adb.exe: unknown command global\r\n’
[DEBUG] Running command: adb -s shell settings put global animator_duration_scale 0
[DEBUG] output: b’’
[DEBUG] error: b’adb.exe: unknown command global\r\n’
2021-03-08 18:20:29,207 [INFO | appiumdriver.py:19] > Configuring desired capabilities
2021-03-08 18:20:29,208 [INFO | appiumdriver.py:34] > Initiating Appium driver
[DEBUG] Running command: adb -s logcat -c
[DEBUG] output: b’’
[DEBUG] error: b’adb.exe: unknown command -c\r\n’
[DEBUG] Running command: adb -s shell pidof com.iotfy.smartthings
[DEBUG] output: b’’
[DEBUG] error: b’adb.exe: unknown command pidof\r\n’
pid: b’’
ERROR
test setup failed
self = <test_sample.TestIotfyHome object at 0x00000216290A8BE0>
app_name = ‘android’, device_name = ‘real device’
appium_driver_fixture = <src.helpers.app.MobileApp object at 0x0000021628CFC070>

@pytest.fixture(autouse=True)
def cli(self, app_name, device_name,appium_driver_fixture):
    self.logger = Logger.__call__().get_logger()
    self.driver = appium_driver_fixture
    self.device_setting = DeviceSettings()
    self.device_serial = self.device_setting.get_device_serial()
  self.device_setting.start_playback_recording(self.device_serial)

…\base_test.py:19:


…....\helpers\performance_stats.py:77: in start_playback_recording
self.device_utility.start_logcat_process()


self = <src.helpers.android_util.AndroidUtility object at 0x0000021629088C10>

def start_logcat_process(self):
    self.logcat_log = os.path.join(self.workspace, '%s_logcat.txt' % self.device_serial)
    self.cleanup_logcat_buffer()
    proc_id = self.get_app_proc()
  self.logcat_proc = subprocess.Popen(self.adb_logcat + ' --pid=' + proc_id + ' > ' + self.logcat_log,
                                        stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)

E TypeError: can only concatenate str (not “bytes”) to str

…....\helpers\android_util.py:167: TypeError
[DEBUG] Running command: adb -s logcat -c
[DEBUG] output: b’’
[DEBUG] error: b’adb.exe: unknown command -c\r\n’
[DEBUG] Running command: adb -s shell pidof com.iotfy.smartthings
[DEBUG] output: b’’
[DEBUG] error: b’adb.exe: unknown command pidof\r\n’
pid: b’’
ERROR
test setup failed
self = <test_sample.TestIotfyHome object at 0x000002162908A6D0>
app_name = ‘android’, device_name = ‘real device’
appium_driver_fixture = <src.helpers.app.MobileApp object at 0x0000021628CFC070>

@pytest.fixture(autouse=True)
def cli(self, app_name, device_name,appium_driver_fixture):
    self.logger = Logger.__call__().get_logger()
    self.driver = appium_driver_fixture
    self.device_setting = DeviceSettings()
    self.device_serial = self.device_setting.get_device_serial()
  self.device_setting.start_playback_recording(self.device_serial)

…\base_test.py:19:


…....\helpers\performance_stats.py:77: in start_playback_recording
self.device_utility.start_logcat_process()


self = <src.helpers.android_util.AndroidUtility object at 0x00000216260FA8B0>

def start_logcat_process(self):
    self.logcat_log = os.path.join(self.workspace, '%s_logcat.txt' % self.device_serial)
    self.cleanup_logcat_buffer()
    proc_id = self.get_app_proc()
  self.logcat_proc = subprocess.Popen(self.adb_logcat + ' --pid=' + proc_id + ' > ' + self.logcat_log,
                                        stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)

E TypeError: can only concatenate str (not “bytes”) to str

…....\helpers\android_util.py:167: TypeError

Assertion failed

Assertion failed

Assertion failed

Assertion failed

Assertion failed
skip clear
setting up a test failed! src/spec/tests/iotfy_home_screen/test_sample.py::TestIotfyHome::test_verify_add_new_device_screen_from_button

test_sample.py::TestIotfyHome::test_verify_quick_connect skip clear
setting up a test failed! src/spec/tests/iotfy_home_screen/test_sample.py::TestIotfyHome::test_verify_quick_connect

=================================== ERRORS ====================================
_ ERROR at setup of TestIotfyHome.test_verify_add_new_device_screen_from_button _

self = <test_sample.TestIotfyHome object at 0x00000216290A8BE0>
app_name = ‘android’, device_name = ‘real device’
appium_driver_fixture = <src.helpers.app.MobileApp object at 0x0000021628CFC070>

@pytest.fixture(autouse=True)
def cli(self, app_name, device_name,appium_driver_fixture):
    self.logger = Logger.__call__().get_logger()
    self.driver = appium_driver_fixture
    self.device_setting = DeviceSettings()
    self.device_serial = self.device_setting.get_device_serial()
  self.device_setting.start_playback_recording(self.device_serial)

…\base_test.py:19:


…....\helpers\performance_stats.py:77: in start_playback_recording
self.device_utility.start_logcat_process()


self = <src.helpers.android_util.AndroidUtility object at 0x0000021629088C10>

def start_logcat_process(self):
    self.logcat_log = os.path.join(self.workspace, '%s_logcat.txt' % self.device_serial)
    self.cleanup_logcat_buffer()
    proc_id = self.get_app_proc()
  self.logcat_proc = subprocess.Popen(self.adb_logcat + ' --pid=' + proc_id + ' > ' + self.logcat_log,
                                        stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)

E TypeError: can only concatenate str (not “bytes”) to str

…....\helpers\android_util.py:167: TypeError
----------------------------- Captured log setup ------------------------------
INFO crumbs:appiumdriver.py:19 Configuring desired capabilities
INFO crumbs:appiumdriver.py:34 Initiating Appium driver
__________ ERROR at setup of TestIotfyHome.test_verify_quick_connect __________

self = <test_sample.TestIotfyHome object at 0x000002162908A6D0>
app_name = ‘android’, device_name = ‘real device’
appium_driver_fixture = <src.helpers.app.MobileApp object at 0x0000021628CFC070>

@pytest.fixture(autouse=True)
def cli(self, app_name, device_name,appium_driver_fixture):
    self.logger = Logger.__call__().get_logger()
    self.driver = appium_driver_fixture
    self.device_setting = DeviceSettings()
    self.device_serial = self.device_setting.get_device_serial()
  self.device_setting.start_playback_recording(self.device_serial)

…\base_test.py:19:


…....\helpers\performance_stats.py:77: in start_playback_recording
self.device_utility.start_logcat_process()


self = <src.helpers.android_util.AndroidUtility object at 0x00000216260FA8B0>

def start_logcat_process(self):
    self.logcat_log = os.path.join(self.workspace, '%s_logcat.txt' % self.device_serial)
    self.cleanup_logcat_buffer()
    proc_id = self.get_app_proc()
  self.logcat_proc = subprocess.Popen(self.adb_logcat + ' --pid=' + proc_id + ' > ' + self.logcat_log,
                                        stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)

E TypeError: can only concatenate str (not “bytes”) to str

…....\helpers\android_util.py:167: TypeError
============================== warnings summary ===============================
test_sample.py:11
C:\Users\SHIVANSH\PycharmProjects\magic-test(real)\src\spec\tests\iotfy_home_screen\test_sample.py:11: PytestUnknownMarkWarning: Unknown pytest.mark.sanity - is this a typo? You can register custom marks to avoid this warning - for details, see How to mark test functions with attributes — pytest documentation
@pytest.mark.sanity

test_sample.py:23
C:\Users\SHIVANSH\PycharmProjects\magic-test(real)\src\spec\tests\iotfy_home_screen\test_sample.py:23: PytestUnknownMarkWarning: Unknown pytest.mark.sanity - is this a typo? You can register custom marks to avoid this warning - for details, see How to mark test functions with attributes — pytest documentation
@pytest.mark.sanity

– Docs: How to capture warnings — pytest documentation

  • generated json report: C:\Users\SHIVANSH\PycharmProjects\magic-test(real)\src\spec\tests\iotfy_home_screen\report\json\report.json -
    ================== 1 skipped, 2 warnings, 2 errors in 28.69s ==================

Process finished with exit code 1

Assertion failed

Assertion failed

this is main test failure issue