Java 具有testng并行化的静态Selenium客户端
我被告知通过以下约定使用使用selenium的框架:Java 具有testng并行化的静态Selenium客户端,java,selenium,testng,selenium-grid,Java,Selenium,Testng,Selenium Grid,我被告知通过以下约定使用使用selenium的框架: public static SeleniumClient instance() { if (_instance == null) { _instance = new SeleniumClient(); LogHelper.instance().setInfo("SeleniumClient::instance(): Singleton created."); } return _instance; } 所有测试都以类
public static SeleniumClient instance() {
if (_instance == null) {
_instance = new SeleniumClient();
LogHelper.instance().setInfo("SeleniumClient::instance(): Singleton created.");
}
return _instance;
}
所有测试都以类似的方式编写。例如,如果我正在创建一个新的测试,我将编写一个帮助器类,这就是它的使用方式:
public static PropertyManagerHelper instance() {
if (_instance == null) {
_instance = new PropertyManagerHelper();
LogHelper.instance().setInfo("PropertyManagerHelper::instance(): Singleton created.");
}
return _instance;
}
我有一个selenium网格,我也打算发送这些测试。在我深入兔子洞之前,我有以下问题:
Selenium如何将测试发送到网格?它是发送整个类/测试还是将每个操作作为单个请求发送
前面的问题可能会回答这个问题,但是这种静态用法会阻止testng运行多个并行测试吗?为什么使用单例模式 它在当前状态下不是线程安全的:
我不建议使用单例模式。它发送每个命令。Selenium不知道它是一个测试用例还是一个类。Hub将获得命令并分发到远程控制。是的,我也不会。我正在收集数据点,以帮助我证明它不适合这里。