我在本地运行我的黄瓜测试,但是会生成一个黄瓜报告,但是当我构建包含测试的docker映像时,该报告就不会生成。
我在docker映像中打开一个外壳,并在测试项目的文件系统中导航,并且不会生成html报告。
我在本地使用Ruby2.6,并且在使用gem report_builder生成报告。
我的DockerFile:
FROM ruby:2.6.0-alpine3.8
# install OS libs
apk update -qq && apk add --update build-base git bash postgresql-dev
# This installs Node and allows the npm command on Alpine
RUN apk add --update nodejs nodejs-npm
# Initialising the repo to create the json file - (-y for no questions)
RUN npm init -y
# Installing cucumber report
RUN npm install cucumber-html-reporter
# Install Google Chrome
RUN apk -U --no-cache \
--allow-untrusted add \
zlib-dev \
chromium \
xvfb \
wait4ports \
xorg-server \
dbus \
ttf-freefont \
grep \
udev \
&& apk del --purge --force linux-headers binutils-gold gnupg zlib-dev libc-utils \
&& rm -rf /var/lib/apt/lists/* \
/var/cache/apk/* \
/usr/share/man \
/tmp/* \
/usr/lib/node_modules/npm/man \
/usr/lib/node_modules/npm/doc \
/usr/lib/node_modules/npm/html \
/usr/lib/node_modules/npm/scripts
# Create work directory
WORKDIR /automation-tests
# Update Bundler
RUN gem install bundler
# Install ChromeDriver
RUN apk --no-cache add \
chromium-chromedriver\
zlib-dev \
chromium \
xvfb \
wait4ports \
xorg-server \
dbus \
ttf-freefont \
mesa-dri-swrast \
udev
# Copy current Directory
COPY . /automation-tests/
# Install Package to convert sh file
RUN apk add dos2unix
# Convert the sh file to unix encoding
RUN dos2unix run.sh
# Setting the work Directory for Project
WORKDIR /automation-tests
# Install the required Gems (Specific Project)
RUN bundle install
# Execute script - Used CMD to allow the shell execution to debug
CMD ["../run.sh"]
Run.sh命令
cucumber --require features --format pretty --format html -o reports/report.html