当前位置: 首页>>代码示例>>Java>>正文


Java SeleniumProtocol.WebDriver方法代码示例

本文整理汇总了Java中org.openqa.grid.common.SeleniumProtocol.WebDriver方法的典型用法代码示例。如果您正苦于以下问题:Java SeleniumProtocol.WebDriver方法的具体用法?Java SeleniumProtocol.WebDriver怎么用?Java SeleniumProtocol.WebDriver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openqa.grid.common.SeleniumProtocol的用法示例。


在下文中一共展示了SeleniumProtocol.WebDriver方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRequestMatchingBrowsers

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Happy path that browsers matching shows correct free node count
 public void testRequestMatchingBrowsers() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,browser);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));

    Assert.assertEquals("Thread count should be correct due to matching browser", 10, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:26,代码来源:AutomationRequestMatcherTest.java

示例2: testRequestNonMatchingBrowsers

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Test that non-matching browsers do not contribute to the free node count
public void testRequestNonMatchingBrowsers() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"doesntMatch");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));

    Assert.assertEquals("Thread count should be correct due to matching OS", 0, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:26,代码来源:AutomationRequestMatcherTest.java

示例3: testRequestAllTestSlotsIncluded

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Makes sure that all matching slots will be included to match
public void testRequestAllTestSlotsIncluded() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(10);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("There should be no matching threads since the node limit was reached",10,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:25,代码来源:AutomationRequestMatcherTest.java

示例4: testRequestAllTestSlotsIncludedGreaterNodeLimit

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Tests that the correct number of slots match even when the max session config on node is less than
// the slot number
public void testRequestAllTestSlotsIncludedGreaterNodeLimit() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(15);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("There should be no matching threads since the node limit was reached",10,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:26,代码来源:AutomationRequestMatcherTest.java

示例5: testRequestAllTestSlotsIncludedLessThanNodeLimit

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Tests that the correct number of slots match even when the max session config on node is greater than
// the slot number
public void testRequestAllTestSlotsIncludedLessThanNodeLimit() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(5);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("There should be no matching threads since the node limit was reached",5,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:26,代码来源:AutomationRequestMatcherTest.java

示例6: testRequestNewRunNotStarted

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Test to make sure an in progress counts against the free node count
public void testRequestNewRunNotStarted() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    String runId = "runId";
    AutomationContext.getContext().addRun(new AutomationRunRequest(runId,10,"firefox"));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("No nodes should be free since existing run hasn't started",0,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:27,代码来源:AutomationRequestMatcherTest.java

示例7: testNodesFreeNoUuid

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Tests that the correct node count is returned when tests don't have a UUID
public void testNodesFreeNoUuid() {
    AutomationRunContext runContext = new AutomationRunContext();
    runContext.setTotalNodeCount(10);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.PLATFORM,"linux");
    capabilities.put(CapabilityType.BROWSER_NAME,"chrome");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    testSlot.getNewSession(capabilities);
    proxy.setMultipleTestSlots(testSlot,5);
    proxySet.add(proxy);
    int freeThreads = runContext.getTotalThreadsAvailable(proxySet);
    Assert.assertEquals(5,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:19,代码来源:AutomationRunContextTest.java

示例8: testNewRunIsCounted

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Tests that a new run is counted instead of tests in progress
public void testNewRunIsCounted() {
    String uuid = "testUuid";
    AutomationRunContext runContext = new AutomationRunContext();
    runContext.setTotalNodeCount(10);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.PLATFORM,"linux");
    capabilities.put(CapabilityType.BROWSER_NAME,"chrome");
    capabilities.put(AutomationConstants.UUID,uuid);
    AutomationRunRequest request = new AutomationRunRequest(uuid,10,"chrome");
    runContext.addRun(request);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    testSlot.getNewSession(capabilities);
    proxy.setMultipleTestSlots(testSlot,5);
    proxySet.add(proxy);
    int freeThreads = runContext.getTotalThreadsAvailable(proxySet);
    Assert.assertEquals(0,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:23,代码来源:AutomationRunContextTest.java

示例9: testRequestMatchingOs

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Tests that OS matching on a node works correctly
public void testRequestMatchingOs() throws IOException, ServletException {
    String browser = "firefox";
    String os = "linux";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    capabilities.put(CapabilityType.PLATFORM,os);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(null,null,browser,null,os));

    Assert.assertEquals("Thread count should be correct due to matching OS", 10, freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:28,代码来源:AutomationRequestMatcherTest.java

示例10: testInitCleanupThreads

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Tests that the cleanup threads are started
public void testInitCleanupThreads() throws IOException, ServletException{
    System.setProperty(AutomationConstants.INSTANCE_ID,"dummyId");
    MockVmManager manageEc2 = new MockVmManager();
    MockRequestMatcher matcher = new MockRequestMatcher();
    matcher.setThreadsToReturn(0);
    MockAutomationTestRunServlet servlet = new MockAutomationTestRunServlet(null,true, manageEc2,matcher);
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter("uuid","testUuid");
    request.setParameter("browser","chrome");
    request.setParameter("threadCount","7");
    request.setParameter("browserVersion","21");
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"chrome");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    servlet.setProxySet(proxySet);
    AutomationContext.getContext().setTotalNodeCount(50);
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.doGet(request, response);
    Assert.assertEquals("Hub should be able to fulfill request",
            HttpServletResponse.SC_CREATED,response.getStatusCode());
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:37,代码来源:AutomationTestRunServletTest.java

示例11: testRequestNewRunNotStartedDifferentBrowser

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Test to make sure an in progress run only counts against the free nodes if the in progress run's browser
// matches the requested browser
public void testRequestNewRunNotStartedDifferentBrowser() throws IOException, ServletException{
    String nonMatchingBrowser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    String runId = "runId";
    AutomationContext.getContext().addRun(new AutomationRunRequest(runId,10,"firefox"));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy nonMatchingProxy = new MockRemoteProxy();
    nonMatchingProxy.setMaxNumberOfConcurrentTestSessions(50);
    nonMatchingProxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    nonMatchingProxy.setConfig(config);
    Map<String,Object> nonMatchingCapabilities = new HashMap<String,Object>();
    nonMatchingCapabilities.put(CapabilityType.BROWSER_NAME, nonMatchingBrowser);
    TestSlot nonMatchingTestSlot = new TestSlot(nonMatchingProxy, SeleniumProtocol.WebDriver,null,nonMatchingCapabilities);
    nonMatchingProxy.setMultipleTestSlots(nonMatchingTestSlot, 10);
    proxySet.add(nonMatchingProxy);
    String matchingBrowser = "chrome";

    MockRemoteProxy matchingProxy = new MockRemoteProxy();
    proxySet.add(matchingProxy);
    matchingProxy.setMaxNumberOfConcurrentTestSessions(50);
    matchingProxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    matchingProxy.setConfig(config);
    Map<String,Object> matchingCapabilities = new HashMap<String,Object>();
    matchingCapabilities.put(CapabilityType.BROWSER_NAME, matchingBrowser);
    TestSlot matchingTestSlot = new TestSlot(nonMatchingProxy, SeleniumProtocol.WebDriver,null,matchingCapabilities);
    matchingProxy.setMultipleTestSlots(matchingTestSlot, 10);

    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(matchingBrowser));
    Assert.assertEquals("Nodes should be free even though run is in progress as browsers do not match",10,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:41,代码来源:AutomationRequestMatcherTest.java

示例12: testNodeCantBeShutDown

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Tests that the node is not automatically shutdown (terminated) because its currently running tests
public void testNodeCantBeShutDown() {
    MockRequestMatcher matcher = new MockRequestMatcher();
    matcher.setThreadsToReturn(4);
    MockAutomationNodeCleanupTask task = new MockAutomationNodeCleanupTask(null,new MockVmManager(),matcher);
    ProxySet proxySet = new ProxySet(false);
    task.setProxySet(proxySet);
    String nodeId = "dummyId";
    AutomationDynamicNode node = new AutomationDynamicNode(nodeId,"dummyId",null,null,AutomationUtils.modifyDate(new Date(),-56, Calendar.MINUTE),10);
    AutomationContext.getContext().addNode(node);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxySet.add(proxy);
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    // Assign a session to the test slot
    testSlot.getNewSession(capabilities);
    proxy.setMultipleTestSlots(testSlot, 5);
    matcher.setInProgressTests("firefox",5);
    task.run();
    Assert.assertEquals("There should not be sufficient free capacity to cause the node to get shut down", AutomationDynamicNode.STATUS.RUNNING,node.getStatus());
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:28,代码来源:AutomationNodeCleanupTaskTest.java

示例13: testRequestOldRunFinished

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Tests when a run is considered old that the threads are not considered in use
public void testRequestOldRunFinished() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    String runId = "runId";
    // Add an old run that will not be included in the available resource logic
    AutomationContext.getContext().addRun(new AutomationRunRequest(runId, 10, "firefox", null,null,AutomationUtils.modifyDate(new Date(), -2, Calendar.MINUTE)));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("Free nodes should be correct since the run has finished at this point",10,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:28,代码来源:AutomationRequestMatcherTest.java

示例14: testMultipleBrowsersInUse

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// 5 firefox, 5 chrome slots, (10 node total) 5 in progress chrome tests, firefox should still show 5 free
public void testMultipleBrowsersInUse() throws IOException, ServletException{
    String browser = "firefox";
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(10);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> nonMatchingCapabilities = new HashMap<String,Object>();
    nonMatchingCapabilities.put(CapabilityType.BROWSER_NAME, "chrome");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,nonMatchingCapabilities);
    testSlot.getNewSession(nonMatchingCapabilities);
    proxy.setMultipleTestSlots(testSlot, 5);
    proxySet.add(proxy);

    Map<String,Object> matchingCapabilities = new HashMap<String,Object>();
    matchingCapabilities.put(CapabilityType.BROWSER_NAME, browser);
    TestSlot testSlot2 = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,matchingCapabilities);
    proxy.setMultipleTestSlots(testSlot2, 5);
    proxySet.add(proxy);
    AutomationContext.getContext().setTotalNodeCount(50);
    int freeThreads = new AutomationRequestMatcher().getNumFreeThreadsForParameters(proxySet,new AutomationRunRequest(browser));
    Assert.assertEquals("No nodes should be free since existing run is still new",5,freeThreads);
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:32,代码来源:AutomationRequestMatcherTest.java

示例15: testRequestCanFulfill

import org.openqa.grid.common.SeleniumProtocol; //导入方法依赖的package包/类
@Test
// Tests the happy path that a hub says a request can be fulfilled when it can be
public void testRequestCanFulfill() throws IOException, ServletException{
    MockVmManager manageEc2 = new MockVmManager();
    MockRequestMatcher matcher = new MockRequestMatcher();
    matcher.setThreadsToReturn(10);
    MockAutomationTestRunServlet servlet = new MockAutomationTestRunServlet(null,false, manageEc2,matcher);
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter("uuid","testUuid");
    request.setParameter("browser","firefox");
    request.setParameter("threadCount","10");
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid",nodeId,null,null,new Date(),50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String,Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID,nodeId);
    proxy.setConfig(config);
    Map<String,Object> capabilities = new HashMap<String,Object>();
    capabilities.put(CapabilityType.BROWSER_NAME,"firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver,null,capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    servlet.setProxySet(proxySet);
    AutomationContext.getContext().setTotalNodeCount(50);
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.doGet(request, response);
    Assert.assertEquals("Hub should be able to fulfill request",
            HttpServletResponse.SC_ACCEPTED,response.getStatusCode());
}
 
开发者ID:RetailMeNot,项目名称:SeleniumGridScaler,代码行数:35,代码来源:AutomationTestRunServletTest.java


注:本文中的org.openqa.grid.common.SeleniumProtocol.WebDriver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。