News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

no datas

If we want to have one driver instance and execute two parallel test cases. What we will use multithreading or multiprocessing?

posted on 2023-11-12 14:30     read(599)     comment(0)     like(5)     collect(3)


This is what needs to be achieved: we create a driver instance. start two threads/processes - one will execute the signup (or any other) testcase and the second will execute another testcase (a trigger, change network to slow, or otherwise)


solution


I've read that python itself wasn't really built with multi-threading in mind like other languages (although there are packages that claim to do this), so I would lean towards multi-processing. You should be able to pass necessary data to corresponding parts of the code (the different processes) to do what you wish. If you're doing things that involve the same driver in both tests, you may want to consider either not running the tests at the same time (order them), or make two driver instances and pass one to each process (although I've seen some problems trying to do this with the requests package trying to make too many simultaneous connections, this was without multi-processing though). If this is a problem you run into with multi-processing, it would be interesting to see if multi-threading handles this, but you may have to run the tests simultaneously on different machines or VM's if neither provides a solution. Hope this helps



Category of website: technical article > Q&A

Author:qs

link:http://www.pythonblackhole.com/blog/article/245162/da94b6f68b66838abe60/

source:python black hole net

Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.

5 0
collect article
collected

Comment content: (supports up to 255 characters)