Selenium
tests on a remote Jenkins
server that does not have a monitor and air vents.
Jenkins
setup, but I broke a pair of crutches while I combined the whole thing into a working system with his django-selenium
. Now short and to the point.
Ubuntu 11.10 x64
without a monitor and X.org
and the described action was performed on it.
Jenkins
as described in the above article.
sudo apt-get install xvfb
sudo apt-get install --no-install-recommends firefox
fab
script with a modified startup command. I will show it later.
Selenium
tests (installed via pip install
):
selenium django-selenium
django-selenium
recommends using my runner of tests for running under Jenkins
, but since it is described, it did not work, and when I corrected it and it worked, I did not take into account the PROJECT_APPS
setting for django-jenkins
, i.e. It launched absolutely all tests from all packages used in the project. Therefore, I offer you my runner, which is launched by django-jenkins
, runs tests that are supposed for it, after which it runs exclusively selenium
tests from django-selenium
:
# -*- coding: utf-8 -*- from django_jenkins.runner import CITestSuiteRunner from django_selenium.jenkins_runner import JenkinsTestRunner, SeleniumTestRunner from django.test.testcases import TestCase from django.test.simple import reorder_suite class ProjectRunner(JenkinsTestRunner): """ Project test runner """ def __init__(self, **kwargs): super(ProjectRunner, self).__init__(**kwargs) self.selenium_only = True def build_suite(self, test_labels, **kwargs): suite = SeleniumTestRunner.build_suite(self, test_labels, **kwargs) suite.addTest(CITestSuiteRunner.build_suite(self, test_labels, **kwargs)) return reorder_suite(suite, (TestCase,))
test_runner.py
file in the root of your project (say the project is called “project” ).
SELENIUM_DISPLAY = ':99' JENKINS_TEST_RUNNER = 'project.test_runner.ProjectRunner'
Jenkins
project setting should be slightly edited and replaced by the launch command with:
xvfb-run ./manage.py jenkins
X.org
virtual framebuffer, i.e. Before starting the command for running tests, add xvfb-run
. At the end you can add a list of applications, although it does not make much sense, because we have a working PROJECT_APPS
setting.
Source: https://habr.com/ru/post/138784/