JM Running

Jenkins Job Control with Parallel JMeter Projects

On this page we show how we can run projects in parallel, for those cases where applications share server resources and integration testing is required.

Typically, we run tests by triggering an environment build with a cron setting (once a day at 5am for example) and setting that job to call the test run job and then calling the tear down job if that passes - note, if the test fails, we leave the environment up so we can investigate any issues:

Build the test environment in the cloud every morning at 5am:

b_image001

Set this job to trigger the performance test run:

b_image002

Set the performance test build to trigger the environment tear down if everything goes well:

b_image003

The above scenario works well for a lot of CI projects, as we build bespoke environments anyway, but sometimes you need to run more than one project concurrently. In this situation, you can use the build flow plugin and a groovy script to add a bit more control on the builds and tear downs. Note: to run two of the jmeter performance tests concurrently, you need to set up two cloud jenkins server controllers and set them to allow only one job concurrently on each.

https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin uses groovy scripts. The following script builds an environment, runs two performance tests in parallel and shuts down the test environment only if both tests pass. Note: the tests themselves take care of sparking up their own test injectors and shutting them down when finished:

out.println  'Starting build control script'
b = build( "BIPs CI Perf step 1A - build perf env (S3 bucket)" )

// output values
//out.println 'Triggered Parameters Map:'
//out.println params
//out.println 'Build Object Properties:'
//build.properties.each { out.println "$it.key -> $it.value" }

out.println  'BIPs CI Perf step 1A - build perf env (S3 bucket) = ' + b.build.result

if ( b.build.result == SUCCESS )
{
   parallel (
       // job 1, 2 and 3 will be scheduled in parallel.
       { c = build("BIPs CI Perf step 2A - run test (dev)") },
       { d = build("BIPs CI Perf step 2A - run test (service)") }
   )

   out.println  'BIPs CI Perf step 2A - run test (dev) = ' + c.build.result
   out.println  'BIPs CI Perf step 2A - run test (service) = ' + d.build.result

   if ( c.build.result == SUCCESS && d.build.result == SUCCESS )
   {
       e = build("BIPS CI Perf step 3 - teardown bips perf env")
       out.println  'BIPS CI Perf step 3 - teardown bips perf env = ' + e.build.result
   }
   else
   {
       out.println  'dev or service tests failed. Not running tear down'
   }
}
else
{
   out.println  'Env build failed. Not running tests or tear down'
}
out.println  'Finished build control script'
 

[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