الرئيسية / Open source / Jenkins / Configure Gatling Stress Tests command line for Jenkins

Configure Gatling Stress Tests command line for Jenkins

Install Gatling

In order to let jenkins jobs run gatling bundle you should install the bundle under jenkins home (by default /var/lib/jenkins)

wget https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/2.1.7/gatling-charts-highcharts-bundle-2.1.7-bundle.zip
unzip gatling-charts-highcharts-bundle-2.1.7-bundle.zip
sudo mkdir /var/lib/jenkins/tools
mv gatling-charts-highcharts-bundle-2.1.7 /var/lib/jenkins/tools/
cd /var/lib/jenkins/
chown -R jenkins:jenkins tools

Call Galing Task in a Jenkins Jobs

Install Gatling Plugins https://wiki.jenkins-ci.org/display/JENKINS/Gatling+Plugin

On your source we propose this tree source
|-data : contains all data needed for gatling secnario
|-simulations : contains your scala files

#!/bin/bash --login
cp -r $WORKSPACE/data/* $JENKINS_HOME/tools/gatling-charts-highcharts-bundle-2.1.7/user-files/data/
cp -r $WORKSPACE/simulations/* $JENKINS_HOME/tools/gatling-charts-highcharts-bundle-2.1.7/user-files/simulations/
#Set gatling parameters
export JAVA_OPTS="-Durl=$url 
-DanonymousUsers=$anonymousUsers 
-DanonymousWithCartUsers=$anonymousWithCartUsers 
-DcustomerUsers=$customerUsers 
-Dramp=$ramp 
-DpauseTime=$pauseTime 
-DmaxCartLines=$maxCartLines
-DnbCategoryLoop=$nbCategoryLoop
-DnbProductLoop=$nbProductLoop
-DnbSearchLoop=$nbSearchLoop
-DnbMyAccountLoop=$nbMyAccountLoop"
cd $JENKINS_HOME/tools/gatling-charts-highcharts-bundle-2.1.7/bin
./gatling.sh -s MyScenario -rf $WORKSPACE/results

Troubleshooting

Gatling charts and results may got bug when display them inside jenkins. This is a security issue and to correcte it :

edit /etc/default/jenkins and change the JAVA_ARGS value :

JAVA_ARGS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP=" 

https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy#ConfiguringContentSecurityPolicy-Implementation

عن Wicem

اترك تعليقاً

لن يتم نشر عنوان بريدك الإلكتروني. الحقول الإلزامية مشار إليها بـ *