From 653291b07a8bc5561eea5aa17e3abd061723a1a9 Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Tue, 15 Jan 2019 11:26:55 +0100 Subject: [PATCH] TT#46791 Teach Jenkins job ngcp-panel-test-selenium-docker run one test only It should speedup the testing when we debug one specific test only. Change-Id: I7a2235bd3225836f3dcbdda6af2eaa6b65e71cff --- t/selenium/jenkins_docker_run | 2 +- t/selenium/testrunner | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/t/selenium/jenkins_docker_run b/t/selenium/jenkins_docker_run index 26042d9d74..af3f8f0be1 100755 --- a/t/selenium/jenkins_docker_run +++ b/t/selenium/jenkins_docker_run @@ -2,4 +2,4 @@ # This script is used for running the tests with proper arguments # from within Jenkins # this is a workaround with PERL5LIB= ... until we've a proper libselenium-remote-driver-perl package again -su - selenium -c "cd /code && PERL5LIB=/home/selenium/Selenium-Remote-Driver/ ./t/selenium/testrunner $* /results/ junit" +su - selenium -c "cd /code && PERL5LIB=/home/selenium/Selenium-Remote-Driver/ ./t/selenium/testrunner $1 /results/ junit $2" diff --git a/t/selenium/testrunner b/t/selenium/testrunner index ad62221e94..f09bcaf6cd 100755 --- a/t/selenium/testrunner +++ b/t/selenium/testrunner @@ -11,17 +11,19 @@ set -u PASSWORD="selenium" if [ -z "${1:-}" ] ; then - echo "Usage: $0 [] [junit]" >&2 + echo "Usage: $0 [] [junit] [test_plan]" >&2 echo echo "Usage examples: $0 192.168.88.162 - $0 192.168.88.162 /results/ junit" + $0 192.168.88.162 /results/ junit controller_billing.t" exit 1 fi SERVER="${1}" OUTPUT_DIRECTORY="${2:-/code/}" +OUTPUT_TYPE=${3:-} +TEST_PLAN="${4:-*.t}" # workaround for new Selenium::Remote::Driver (see Dockerfile) export PERL5LIB=/home/selenium/Selenium-Remote-Driver/lib/ @@ -51,12 +53,14 @@ echo "Selenium server log file available at /home/selenium/selenium.log" echo "Watch at test runs by connecting via VNC (password: '${PASSWORD}'):" echo "echo -e '$PASSWORD_ENCODED' >/tmp/vncpasswd ; vncviewer geometry=1280x1024x16 passwd=/tmp/vncpasswd localhost:5999" -if [ -n "${3:-}" ] && [ "${3:-}" = "junit" ] ; then - CATALYST_SERVER=https://${SERVER}:1443/ prove -ofmv --formatter TAP::Formatter::JUnit -l -It/lib t/selenium/*.t | \ +if [ "${OUTPUT_TYPE:-}" = "junit" ] ; then + # shellcheck disable=SC2086 + CATALYST_SERVER=https://${SERVER}:1443/ prove -ofmv --formatter TAP::Formatter::JUnit -l -It/lib t/selenium/${TEST_PLAN} | \ tee -a "${OUTPUT_DIRECTORY}/selenium.xml" RC="${PIPESTATUS[0]}" else - CATALYST_SERVER="https://${SERVER}:1443" prove -ofmv --color -l -It/lib t/selenium/*.t | \ + # shellcheck disable=SC2086 + CATALYST_SERVER="https://${SERVER}:1443" prove -ofmv --color -l -It/lib t/selenium/${TEST_PLAN} | \ tee -a "${OUTPUT_DIRECTORY}/selenium.pretty" RC="${PIPESTATUS[0]}" fi