I'm testing mobile applications using Appium and pytest. Following error appears when I'm trying to pass a list of dictionaries through the parametrized pytest mark.
WebDriverException: Message: Desired Capabilities must be a dictionary
It works fine when I'm not using @pytest.mark.parametrize()
and pass desired capabilities directly as a dictionary to webdriver.Remote
.
I've simplified my code a little bit for better understanding:
class TestQATestProject(object):
def get_all(self):
return [
{'platformName': 'Android'},
{'platformName': 'Android'}
]
@pytest.mark.parametrize('desired_caps', get_all())
def setup_method(self, desired_caps):
self.driver = webdriver.Remote('http://localhost:4723/wd/hub',
desired_caps)
self.driver.implicitly_wait(5000)
[UPD] I've figured out that @pytest.mark.parametrize
doesn't work properly for setup_method
. So is there another way to run tests on different configs?