0
UI 테스트 (pytest)와 셀레늄 그리드가 있습니다. 그리고 동시에 다른 브라우저에서 내 소송을 진행하고 싶습니다. 예 :pytest를 사용하는 다른 브라우저에서 Selenium 테스트 실행
py.test test.py --browser "internet explorer;chrome"
내 셀렌 그리드의 서로 다른 호스트에서 두 개의 병렬 세션이 필요합니다.
test.py :
class TestSuit:
def test_1(self, app):
app.do_smth()
assert True
def test_2(self, app):
app.do_smth()
assert True
application.py :
class Application:
def __init__(self, browser_name):
self.driver = webdriver.Remote(
command_executor='http://host:port/wd/hub,
desired_capabilities={'browserName': browser_name}
)
conftest.py :
def pytest_addoption(parser):
parser.addoption("--browser", action="store")
def pytest_generate_tests(metafunc):
metafunc.parametrize(
'browser_name',
metafunc.config.getoption('browser').split(';'),
scope='session'
)
@pytest.fixture(scope='session')
def app(browser_name):
return Application(browser_name)
하지만 IE와 첫 번째 호스트에 내 테스트를 실행 얻을하고 크롬으로 2 위를 차지했습니다.
각 호스트에서 동시에 두 개의 병렬 세션을 실행하는 방법은 무엇입니까?