Jump to content

Selenium/Ruby/Selenium Jenkins job

From mediawiki.org

For this example, we will target English Wikipedia at the Beta Cluster using Sauce Labs. You will need internet access. Selenium Jenkins jobs run once every day, but you can also start them manually.

Advantages

[edit]
  • You do not have to install anything on your machine.
  • You are probably already familiar with Jenkins.
  • While the tests are running, you can continue using your machine as usual, because everything is happening in Jenkins.
  • Debugging failed tests will be easier, since you will see the browser, logs, screenshots and video of the test run.
  • You can run tests using any operating system and browser combination that Sauce Labs supports.

Disadvantages

[edit]
  • You will need internet connection while running the tests.
  • It will be slower that running tests on your machine.
    • MediaWiki core Selenium test run takes about 3-4 minutes on my machine.
    • It takes about 6-7 minutes for selenium-Core Jenkins job to run.
  • You might not be familiar with Jenkins, so you will have to learn how to use yet another tool.

Run the Selenium tests

[edit]
  • Log in to Jenkins.
  • Go to selenium-Core job.
  • Click Build Now.
  • In Build History a new job will be blinking at the top of the list, for example #151.
  • Click job number, in this case #151.
  • Under Configurations click default.
  • Click Console Output.
  • If the job has been running for a while, there will be Full Log link at the top of the page. You can click it to load the entire console output.
00:00:00.000 Started by upstream project
...
00:00:00.000 originally caused by:
00:00:00.001 Started by user Zeljko Filipin
00:00:00.012 Building remotely on
...
00:00:19.772 + '/mnt/jenkins-workspace/workspace/selenium-Core/BROWSER/firefox/MEDIAWIKI_ENVIRONMENT/beta/PLATFORM/Linux/label/contintLabsSlave && UbuntuTrusty/vendor/bin/bundle' exec rake selenium
00:00:20.920 [DEPRECATION] `last_comment` is deprecated.  Please use `last_description` instead.
00:00:21.001 /usr/bin/ruby2.0 -S bundle exec cucumber tests/browser --backtrace --verbose --color --format pretty --format Cucumber::Formatter::Sauce --out '/mnt/jenkins-workspace/workspace/selenium-Core/BROWSER/firefox/MEDIAWIKI_ENVIRONMENT/beta/PLATFORM/Linux/label/contintLabsSlave && UbuntuTrusty/log/junit' --tags ~@skip --tags @firefox
...
00:06:24.558 18 scenarios (18 passed)
00:06:24.558 89 steps (89 passed)
00:06:24.558 6m0.375s
...
00:06:24.788 Archiving artifacts
00:06:24.799 [PostBuildScript] - Execution post build scripts.
00:06:24.812 [contintLabsSlave && UbuntuTrusty] $ /bin/bash -xe /tmp/hudson6182892910214027954.sh
00:06:24.825 + set +e
00:06:24.825 + set +x
00:06:24.825 Removing potential png screenshots under /log/
00:06:24.826 Done
00:06:25.157 No emails were triggered.
00:06:25.157 Finished: SUCCESS