Reputation: 41
Is it possible to run automation tests written on Python + Selenium in GitLab? I can't find information on the internet. I know that there is Jenkins, but I want to run autotests in GitLab and then create a report in Allure (if possible)
Upvotes: 4
Views: 4303
Reputation: 571
Is it possible to run automation tests written on Python + Selenium in GitLab?
It's possible by few ways/types of gitlab-runner executors
: docker
, docker-compose
, shell
.
Example with docker
gitlab-runner executor:
.gitlab-ci.yml
image: python:3.7.9-alpine
stages:
- test
e2e:chrome:
services:
- selenium/standalone-chrome # it's need to be configured with Remote webdriver in your tests to look at http://selenium__standalone-chrome:4444/wd/hub
before_script:
- pip3 install -r requirements.txt # you can optimize this step by building your own image with pre-installled requirements and using it instead of current python:3.7.9-alpine image
script:
- pytest /path/to/your/tests
It's a workable example how selenium tests on python can be executed with gitlab-ci
.
Full simple example is here by tag 1.0.0 https://github.com/aleksandr-kotlyar/python-gitlabci-selenium/releases/tag/1.0.0
More complex multi-browser examples available by tag 2.0.0 https://github.com/aleksandr-kotlyar/python-gitlabci-selenium/releases/tag/2.0.0
Local docker examples available by tag 2.1.0 https://github.com/aleksandr-kotlyar/python-gitlabci-selenium/releases/tag/2.1.0
Disclaimer: i develop python-gitlab-ci and another python-ci templates for newbies, so i will appreciate feedback and requests in my project https://github.com/aleksandr-kotlyar/python-gitlabci-selenium/
Upvotes: 4