Linux installation configuration Jenkins at + Jmeter

1. Install jenkins.

1.1 on a Linux server, you must first install jdk and Tomcat,

In / opt / tools / tomcat install unzip Tomcat

1.2 . Jmeter installed on a Linux server

Extracting jmeter folder under / opt / tools / directory

tar -zxvf apache-jmeter-3.1.tgz

Then set the environment variable

Jmeter environment configuration is as follows:
we /root/.bash_profile
 
export JMETER_HOME=/opt/tools/apache-jmeter-3.1 export CLASSPATH=$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:$JMETER_HOME/lib/logkit-2.0.jar:$CLASSPATH export PATH=$JMETER_HOME/bin:$PATH:$HOME/bin
 
 
 
s: starting from the current cursor position to the specified number of alternative input text characters
Press the ESC key to skip the command mode, and then: wq Save the file and exit vi
source /root/.bash_profile
 
Then the command line to see if the setup is complete environment jmeter

 

1.3 The bag is placed in jenkins.war / tomcat / webapps

Then start tomcat,. / Startup.sh & tail -f ../logs/catalina.out

Then in the windows environment, open jenkins address,

The jmeter each project directory set in the following directory

2. Install jmeter in / opt / tools directory and configuration environment variable.

This blog post I have already said, there is not elaborate.

3.jenkins configured jmeter project

3.1 to create a new free-style project, to build the project name

3.2 New Script and Project template name

3.3 New Remote server address template

3.4 . Construction of the project - Project Initialization

3.5 Construction of the project - executing script

# Execute scripts
CD /opt/tools/apache-jmeter-3.1/bin
Time = DATE + `" the Y% m% D% H% M% S% "` # current time
jtl_dir = / opt / workspace / $ {JOB_DIR} / JTL
JLT jtl_dir} = {$ /} _ $ $ JOB_DIR {} {Time .jtl
Scrip = / opt / Workspace / JOB_DIR} {$ /} $ {JMETER_SRIPT

echo ${SLAVE_SERVERS} | grep ":"
if [ $? -eq 0 ]
then
/opt/tools/apache-jmeter-3.1/bin/jmeter -n -t ${scrip} -R ${SLAVE_SERVERS} -l ${jlt}
else
/opt/tools/apache-jmeter-3.1/bin/jmeter -n -t ${scrip} -l ${jlt}
fi

3.6 . Template generated picture

#生成图片
JMETER_LIB=/opt/tools/apache-jmeter-3.1/lib/ext
png_dir=/opt/workspace/${JOB_DIR}/png
job_home=/opt/workspace/${JOB_DIR}/jtl
cd ${job_home}

3.7 generates HTML template

#生成HTML
jtl_dir=/opt/workspace/${JOB_DIR}/jtl
html_dir=/opt/workspace/${JOB_DIR}/html
JMETER_HOME=/opt/tools/apache-jmeter-3.1
cd ${jtl_dir}
for file in $(ls | grep jtl)
do
name=${file%.*}
xsltproc ${JMETER_HOME}/extras/jmeter-results-detail-report_21.xsl ${file} > ${html_dir}/${name}.html
done

3.8 Operating -HTML report after building

3.9 generation jtl report

Guess you like

Origin www.linuxidc.com/Linux/2019-09/160612.htm