2011-09-13 13 views
7

Tôi có một trung tâm lưới Se 2 đang chạy. Tôi có thể tìm tài liệu về các hiệu ứng và giản đồ của thông số-configCigig ở đâu? Hiện tại trung tâm lưới của tôi hiển thị: "updated with grid2 config : No hub config file specified. To specify one, use -hubConfig XXX.json where XXX.json is a hub config file". Tôi có thể sử dụng trung tâm mà không có cấu hình này.Tôi có thể tìm thấy một lược đồ hoặc tài liệu cho json cấu hình trung tâm lưới Se 2 ở đâu?

Tôi đã tìm thấy các ví dụ trong blog và các vấn đề, nhưng không có tài liệu rõ ràng.

blog: http://opensourcetester.co.uk/2011/07/06/selenium-grid-2/

vấn đề: http://code.google.com/p/selenium/issues/detail?id=2399

Trả lời

11

Tôi đã tìm thấy một điểm khởi đầu tốt là nhìn vào examples in the Selenium Grid 2 code base.

Đây là một tập tin hub mẫu (giả sử chúng ta đặt tên cho tập tin hub.json json):

Sử dụng: java -jar selen-server-độc-2.6.0.jar hub -role hub -hubConfig. json

{ 
    "host": null, 
    "port": 4444, 
    "newSessionWaitTimeout": -1, 
    "servlets" : [], 
    "prioritizer": null, 
    "capabilityMatcher": "org.openqa.grid.internal.utils.DefaultCapabilityMatcher", 
    "throwOnCapabilityNotPresent": true, 
    "nodePolling": 5000, 

    "cleanUpCycle": 5000, 
    "timeout": 300000, 
    "maxSession": 5 
} 

đây là một file nút mẫu (giả định các tập tin được đặt tên rc.json):

Sử dụng: java -jar selen-server-độc-2.6.0.jar -role rc -nodeConfig rc.json

{ 
    "capabilities": 
     [ 
     { 
      "browserName": "firefox", 
      "maxInstances": 5 
     }, 
     { 
      "browserName": "chrome", 
      "maxInstances": 5 
     }, 
     { 
      "browserName": "internet explorer", 
      "maxInstances": 1 
     } 
     ], 
    "configuration": 
     { 
     "nodeTimeout":120, 
     "port":5555, 

     "hubPort":4444, 
     "hubHost":"localhost", 

     "nodePolling":2000, 

     "registerCycle":10000, 
     "register":true, 
     "cleanUpCycle":2000, 
     "timeout":30000, 
     "maxSession":5, 
     } 
} 

Bạn có thể tạo định dạng tương tự cho vai trò "wd" nếu được yêu cầu có cấu hình khác.

+0

Sau khi hoàn thành một số thứ sáu, tôi cũng tìm thấy điều này. – Precipitous

+0

cảm ơn bạn cho ví dụ này, khi tôi sử dụng cấu hình này (ngay cả sau khi tinh chỉnh máy chủ và cổng) RC của tôi chỉ bị treo trên INFO - Kiểm tra bí danh tài nguyên. Bất kỳ ý tưởng tại sao? –

+0

Selenium đã cập nhật tài liệu của nó: [nút config] (https://seleniumhq.github.io/docs/grid.html#configuration_of_node_with_json), [hub config] (https://seleniumhq.github.io/docs/grid.html # step_1_start_the_hub) –

0

Tài liệu wiki rất thưa thớt, nhưng có rất nhiều nhận xét hữu ích trong nguồn. GridHubConfiguration.java là nơi bạn nên bắt đầu. Dưới đây là một ví dụ:

/** 
    * how often in ms each proxy will detect that a session has timed out. All new proxy registering 
    * will have that value if they don't specifically mention the parameter. 
    */ 
    private int cleanupCycle; 

    /** 
    * how long a new session request can stay in the queue without being assigned before being 
    * rejected. -1 = forever. 
    */ 
    private int newSessionWaitTimeout; 

tôi đang tìm kiếm những gì timeout cấu hình có nghĩa là, found here:

/** 
    * how many ms can a session be idle before being considered timed out. Working together with 
    * cleanup cycle. Worst case scenario, a session can be idle for timeout + cleanup cycle before the 
    * timeout is detected. 
    */ 
    public static final JsonKey CLIENT_TIMEOUT = JsonKey.key("timeout"); 
2

Các javadocs và khác nhau sourcecode tập tin được hữu ích đến một mức độ nhất định nhưng wiki không phải là rất hữu ích và các ví dụ cấu hình khác nhau dường như không phù hợp cho đến khi bạn đào sâu vào mã. Ví dụ, DefaultHub.json chỉ định "timeout" : 300000 dẫn đến một giả định thời gian chờ là bằng ms nhưng nếu bạn xem xét các ví dụ dòng lệnh, bạn sẽ thấy thời gian chờ được chỉ định bằng giây. Nếu bạn nhìn vào mã bạn sẽ thấy, thực sự, lược đồ cấu hình JSON mất thời gian chờ (và tất cả các giá trị thời gian khác) trong ms nhưng tất cả các lược đồ cấu hình khác đều hết thời gian chờ (và một số giá trị thời gian khác) tính bằng giây.

Tài liệu dễ đọc và súc tích nhất tôi đã tìm thấy cho các tùy chọn trung tâm và nút nằm trong bản sao cũ của GridParameters.properties (không còn tồn tại), nhưng hãy nhớ rằng tất cả giá trị thời gian trong tệp cấu hình JSON đang ở trong ms:

role = <hub|node> (default is no grid, just run an RC/webdriver server). When launching a node, the parameters will be forwarded to the server on the node, so you can use something like -role node -trustAllSSLCertificates. In that case, the SeleniumServer will be launch with the trustallSSLCertificates option. 

# hub config 
host = (hub & node) <IP | hostname> : usually not needed and determined automatically. For exotic network configuration, network with VPN, specifying the host might be necessary. 
port = (hub & node) <xxxx> : the port the remote/hub will listen on. Default to 4444. 


throwOnCapabilityNotPresent = (hub) <true | false> default to true. If true, the hub will reject test requests right away if no proxy is currently registered that can host that capability.Set it to false to have the request queued until a node supporting the capability is added to the grid. 
newSessionWaitTimeout = (hub) <XXXX>. Default to no timeout (-1) the time in ms after which a new test waiting for a node to become available will time out.When that happens, the test will throw an exception before starting a browser. 

capabilityMatcher = (hub) a class implementing the CapabilityMatcher interface. Defaults to org.openqa.grid.internal.utils.DefaultCapabilityMatcher. Specify the logic the hub will follow to define if a request can be assigned to a node.Change this class if you want to have the matching process use regular expression instead of exact match for the version of the browser for instance. All the nodes of a grid instance will use the same matcher, defined by the registry. 
prioritizer = (hub) a class implementing the Prioritizer interface. Default to null (no priority = FIFO).Specify a custom prioritizer if you need the grid to process the tests from the CI, or the IE tests first for instance. 
servlets = (hub & node) <com.mycompany.MyServlet,com.mycompany.MyServlet2> to register a new servlet on the hub/node. The servlet will accessible under the path /grid/admin/MyServlet /grid/admin/MyServlet2 


grid1Yml = (hub) a YML file following grid1 format. 
hubConfig = (hub) a JSON file following grid2 format that defines the hub properties. 
nodeConfig = (node) a JSON file following grid2 format that defines the node properties. 


# config that will be inherited by the proxy and used for the node management. 
cleanupCycle = (node) <XXXX> in ms. How often a proxy will check for timed out thread. 
timeout = (node) <XXXX> the timeout in seconds before the hub automatically ends a test that hasn't had any activity in the last X seconds. The browser will be released for another test to use. This typically takes care of the client crashes. 
browserTimeout= (hub/node) The timeout in seconds a browser can hang 
hub = (node) <http://localhost:4444/grid/register> : the url that will be used to post the registration request. This option takes precedence over -hubHost and -hubPort options. 
hubHost = (node) <IP | hostname> : the host address of a hub the registration request should be sent to. Default to localhost. Option -hub takes precedence over this option. 
hubPort = (node) <xxxx> : the port listened by a hub the registration request should be sent to. Default to 4444. Option -hub takes precedence over this option. 
proxy = (node) the class that will be used to represent the node. By default org.openqa.grid.selenium.proxy.DefaultRemoteProxy. 
maxSession = (node) max number of tests that can run at the same time on the node, independently of the browser used. 
registerCycle = (node) how often in ms the node will try to register itself again.Allow to restart the hub without having to restart the nodes. 
nodePolling = (node) in ms. Interval between alive checks of node how often the hub checks if the node is still alive. 
unregisterIfStillDownAfter = (node) in ms. If the node remains down for more than unregisterIfStillDownAfter millisec, it will disappear from the hub.Default is 1min. 
downPollingLimit = (node) node is marked as down after downPollingLimit alive checks. 
nodeStatusCheckTimeout = (node) in ms. Connection and socket timeout which is used for node alive check. 
+1

Đáng buồn thay, liên kết đến GridParameters.properties không còn hoạt động và perusing repo github mới của họ đã không kết quả. Tuy nhiên, văn bản dán của bạn ở trên là rất hữu ích. Cảm ơn bạn! – JJC

Các vấn đề liên quan