简体   繁体   中英

CSV data set config- Jmeter Docker

I am creating a Jmeter docker container. Test inputs are driven from CSV(data set config). What should be filename path that i need set in the script

you should set the file path to the path seen from docker that is related to the volume.:

For example:

docker run -v "DIR of machine":"DIR inside docker container"

Given you're creating a JMeter docker container you should be aware where to drop the CSV file. Normally it is recommended to use relative paths to the CSV files in scripts for better maintainability or for distributed testing

So I would suggest using Docker COPY instruction in order to transfer your CSV file to JMeter's "bin" folder and use just filename in the CSV Data Set Config

Given the example Dockerfile from the Make Use of Docker with JMeter - Learn How article:

# 1
FROM alpine:3.6

# 2
LABEL maintainer=”vincenzo.marrazzo@domain.personal>

# 3
ARG JMETER_VERSION="5.0"

# 4
ENV JMETER_HOME /opt/apache-jmeter-${JMETER_VERSION}
ENV JMETER_BIN  ${JMETER_HOME}/bin
ENV MIRROR_HOST http://mirrors.ocf.berkeley.edu/apache/jmeter
ENV JMETER_DOWNLOAD_URL ${MIRROR_HOST}/binaries/apache-jmeter-${JMETER_VERSION}.tgz
ENV JMETER_PLUGINS_DOWNLOAD_URL http://repo1.maven.org/maven2/kg/apc
ENV JMETER_PLUGINS_FOLDER ${JMETER_HOME}/lib/ext/

# 5
RUN    apk update \
    && apk upgrade \
    && apk add ca-certificates \
    && update-ca-certificates \
            && apk add --update openjdk8-jre tzdata curl unzip bash \
            && cp /usr/share/zoneinfo/Europe/Rome /etc/localtime \
            && echo "Europe/Rome" >  /etc/timezone \
    && rm -rf /var/cache/apk/* \
    && mkdir -p /tmp/dependencies  \
    && curl -L --silent ${JMETER_DOWNLOAD_URL} >  /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz  \
    && mkdir -p /opt  \
    && tar -xzf /tmp/dependencies/apache-jmeter-${JMETER_VERSION}.tgz -C /opt  \
    && rm -rf /tmp/dependencies

# 6
RUN curl -L --silent ${JMETER_PLUGINS_DOWNLOAD_URL}/jmeter-plugins-dummy/0.2/jmeter-plugins-dummy-0.2.jar -o ${JMETER_PLUGINS_FOLDER}/jmeter-plugins-dummy-0.2.jar
RUN curl -L --silent ${JMETER_PLUGINS_DOWNLOAD_URL}/jmeter-plugins-cmn-jmeter/0.5/jmeter-plugins-cmn-jmeter-0.5.jar -o ${JMETER_PLUGINS_FOLDER}/jmeter-plugins-cmn-jmeter-0.5.jar

# 7
ENV PATH $PATH:$JMETER_BIN

# 8
COPY launch.sh /
COPY somefile.csv $JMETER_BIN
#9
WORKDIR ${JMETER_HOME}

#10
ENTRYPOINT ["/launch.sh"]

So this line:

COPY somefile.csv $JMETER_BIN

will transfer your CSV file into "bin" folder of your JMeter installation therefore you will be able to refer it just as somefile.csv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM