我在NON-GUI模式下使用JMeter从Docker容器执行测试。我的测试使用带有chrome的硒Web驱动程序。我在jmeter.log中显示了一个错误,但我不知道如何解决它。
错误是
错误c.g.j.p.w.s.WebDriverSampler:空
当我在计算机上本地运行测试时,测试可以正确执行,但是在使用JMeter non-gui模式的docker中,它不起作用。
请有人帮助我。预先谢谢你。
编辑
Dockerfile
FROM anapsix/alpine-java:8_jdk
LABEL maintainer="origds@gmail.com"
STOPSIGNAL SIGKILL
ENV JMETER_VERSION 5.1.1
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}
ENV JMETER_BIN ${JMETER_HOME}/bin
ENV PATH ${JMETER_BIN}:$PATH
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh \
&& apk add --no-cache \
curl \
net-tools \
shadow \
su-exec \
tcpdump \
&& cd /tmp/ \
&& curl --location --silent --show-error --output apache-jmeter-${JMETER_VERSION}.tgz https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz \
&& curl --location --silent --show-error --output apache-jmeter-${JMETER_VERSION}.tgz.sha512 https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz.sha512 \
&& sha512sum -c apache-jmeter-${JMETER_VERSION}.tgz.sha512 \
&& mkdir -p /opt/ \
&& tar x -z -f apache-jmeter-${JMETER_VERSION}.tgz -C /opt \
&& rm -R -f apache* \
&& sed -i '/RUN_IN_DOCKER/s/^# //g' ${JMETER_BIN}/jmeter \
&& sed -i '/PrintGCDetails/s/^# /: "${/g' ${JMETER_BIN}/jmeter \
&& sed -i '/PrintGCDetails/s/$/}"/g' ${JMETER_BIN}/jmeter \
&& chmod +x ${JMETER_HOME}/bin/*.sh \
&& jmeter --version \
&& rm -fr /tmp/*
WORKDIR /jmeter
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["jmeter", "--?"]
## JMETER plugins
ENV JMETER_PLUGINS_MANAGER_VERSION 1.3
ENV CMDRUNNER_VERSION 2.2
ENV JSON_LIB_VERSION 2.4
ENV JSON_LIB_FULL_VERSION ${JSON_LIB_VERSION}-jdk15
ENV NUMBER_OF_FILES_UNDER_LIB 144
ENV NUMBER_OF_FILES_UNDER_LIB_EXT 74
RUN cd /tmp/ \
&& curl --location --silent --show-error --output ${JMETER_HOME}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGINS_MANAGER_VERSION}.jar http://search.maven.org/remotecontent?filepath=kg/apc/jmeter-plugins-manager/${JMETER_PLUGINS_MANAGER_VERSION}/jmeter-plugins-manager-${JMETER_PLUGINS_MANAGER_VERSION}.jar \
&& curl --location --silent --show-error --output ${JMETER_HOME}/lib/cmdrunner-${CMDRUNNER_VERSION}.jar http://search.maven.org/remotecontent?filepath=kg/apc/cmdrunner/${CMDRUNNER_VERSION}/cmdrunner-${CMDRUNNER_VERSION}.jar \
&& curl --location --silent --show-error --output ${JMETER_HOME}/lib/json-lib-${JSON_LIB_FULL_VERSION}.jar https://search.maven.org/remotecontent?filepath=net/sf/json-lib/json-lib/${JSON_LIB_VERSION}/json-lib-${JSON_LIB_FULL_VERSION}.jar \
&& java -cp ${JMETER_HOME}/lib/ext/jmeter-plugins-manager-${JMETER_PLUGINS_MANAGER_VERSION}.jar org.jmeterplugins.repository.PluginManagerCMDInstaller \
&& PluginsManagerCMD.sh install \
blazemeter-debugger=0.6,\
bzm-hls=1.2,\
bzm-http2=1.4,\
bzm-parallel=0.9,\
bzm-random-csv=0.6,\
bzm-rte=1.0.4,\
bzm-siebel=0.1.0-beta,\
custom-soap=1.3.3,\
jmeter.backendlistener.elasticsearch=2.6.0,\
jpgc-autostop=0.1,\
jpgc-casutg=2.8,\
jpgc-cmd=2.2,\
jpgc-csl=0.1,\
jpgc-csvars=0.1,\
jpgc-dbmon=0.1,\
jpgc-directory-listing=0.2,\
jpgc-dummy=0.2,\
jpgc-ffw=2.0,\
jpgc-fifo=0.2,\
jpgc-filterresults=2.2,\
jpgc-functions=2.1,\
jpgc-ggl=2.0,\
jpgc-graphs-additional=2.0,\
jpgc-graphs-basic=2.0,\
jpgc-graphs-composite=2.0,\
jpgc-graphs-dist=2.0,\
jpgc-graphs-vs=2.0,\
jpgc-hadoop=2.0,\
jpgc-httpraw=0.1,\
jpgc-jms=0.2,\
jpgc-jmxmon=0.2,\
jpgc-json=2.7,\
jpgc-lockfile=0.1,\
jpgc-mergeresults=2.1,\
# jpgc-oauth=0.1,\
jpgc-pde=0.1,\
jpgc-perfmon=2.1,\
jpgc-plancheck=2.4,\
# jpgc-plugins-manager=${JMETER_PLUGINS_MANAGER_VERSION},\
jpgc-prmctl=0.4,\
jpgc-redis=0.3,\
jpgc-rotating-listener=0.2,\
jpgc-sense=3.5,\
jpgc-standard=2.0,\
jpgc-sts=2.4,\
jpgc-synthesis=2.2,\
jpgc-tst=2.5,\
jpgc-udp=0.4,\
jpgc-webdriver=3.0,\
jpgc-wsc=0.7,\
jpgc-xml=0.1,\
jpgc-xmpp=1.5.1,\
kafkameter=0.2.0,\
mqtt-sampler=0.0.1-SNAPSHOT,\
netflix-cassandra=0.2-SNAPSHOT,\
ssh-sampler=1.1.1-SNAPSHOT,\
tilln-sshmon=1.1,\
tilln-wssecurity=1.6,\
websocket-sampler=1.0.2-SNAPSHOT,\
websocket-samplers=1.2.1 \
&& jmeter --version \
&& PluginsManagerCMD.sh status \
&& chmod +x ${JMETER_HOME}/bin/*.sh \
&& if [ `ls -l /opt/apache-jmeter-*/lib/ | wc -l` != ${NUMBER_OF_FILES_UNDER_LIB} ]; then exit -1; fi \
&& if [ `ls -l /opt/apache-jmeter-*/lib/ext/ | wc -l` != ${NUMBER_OF_FILES_UNDER_LIB_EXT} ]; then exit -1; fi \
&& rm -fr /tmp/*
# Install Gecko Driver
RUN curl -sL "https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux64.tar.gz" | \
tar -xz -C ${JMETER_HOME}/bin
#Install Chromium and ChromeDriver
RUN \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk --no-cache update \
&& apk --no-cache upgrade \
&& apk add --no-cache --virtual .build-deps gifsicle pngquant optipng libjpeg-turbo-utils udev ttf-opensans chromium \
&& rm -rf /var/cache/apk/* /tmp/* /usr/include
RUN apk add chromium-chromedriver
RUN cp /usr/bin/chromedriver ${JMETER_HOME}/bin
COPY ./workaround.sh /tmp/workaround.sh
RUN chmod +x /tmp/workaround.sh
RUN cp /tmp/workaround.sh ${JMETER_HOME}/bin
# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN sed -i -e 's/v[[:digit:]]\.[[:digit:]]/edge/g' /etc/apk/repositories
RUN apk update
RUN apk upgrade
RUN apk add x11vnc
RUN apk add xvfb
RUN apk add firefox --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
RUN apk --no-cache add ca-certificates
RUN mkdir ~/.vnc
# Setup a password
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
# Install new guava version
RUN wget "http://search.maven.org/remotecontent?filepath=com/google/guava/guava/23.0/guava-23.0.jar" -O "guava-23.0.jar"
RUN su
RUN mv ./guava-23.0.jar ${JMETER_HOME}/lib
RUN rm ${JMETER_HOME}/lib/guava-19.0.0.jar
RUN exit
jmeter.log
2019-06-29 11:55:40,517 INFO o.a.j.u.JMeterUtils: Setting Locale to en_EN
2019-06-29 11:55:40,565 INFO o.a.j.JMeter: Loading user properties from: /opt/apache-jmeter-5.1.1/bin/user.properties
2019-06-29 11:55:40,565 INFO o.a.j.JMeter: Loading system properties from: /opt/apache-jmeter-5.1.1/bin/system.properties
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: Copyright (c) 1998-2019 The Apache Software Foundation
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: Version 5.1.1 r1855137
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: java.version=1.8.0_202
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: os.name=Linux
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: os.arch=amd64
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: os.version=4.9.125-linuxkit
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: file.encoding=UTF-8
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: java.awt.headless=true
2019-06-29 11:55:40,576 INFO o.a.j.JMeter: Max memory =1073741824
2019-06-29 11:55:40,577 INFO o.a.j.JMeter: Available Processors =2
2019-06-29 11:55:40,585 INFO o.a.j.JMeter: Default Locale=English (EN)
2019-06-29 11:55:40,585 INFO o.a.j.JMeter: JMeter Locale=English (EN)
2019-06-29 11:55:40,585 INFO o.a.j.JMeter: JMeterHome=/opt/apache-jmeter-5.1.1
2019-06-29 11:55:40,585 INFO o.a.j.JMeter: user.dir =/jmeter
2019-06-29 11:55:40,586 INFO o.a.j.JMeter: PWD =/jmeter
2019-06-29 11:55:40,586 INFO o.a.j.JMeter: IP: 172.17.0.2 Name: e31d62320a47 FullName: e31d62320a47
2019-06-29 11:55:40,596 INFO o.a.j.s.FileServer: Default base='/jmeter'
2019-06-29 11:55:40,612 INFO o.a.j.s.FileServer: Set new base='/workspace'
2019-06-29 11:55:40,917 INFO o.a.j.s.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2
2019-06-29 11:55:40,947 INFO o.a.j.s.SaveService: Using SaveService properties file encoding UTF-8
2019-06-29 11:55:40,957 INFO o.a.j.s.SaveService: Using SaveService properties version 5.0
2019-06-29 11:55:40,973 INFO o.a.j.s.SaveService: Loading file: /workspace/login_test_chrome.jmx
2019-06-29 11:55:41,058 INFO o.a.j.p.h.c.CookieManager: Settings: Delete null: true Check: true Allow variable: true Save: false Prefix: COOKIE_
2019-06-29 11:55:41,087 INFO o.a.j.s.SampleResult: Note: Sample TimeStamps are START times
2019-06-29 11:55:41,087 INFO o.a.j.s.SampleResult: sampleresult.default.encoding is set to ISO-8859-1
2019-06-29 11:55:41,088 INFO o.a.j.s.SampleResult: sampleresult.useNanoTime=true
2019-06-29 11:55:41,088 INFO o.a.j.s.SampleResult: sampleresult.nanoThreadSleep=5000
2019-06-29 11:55:41,153 INFO o.a.j.JMeter: Creating summariser <summary>
2019-06-29 11:55:41,171 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2019-06-29 11:55:41,172 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2019-06-29 11:55:41,172 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2019-06-29 11:55:41,190 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must contain the string: '.functions.'
2019-06-29 11:55:41,190 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must not contain the string: '.gui.'
2019-06-29 11:55:41,504 INFO o.a.j.JMeter: Running test (1561809341503)
2019-06-29 11:55:41,543 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
2019-06-29 11:55:41,543 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group Thread Group.
2019-06-29 11:55:41,543 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
2019-06-29 11:55:41,544 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false
2019-06-29 11:55:41,567 INFO o.a.j.t.ThreadGroup: Started thread group number 1
2019-06-29 11:55:41,567 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
2019-06-29 11:55:41,573 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1
2019-06-29 11:55:43,052 ERROR c.g.j.p.w.s.WebDriverSampler: null
2019-06-29 11:55:43,100 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1
2019-06-29 11:55:43,100 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1
2019-06-29 11:55:43,184 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2019-06-29 11:55:43,186 INFO o.a.j.r.Summariser: summary = 1 in 00:00:02 = 0.6/s Avg: 0 Min: 0 Max: 0 Err: 1 (100.00%)
我正在使用以下版本: ChromeDriver 73.0.3683.103 铬73.0.3683.103
答案 0 :(得分:0)
不幸的是,我们不能无视:
在此期间,您可以使用以下清单: