static Webdriver instance synchronization in java

后端 未结 4 1342
北荒
北荒 2020-12-05 22:05

GlobalVariables class holds different variables which are used across my framework one of them is WebDriver instance:

  public class GlobalVariables
                 


        
4条回答
  •  臣服心动
    2020-12-05 23:04

    If you are going to run non-parallel, then using a static webdriver member (or a instance shared between test classes by passing by reference) is fine because it is a good way to not have to close the webdriver instance between test classes. If you want to run parallel though, you need to have one instance of webdriver for EACH thread and so in that case using a static member is the WRONG way to go. Instead you need to create or pass a webdriver instance when the test case class is invoked.

    Also, you are breaking a test into separate tests for each step of the test. That is very unusual and I do not see the reason why you are doing that. You could really simplify your tests by keeping all the test steps within one singe test case like people usually do.

提交回复
热议问题