简体   繁体   中英

When trying to run parallel tests on same browser I seem to run only 2 max

Here's my command:

 pytest -v -s -n=4 test_Cases/test_login.py --browser chrome

Here's the output:

plugins: xdist-3.1.0, html-3.2.0, metadata-2.0.4
[gw0] darwin Python 3.8.0 cwd: /Users/georgeashraf/My-    Github/Hybrid_Framework_Selenium_Python
[gw1] darwin Python 3.8.0 cwd: /Users/georgeashraf/My-Github/Hybrid_Framework_Selenium_Python
[gw2] darwin Python 3.8.0 cwd: /Users/georgeashraf/My-Github/Hybrid_Framework_Selenium_Python
[gw3] darwin Python 3.8.0 cwd: /Users/georgeashraf/My-Github/Hybrid_Framework_Selenium_Python
[gw0] Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)  -- [Clang 6.0 (clang-600.0.57)]
[gw1] Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)  -- [Clang 6.0 (clang-600.0.57)]
[gw2] Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)  -- [Clang 6.0 (clang-600.0.57)]
[gw3] Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)  -- [Clang 6.0 (clang-600.0.57)]
gw0 [2] / gw1 [2] / gw2 [2] / gw3 [2]
scheduling tests via LoadScheduling

test_Cases/test_login.py::Test_001_Login::test_homepagetitle 
test_Cases/test_login.py::Test_001_Login::test_login 
[gw0] PASSED test_Cases/test_login.py::Test_001_Login::test_homepagetitle 
[gw1] PASSED test_Cases/test_login.py::Test_001_Login::test_login 

I can see only see [gw0] & [gw1] that are passed in the output and I can't run it for [gw2]&[gw3]

Is there something I am missing?

I'm trying to run parallel tests on 4 browsers but only get 2 max

It seems that your file test_login.py has only 2 tests in it and so only 2 tests are collected by pytest. If you want to run all the tests in the test_Cases folder, you could use the command

pytest -v -s -n=4 test_Cases --browser chrome

This would run all tests in the test_Cases folder in chrome browser only with 4 parallel workers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM