You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+48Lines changed: 48 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,12 +29,16 @@
29
29
30
30
-----
31
31
32
+
<aname="what-is-it"></a>
33
+
32
34
## What is it?
33
35
34
36
This project consists of a Docker image containing a Robot Framework installation.
35
37
36
38
This installation also contains Firefox, Chrome, Microsoft Edge and the Selenium library for Robot Framework. The test cases and reports should be mounted as volumes.
37
39
40
+
<aname="versioning"></a>
41
+
38
42
## Versioning
39
43
40
44
The versioning of this image follows the one of Robot Framework:
@@ -64,6 +68,8 @@ The versions used are:
64
68
65
69
As stated by [the official GitHub project](https://github.com/robotframework/Selenium2Library), starting from version 3.0, Selenium2Library is renamed to SeleniumLibrary and this project exists mainly to help with transitioning. The Selenium2Library 3.0.0 is also the last release and for new releases, please look at the [SeleniumLibrary](https://github.com/robotframework/SeleniumLibrary) project.
66
70
71
+
<aname="running-the-container"></a>
72
+
67
73
## Running the container
68
74
69
75
This container can be run using the following command:
@@ -73,6 +79,8 @@ This container can be run using the following command:
73
79
-v <local path to the test suites' folder>:/opt/robotframework/tests:Z \
74
80
ppodgorsek/robot-framework:<version>
75
81
82
+
<aname="switching-browsers"></a>
83
+
76
84
### Switching browsers
77
85
78
86
Browsers can be easily switched. It is recommended to define `${BROWSER} %{BROWSER}` in your Robot variables and to use `${BROWSER}` in your test cases. This allows to set the browser in a single place if needed.
@@ -81,6 +89,8 @@ When running your tests, simply add `-e BROWSER=chrome`, `-e BROWSER=firefox` or
81
89
82
90
Please note: `edge` will work with Selenium but not the Browser Library, as the latter currently doesn't have an easy mechanism to install additional browsers. Playwright, on which the Browser library relies, cannot install additional browsers on Linux platforms other than Ubuntu/Debian and [suggests using Chromium to test Microsoft Edge scenarios](https://playwright.dev/docs/browsers), unless you require Edge-specific capabilities.
### Changing the container's tests and reports directories
93
105
94
106
It is possible to use different directories to read tests from and to generate reports to. This is useful when using a complex test file structure. To change the defaults, set the following environment variables:
It is possible to parallelise the execution of your test suites. Simply define the `ROBOT_THREADS` environment variable, for example:
@@ -106,6 +120,8 @@ It is possible to parallelise the execution of your test suites. Simply define t
106
120
107
121
By default, there is no parallelisation.
108
122
123
+
<aname="parallelisation-options"></a>
124
+
109
125
#### Parallelisation options
110
126
111
127
When using parallelisation, it is possible to pass additional [pabot options](https://github.com/mkorpela/pabot#command-line-options), such as `--testlevelsplit`, `--argumentfile`, `--ordering`, etc. These can be passed by using the `PABOT_OPTIONS` environment variable, for example:
@@ -115,6 +131,8 @@ When using parallelisation, it is possible to pass additional [pabot options](ht
115
131
-e PABOT_OPTIONS="--testlevelsplit" \
116
132
ppodgorsek/robot-framework:latest
117
133
134
+
<aname="passing-additional-options"></a>
135
+
118
136
### Passing additional options
119
137
120
138
RobotFramework supports many options such as `--exclude`, `--variable`, `--loglevel`, etc. These can be passed by using the `ROBOT_OPTIONS` environment variable, for example:
@@ -123,12 +141,16 @@ RobotFramework supports many options such as `--exclude`, `--variable`, `--logle
123
141
-e ROBOT_OPTIONS="--loglevel DEBUG" \
124
142
ppodgorsek/robot-framework:latest
125
143
144
+
<aname="testing-emails"></a>
145
+
126
146
### Testing emails
127
147
128
148
This project includes the IMAP library which allows Robot Framework to connect to email servers.
129
149
130
150
A suggestion to automate email testing is to run a [Mailcatcher instance in Docker which allows IMAP connections](https://github.com/estelora/docker-mailcatcher-imap). This will ensure emails are discarded once the tests have been run.
This project is meant to allow your tests to run anywhere. Sometimes that can be in a different timezone than your local one or of the location under test. To help solve such issues, this image includes the [DateTimeTZ Library](https://testautomation.github.io/DateTimeTZ/doc/DateTimeTZ.html).
@@ -139,6 +161,8 @@ To set the timezone used inside the Docker image, you can set the `TZ` environme
139
161
-e TZ=America/New_York \
140
162
ppodgorsek/robot-framework:latest
141
163
164
+
<aname="installing-additional-dependencies"></a>
165
+
142
166
### Installing additional dependencies
143
167
144
168
It is possible to install additional dependencies dynamically at runtime rather than having to extend this image.
@@ -161,6 +185,8 @@ rpa==1.50.0
161
185
162
186
**For large dependencies, it is still recommended to extend the project's image and to add them there, to avoid delaying the CI/CD pipelines with repeated dependency installations.**
163
187
188
+
<aname="security-considerations"></a>
189
+
164
190
## Security consideration
165
191
166
192
By default, containers are implicitly run using `--user=1000:1000`, please remember to adjust that command-line setting accordingly, for example:
@@ -178,6 +204,8 @@ Additionally, it is possible to rely on user namespaces to further secure the ex
178
204
179
205
This is a good security practice to make sure containers cannot perform unwanted changes on the host. In that sense, Podman is probably well ahead of Docker by not relying on a root daemon to run its containers.
180
206
207
+
<aname="continuous-integration"></a>
208
+
181
209
## Continuous integration
182
210
183
211
It is possible to run the project from within a Jenkins pipeline by relying on the shell command line directly:
@@ -217,6 +245,8 @@ The pipeline stage can also rely on a Docker agent, as shown in the example belo
217
245
}
218
246
}
219
247
248
+
<aname="defining-a-test-run-id"></a>
249
+
220
250
### Defining a test run ID
221
251
222
252
When relying on Continuous Integration tools, it can be useful to define a test run ID such as the build number or branch name to avoid overwriting consecutive execution reports.
@@ -233,6 +263,8 @@ It can simply be passed during the execution, such as:
To upload the report of a test run to an S3 bucket, you need to define the following environment variables:
@@ -244,6 +276,8 @@ To upload the report of a test run to an S3 bucket, you need to define the follo
244
276
-e AWS_BUCKET_NAME=<nameofyourS3bucket> \
245
277
ppodgorsek/robot-framework:latest
246
278
279
+
<aname="testing-this-project"></a>
280
+
247
281
## Testing this project
248
282
249
283
Not convinced yet? Simple tests have been prepared in the `test/` folder, you can run them using the following commands:
@@ -280,8 +314,12 @@ For Windows users who use **PowerShell**, the commands are slightly different:
280
314
281
315
Screenshots of the results will be available in the `reports/` folder.
282
316
317
+
<aname="troubleshooting"></a>
318
+
283
319
## Troubleshooting
284
320
321
+
<aname="chromium-is-crashing"></a>
322
+
285
323
### Chromium is crashing
286
324
287
325
Chrome drivers might crash due to the small size of `/dev/shm` in the docker container:
@@ -291,6 +329,8 @@ This is [a known bug of Chromium](https://bugs.chromium.org/p/chromium/issues/de
291
329
292
330
To avoid this error, please change the shm size when starting the container by adding the following parameter: `--shm-size=1g` (or any other size more suited to your tests)
293
331
332
+
<aname="accessing-the-logs"></a>
333
+
294
334
### Accessing the logs
295
335
296
336
In case further investigation is required, the logs can be accessed by mounting their folder. Simply add the following parameter to your `run` command:
@@ -303,6 +343,8 @@ Chromium allows to set additional environment properties, which can be useful wh
303
343
*`webdriver.chrome.verboseLogging=true`: enables the verbose logging mode
304
344
*`webdriver.chrome.logfile=/path/to/chromedriver.log`: sets the path to Chromium's log file
305
345
346
+
<aname="error-suite-contains-no-tests"></a>
347
+
306
348
### Error: Suite contains no tests
307
349
308
350
When running tests, an unexpected error sometimes occurs:
@@ -321,6 +363,8 @@ It is also important to check if Robot Framework is allowed to access the resour
### Database tests are failing in spite of the DatabaseLibrary being present
325
369
326
370
As per their official project page, the [Robot Framework DatabaseLibrary](https://github.com/franz-see/Robotframework-Database-Library) contains utilities meant for Robot Framework's usage. This can allow you to query your database after an action has been made to verify the results. This is compatible with any Database API Specification 2.0 module.
@@ -331,6 +375,8 @@ It is anyway mandatory to extend the container image to install the specific dat
As mentioned on the [Docker Hub](https://hub.docker.com/r/ppodgorsek/robot-framework), the project has been built and uploaded as a `linux/amd64` image only. This means ARM devices such as MacBook M1/M2 and Amazon EC2 Graviton won't be able to run the image with the default configuration.
@@ -347,6 +393,8 @@ Please note: builds and automated tests of this project will remain performed on
347
393
348
394
If this does not solve your platform-related issues, you will have to rebuild the image for your device/platform, specifying that `--platform` option during the build and run.
349
395
396
+
<aname="please-contribute"></a>
397
+
350
398
## Please contribute!
351
399
352
400
Have you found an issue? Do you have an idea for an improvement? Feel free to contribute by submitting it [on the GitHub project](https://github.com/ppodgorsek/docker-robot-framework/issues).
0 commit comments