JM Variables

System Properties from the Jenkins build

We want a method of getting command line arguments over to the jmeter instances on the injectors. The solution so far is not designed for this so here is a quick addition that allows us to set jmeter system properties from the Jenkins command line.

The project zip file will be updated today (20th May 2014) to add this functionality.

In this example, I'll set 3 variables, including 'check' = 'yes'. Steps involved are as follows:

    1. Jenkins build script - add the call to (from the jmeter directory):
    #run the test
    cd /usr/local/jmeter
    #setup any bespoke script variables - read these from file within jmeter - see
    project="programmes-4od" ./ scala=s env=perf check=yes

    #setting STOP failsafe to 5400 seconds. jmx file set to run for 3600 seconds (1 hour).
    project="programmes-4od" setup="false" terminate="TRUE" count=8 STOP="5400" ./
    echo Controller return value = $return


    2. Inside the shell script that creates a file on the controller (now included in the project):
    Name=$(echo ${pair} | cut -d\= -f1)
    rm -f --interactive=never
    grep -v "${Name}=" >>
    echo ${pair} >>
    mv -f


    3. Changes to the jmeter-ec2 script to copy over the environment file to the injectors:
    (scp -q -C -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r \
                                                              -i $PEM_PATH/$PEM_FILE \
                                                              $LOCAL_HOME/$project/ \
                                                              $USER@$host:$REMOTE_HOME/) &


    4. Jmeter script addition to read in and set the variables ( code is in the example project):
    environmentFile = new File( System.getProperty('baseDir') + '/' )
    array = line.split('=')


5. Using the variable in the jmeter script:
In this case I have just tagged the variable 'check' on the end of the URL, just as a test. Notice 'check' is set to 'yes' in step 1. Above


6. The variable is picked up and reflected in the test results:


[Home] [About (CV)] [Contact Us] [JMeter Cloud] [JM Highlights] [JM Overview] [JM Control] [JM Inject] [JM Threads] [JM Results] [JM Assertions] [JM TPS] [JM Metrics] [JM Runtime] [JM Collation] [JM Logs] [JM 95th] [JM 95th v2] [JM Jenkins] [JM Corporate] [JM Scripts] [JM Variables] [JM Embedded] [JM Hosts] [JM Running] [JM Example] [JM Versions] [webPageTest] [_64 images] [asset moniitor] [Linux Monitor] [Splunk ETL] [Splunk API] [AWS bash] [LR Rules OK] [LR Slave] [LR CI Graphs] [LoadRunner CI] [LR CI Variables] [LR Bamboo] [LR Methods] [LR CI BASH] [Bash methods] [Jenkins V2] [Streaming vid] [How fast] [Finding Issues] [Reporting] [Hand over] [VB Scripts] [JMeter tips] [JMeter RAW] [Dynatrace] [Documents] [FAQ] [Legal]

In the Cartesian Elements Ltd group of companies