-
Notifications
You must be signed in to change notification settings - Fork 12
/
scale.html.haml
100 lines (98 loc) · 5.43 KB
/
scale.html.haml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
---
layout: base
title: Scaling
author: Dominik Dary
---
.container-fluid
.row-fluid
.span3
#sidebar
%ul.nav.nav-tabs.nav-stacked
%li
%a{:href=>'#prerequisites'} Prerequisites
%li
%a{:href=>'#start'} Start all Servers
%li
%a{:href=>'#runTests'} Run a Test
.span9
%h1 Scaling Selendroid by using the Selenium Grid
%h2#prerequisites Prerequisites
%p Steps to use selendroid together with the Selenium Grid on a local machine:
%ol
%li Download selenium-server-standalone from the <a href="http://code.google.com/p/selenium/downloads/list">Selenium Project</a>
%li
%a{:href=>"#{site.standalone_download_link}"} Download selendroid-standalone
%li
%a{:href=>"#{site.selendroid_test_app_download_link}"} Download selendroid-test-app
%li
%a{:href=>"#{site.selendroid_grid_plugin_download_link}"} Download selendroid-grid-plugin
%li copy all the artifacts into the folder where the selenium-server-standalone is stored.
%h2#start Start all servers
%p First, the selendroid-standalone should be started (more details you find <a href="#{site.setup_page}#launchingSelendroid">here</a>):</p>
%pre
%code.bash
= preserve do
:escaped
java -jar selendroid-standalone-#{site.current_version}-with-dependencies.jar -app selendroid-test-app-#{site.current_version}.apk -port 5555
%p Now you can start the Grid with the <code>selendroid-grid-plugin</code> that contains the proxy <code>io.selendroid.grid.SelendroidSessionProxy</code> and a simple capability matcher <code>io.selendroid.grid.SelendroidCapabilityMatcher</code>.
%p Command to start the server on <em>Mac</em> & <em>Unix:</em>
%pre
%code.bash
= preserve do
:escaped
java -Dfile.encoding=UTF-8 -cp "selendroid-grid-plugin-#{site.current_version}.jar:selenium-server-standalone-#{site.latest_selenium_version}.jar" org.openqa.grid.selenium.GridLauncher -capabilityMatcher io.selendroid.grid.SelendroidCapabilityMatcher -role hub -host 127.0.0.1 -port 4444
%p Command to start the server on <em>Windows</em>:
%pre
%code.bash
= preserve do
:escaped
java -Dfile.encoding=UTF-8 -cp "selendroid-grid-plugin-#{site.current_version}.jar;selenium-server-standalone-#{site.latest_selenium_version}.jar" org.openqa.grid.selenium.GridLauncher -capabilityMatcher io.selendroid.grid.SelendroidCapabilityMatcher -role hub -host 127.0.0.1 -port 4444
%p Registering nodes to this grid can be done using this registration request (file name <code>selendroid-nodes-config.json</code>):
%pre
%code.json
= preserve do
:escaped
{
"capabilities": [{
"browserName": "selendroid",
"maxInstances": 1,
"aut": "io.selendroid.testapp:#{site.current_version}"
}, {
"browserName": "android",
"maxInstances": 1
}],
"configuration": {
"maxSession": 1,
"register": true,
"hubHost": "localhost",
"hubPort": 4444,
"remoteHost": "http://localhost:5555",
"proxy": "io.selendroid.grid.SelendroidSessionProxy"
}
}
%p This configuration describes in the section <em>capabilities</em> two browsers that are available on the node machine. The first one <em>selendroid</em> is able to run tests agains the app under test (aut) <em>io.selendroid.testapp</em>. The second one <em>android</em> can run mobile web tests. The important thing is not to mix both entries, otherwise forwarding the session to the selendroid-standalone will fail. You can find details about how capabilities are used in selendroid <a href="http://selendroid.io/setup.html#DesiredCapabilities">here</a>.
%p The node registration can be done by sending the node config to the hub using <em>curl</em>:
%pre
%code.bash
= preserve do
:escaped
curl -H "Content-Type: application/json" -X POST --data @selendroid-nodes-config.json http://localhost:4444/grid/register
%p Now you can verify in the <a href="http://localhost:4444/grid/console">Selenium Grid console</a>, that the node has been added to the grid hub.
%h2#runTests Run a Test
%p When defining desired capabilities, please verify that they are present in the grid hub and they match to the capablities of the selendroid-standalone server. Otherwise you will get an error that the session could not be forwarded.
%pre
%code.java
= preserve do
:escaped
@Test()
public void testShouldBeAbleToRegisterAnUser() throws Exception {
SelendroidCapabilities capa =
new SelendroidCapabilities(
"io.selendroid.testapp:#{site.current_version}");
WebDriver driver = new SelendroidDriver(capa);
driver.findElement(By.id("startUserRegistration")).click();
// Enter user name
WebElement username = driver.findElement(By.id("inputUsername"));
username.sendKeys("johndoe");
driver.quit();
}