|
1 |
| -Robot Framework Python Remote Server |
2 |
| -==================================== |
3 |
| - |
4 |
| -Remote server for `Robot Framework`_ implemented with Python. |
| 1 | +Python Remote Server for Robot Framework |
| 2 | +======================================== |
5 | 3 |
|
6 | 4 | Introduction
|
7 | 5 | ------------
|
8 | 6 |
|
9 |
| -`Robot Framework`_ is a generic test automation framework implemented |
10 |
| -with Python_ that also runs on Jython_ (JVM) and IronPython_ |
11 |
| -(.NET). Its testing capabilities can be easily extended with generic |
12 |
| -and custom test libraries implemented using Python and also Java when |
13 |
| -using Jython. It also has a `remote library interface`_ that allows |
14 |
| -using test libraries implemented using other languages or running on |
15 |
| -different machines. |
| 7 | +`Robot Framework`_ remote servers allow hosting test libraries on different |
| 8 | +processes or machines than Robot Framework itself is running on. This version |
| 9 | +is implemented in Python_ and supports also Jython_ (JVM) and |
| 10 | +IronPython_ (.NET). See `remote library interface documentation`_ for more |
| 11 | +information about the remote interface in general as well as for a list of |
| 12 | +remote server implementations in other programming languages. |
16 | 13 |
|
17 |
| -The `remote library architecture`_ consists of `Remote` test library |
18 |
| -that is part of normal Robot Framework installation and separate |
19 |
| -language specific remote servers. This project contains Python_ |
20 |
| -implementation of the remote server. |
| 14 | +This project is hosted in GitHub_ and downloads are available in PyPI_. |
21 | 15 |
|
22 |
| -.. _Robot Framework: http://robotframework.org> |
| 16 | +.. _Robot Framework: http://robotframework.org |
23 | 17 | .. _Python: http://python.org
|
24 | 18 | .. _Jython: http://jython.org
|
25 |
| -.. _IronPython: TODO |
26 |
| -.. _remote library interface: |
27 |
| -.. _remote library architecture: TODO |
| 19 | +.. _IronPython: http://ironpython.codeplex.com |
| 20 | +.. _remote library interface documentation: http://code.google.com/p/robotframework/wiki/RemoteLibrary |
| 21 | +.. _GitHub: https://github.com/robotframework/PythonRemoteServer |
| 22 | +.. _PyPI: http://pypi.python.org/pypi/robotremoteserver |
| 23 | + |
| 24 | +Installation |
| 25 | +------------ |
| 26 | + |
| 27 | +The easiest installation approach is using `pip`_: |
| 28 | + |
| 29 | +.. sourcecode:: bash |
| 30 | + |
| 31 | + $ pip install robotremoteserver |
| 32 | + |
| 33 | +Alternatively you can download the `source distributions`_, extract it, and |
| 34 | +install it using: |
| 35 | + |
| 36 | +.. sourcecode:: bash |
| 37 | + |
| 38 | + $ python setup.py install |
| 39 | + |
| 40 | +.. _`pip`: http://www.pip-installer.org |
| 41 | +.. _`source distributions`: PyPI_ |
| 42 | + |
| 43 | +Usage |
| 44 | +----- |
| 45 | + |
| 46 | +Starting |
| 47 | +~~~~~~~~ |
| 48 | + |
| 49 | +The remote server can be started by simply creating an instance of the server |
| 50 | +and passing a test library instance or module to it: |
| 51 | + |
| 52 | +.. sourcecode:: python |
| 53 | + |
| 54 | + from robotremoteserver import RobotRemoteServer |
| 55 | + from mylibrary import MyLibrary |
| 56 | + |
| 57 | + RobotRemoteServer(MyLibrary()) |
28 | 58 |
|
| 59 | +By default the server listens to address 127.0.0.1 and port 8270. See the next |
| 60 | +section for information how to configure them. |
29 | 61 |
|
30 |
| -*CONTENT BELOW (AND ALSO ABOVE) WORK-IN-PROGRESS* |
| 62 | +Configuration |
| 63 | +~~~~~~~~~~~~~ |
31 | 64 |
|
32 |
| -Examples Using Remote Servers |
33 |
| ------------------------------ |
| 65 | +The remote server accepts following configuration parameters: |
34 | 66 |
|
35 |
| -Examples on how test libraries can use the remote servers can be found from |
36 |
| -`example` directory. These example libraries can be started with commands:: |
| 67 | + ============== ================ ======================================== |
| 68 | + Argument Default Explanation |
| 69 | + ============== ================ ======================================== |
| 70 | + ``host`` ``'127.0.0.1'`` Address to listen. Use ``'0.0.0.0'`` to listen to all available interfaces. |
| 71 | + ``port`` ``8270`` Port to listen. Use ``0`` to select free port automatically. |
| 72 | + ``port_file`` ``None`` File to write port that is used. |
| 73 | + ``allow_stop`` ``True`` Allow/disallow stopping the server using ``Stop Remote Server`` keyword. |
| 74 | + ============== ================ ======================================== |
37 | 75 |
|
38 |
| - python example/examplelibrary.py |
39 |
| - jython example/examplelibrary.py |
40 |
| - ruby example/examplelibrary.rb |
| 76 | +Address and port that are used are printed to the console where the server is |
| 77 | +started. Writing port to a file by using ``port_file`` argument is especially |
| 78 | +useful when the server selects a free port automatically. Other tools can then |
| 79 | +easily read the active port from the file. If the file is removed prior to |
| 80 | +starting the server, tools can also wait until the file exists to know that |
| 81 | +the server is up and running. |
41 | 82 |
|
42 |
| -Note that all the above commands require that language's module search |
43 |
| -path is set so that the respective remote server module can be imported. |
44 |
| -By default the servers listen to connections to localhost on port 8270, |
45 |
| -but this can be configured like:: |
| 83 | +Example: |
46 | 84 |
|
47 |
| - python example/examplelibrary.py localhost 7777 |
48 |
| - ruby example/examplelibrary.rb 192.168.0.1 8270 |
| 85 | +.. sourcecode:: python |
49 | 86 |
|
50 |
| -These examples will start the remote server so that it provides |
51 |
| -keywords implemented in the example module. After the remote server is |
52 |
| -started, an example test case file can be executed using the familiar |
53 |
| -`pybot` or `jybot` commands, possibly giving the port where the server |
54 |
| -is listening as a variable:: |
| 87 | + from robotremoteserver import RobotRemoteServer |
| 88 | + from mylibrary import MyLibrary |
55 | 89 |
|
56 |
| - pybot example/remote_tests.html |
57 |
| - jybot example/remote_tests.html |
58 |
| - pybot --variable PORT:7777 example/remote_tests.html |
| 90 | + RobotRemoteServer(MyLibrary(), host='10.0.0.42', port=0, |
| 91 | + port_file='/tmp/remote-port.txt', allow_stop=False) |
59 | 92 |
|
60 |
| -The results should be the same regardless of the example library or start-up |
61 |
| -script used. |
| 93 | +Stopping |
| 94 | +~~~~~~~~ |
62 | 95 |
|
63 |
| -Testing Remote Servers |
64 |
| ----------------------- |
| 96 | +The remote server can be gracefully stopped using three different methods: |
65 | 97 |
|
66 |
| -Tests for the remote servers are inside `test` directory. Acceptance tests |
67 |
| -can be executed using `tests/run.py` script and running the script without |
68 |
| -arguments provides more information. Notice that tests are not included in |
69 |
| -source distributions. |
| 98 | +- Hitting ``Ctrl-C`` on the console where the server is running. |
| 99 | +- Sending the process ``SIGINT``, ``SIGTERM``, or ``SIGHUP`` signal. |
| 100 | +- Using ``Stop Remote Server`` keyword (unless explicitly disabled). |
0 commit comments