在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ppodgorsek/docker-robot-framework开源软件地址:https://github.com/ppodgorsek/docker-robot-framework开源编程语言:RobotFramework 63.3%开源软件介绍:Robot Framework in Docker, with Firefox and ChromeWhat is it?This project consists of a Docker image containing a Robot Framework installation. This installation also contains Firefox, Chrome and the Selenium library for Robot Framework. The test cases and reports should be mounted as volumes. VersioningThe versioning of this image follows the one of Robot Framework:
The versions used are:
As stated by the official GitHub project, 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 project. Running the containerThis container can be run using the following command:
Switching browsersBrowsers can be easily switched. It is recommended to define When running your tests, simply add Changing the container's screen resolutionIt is possible to define the settings of the virtual screen in which the browser is run by changing several environment variables:
Changing the container's tests and reports directoriesIt 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:
ParallelisationIt is possible to parallelise the execution of your test suites. Simply define the
By default, there is no parallelisation. Parallelisation optionsWhen using parallelisation, it is possible to pass additional pabot options, such as
Passing additional optionsRobotFramework supports many options such as
Testing emailsThis project includes the IMAP library which allows Robot Framework to connect to email servers. A suggestion to automate email testing is to run a Mailcatcher instance in Docker which allows IMAP connections. This will ensure emails are discarded once the tests have been run. Dealing with Datetimes and TimezonesThis 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. To set the timezone used inside the Docker image, you can set the
Security considerationBy default, containers are implicitly run using
Remember that that UID/GID should be allowed to access the mounted volumes in order to read the test suites and to write the output. Additionally, it is possible to rely on user namespaces to further secure the execution. This is well described in the official container documentation:
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. Continuous integrationIt is possible to run the project from within a Jenkins pipeline by relying on the shell command line directly:
The pipeline stage can also rely on a Docker agent, as shown in the example below:
Defining a test run IDWhen 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. For that purpose, the
It can simply be passed during the execution, such as:
By default, the test run ID is empty. Upload test reports to an AWS S3 bucketTo upload the report of a test run to an S3 bucket, you need to define the following environment variables:
Testing this projectNot convinced yet? Simple tests have been prepared in the
For Windows users who use PowerShell, the commands are slightly different:
Screenshots of the results will be available in the TroubleshootingChromium is crashingChrome drivers might crash due to the small size of
This is a known bug of Chromium. To avoid this error, please change the shm size when starting the container by adding the following parameter: Accessing the logsIn case further investigation is required, the logs can be accessed by mounting their folder. Simply add the following parameter to your
Chromium allows to set additional environment properties, which can be useful when debugging:
Error: Suite contains no testsWhen running tests, an unexpected error sometimes occurs:
There are two main causes to this:
As there can sometimes be issues as to where the tests are run from, make sure the correct folder is used by trying the following actions:
It is also important to check if Robot Framework is allowed to access the resources it needs, i.e.:
Database tests are failing in spite of the DatabaseLibrary being presentAs per their official project page, the Robot Framework DatabaseLibrary 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. It is anyway mandatory to extend the container image to install the specific database module relevant to your tests, such as:
Please contribute!Have you found an issue? Do you have an idea for an improvement? Feel free to contribute by submitting it on the GitHub project. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论