Skip to content

Commit aaa1d5b

Browse files
committed
Correct reporting after rerun tests
* Echo rerun-rounds starting from 1, hide rebot stdout
1 parent 1406aec commit aaa1d5b

File tree

5 files changed

+56
-26
lines changed

5 files changed

+56
-26
lines changed

.github/workflows/docker-build.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ jobs:
3333
- name: Checkout
3434
uses: actions/checkout@v2
3535
- name: Build image
36-
run:
37-
podman build . --tag $IMAGE_NAME --file Dockerfile
36+
run: podman build . --tag $IMAGE_NAME --file Dockerfile
3837
- name: Basic Test
3938
run: |
4039
podman run --shm-size=1g \
@@ -158,5 +157,5 @@ jobs:
158157
run: |
159158
podman run --user=2000:2000 --shm-size=1g \
160159
-v `pwd`/test/rerun.robot:/opt/robotframework/tests/rerun.robot:Z \
161-
-e ROBOT_RERUN_FAILED=20 \
160+
-e ROBOT_RERUN_FAILED=50 \
162161
$IMAGE_NAME

Dockerfile

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ ENV ROBOT_WORK_DIR /opt/robotframework/temp
1818
# Set the maximum number of rounds to rerun failed tests
1919
ENV ROBOT_RERUN_FAILED 0
2020

21+
# Options to the rebot command when rerunning failed tests
22+
ENV ROBOT_RERUN_REBOT_OPTIONS ""
23+
2124
# Setup X Window Virtual Framebuffer
2225
ENV SCREEN_COLOUR_DEPTH 24
2326
ENV SCREEN_HEIGHT 1080
@@ -61,18 +64,18 @@ ENV AWS_UPLOAD_TO_S3 false
6164
# Install system dependencies
6265
RUN dnf upgrade -y --refresh \
6366
&& dnf install -y \
64-
dbus-glib \
65-
dnf-plugins-core \
66-
firefox-${FIREFOX_VERSION}* \
67-
gcc \
68-
gcc-c++ \
69-
nodejs \
70-
npm \
71-
python3-pip \
72-
python3-pyyaml \
73-
tzdata \
74-
wget \
75-
xorg-x11-server-Xvfb-${XVFB_VERSION}* \
67+
dbus-glib \
68+
dnf-plugins-core \
69+
firefox-${FIREFOX_VERSION}* \
70+
gcc \
71+
gcc-c++ \
72+
nodejs \
73+
npm \
74+
python3-pip \
75+
python3-pyyaml \
76+
tzdata \
77+
wget \
78+
xorg-x11-server-Xvfb-${XVFB_VERSION}* \
7679
&& dnf clean all
7780

7881
# Install Chrome for Testing
@@ -112,15 +115,15 @@ RUN wget -q "https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRI
112115
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc \
113116
&& dnf config-manager addrepo --from-repofile=https://packages.microsoft.com/yumrepos/edge/config.repo \
114117
&& dnf install -y \
115-
microsoft-edge-stable-${MICROSOFT_EDGE_VERSION} \
116-
zip \
118+
microsoft-edge-stable-${MICROSOFT_EDGE_VERSION} \
119+
zip \
117120
&& wget -q "https://msedgedriver.microsoft.com/${MICROSOFT_EDGE_VERSION}/edgedriver_linux64.zip" \
118121
&& unzip edgedriver_linux64.zip -d edge \
119122
&& mv edge/msedgedriver /opt/robotframework/drivers/msedgedriver \
120123
&& rm -Rf edgedriver_linux64.zip edge/ \
121124
# IMPORTANT: don't remove the wget package because it's a dependency of Microsoft Edge
122125
&& dnf remove -y \
123-
zip \
126+
zip \
124127
&& dnf clean all
125128

126129
ENV PATH=/opt/microsoft/msedge:$PATH

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* [Testing emails](#testing-emails)
1515
* [Dealing with Datetimes and Timezones](#dealing-with-datetimes-and-timezones)
1616
* [Installing additional dependencies](#installing-additional-dependencies)
17+
* [Rerunning tests](#rerunning-tests)
1718
* [Security consideration](#security-consideration)
1819
* [Continuous integration](#continuous-integration)
1920
* [Azure DevOps pipeline](#ci-azure-devops)

bin/run-tests-in-virtual-screen.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,15 @@ fi
5353

5454
ROBOT_EXIT_CODE=$?
5555

56-
if [[ ${ROBOT_EXIT_CODE} -gt 0 ]]
56+
if [ ${ROBOT_EXIT_CODE} -gt 0 ]
5757
then
5858
for ((i = 0 ; i < ${ROBOT_RERUN_FAILED} ; i++ ))
5959
do
60-
echo "Rerunning failed tests, round ${i}..."
60+
echo "Rerunning failed tests, round $((i+1))..."
61+
62+
# Store previous run into a tarball as screenshots etc from the previous run are removed by rebot
63+
(cd $ROBOT_REPORTS_FINAL_DIR && tar czf report_run_${i}.tar.gz browser ./{*.html,*.xml,*.log,*.png})
64+
6165
xvfb-run \
6266
--server-args="-screen 0 ${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_COLOUR_DEPTH} -ac" \
6367
robot \
@@ -68,11 +72,16 @@ then
6872
$ROBOT_TESTS_DIR
6973

7074
ROBOT_EXIT_CODE=$?
71-
75+
7276
rebot \
7377
--outputDir $ROBOT_REPORTS_FINAL_DIR \
74-
--merge $ROBOT_REPORTS_FINAL_DIR/output_rerun.xml \
75-
$ROBOT_REPORTS_FINAL_DIR/output.xml
78+
--output $ROBOT_REPORTS_FINAL_DIR/output.xml \
79+
--merge $ROBOT_REPORTS_FINAL_DIR/output.xml \
80+
${ROBOT_RERUN_REBOT_OPTIONS} \
81+
$ROBOT_REPORTS_FINAL_DIR/output_rerun.xml \
82+
> /dev/null
83+
84+
rm $ROBOT_REPORTS_FINAL_DIR/output_rerun.xml
7685

7786
if [ ${ROBOT_EXIT_CODE} -eq 0 ]
7887
then

test/rerun.robot

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
*** Test Cases ***
22

3-
Randomly Fail Test
4-
${rand}= Evaluate random.randint(0,3)
5-
IF ${rand} > 0
3+
Roll Dice 1
4+
${rand}= Evaluate random.randint(1,6)
5+
IF ${rand} > 1
6+
Fail
7+
END
8+
9+
Roll Dice 2
10+
${rand}= Evaluate random.randint(1,6)
11+
IF ${rand} > 1
12+
Fail
13+
END
14+
15+
Roll Dice 3
16+
${rand}= Evaluate random.randint(1,6)
17+
IF ${rand} > 1
18+
Fail
19+
END
20+
21+
Roll Dice 4
22+
${rand}= Evaluate random.randint(1,6)
23+
IF ${rand} > 1
624
Fail
725
END

0 commit comments

Comments
 (0)