Running parallel jobs in Jenkins

I’m using Jenkins for my builds, and I wrote some test scripts that I need to run after the compilation of the build.
I want to save some time, so I have to run the test scripts parallel. How can I do that?

EDIT: ok, I understand know that I need a separate Job for each test (for 4 tests I need 4 jobs, right?)
So, I did that, and via the parent job I ran this jobs. (using “build other projects” plugin).
But I didn’t managed to aggregate the results (using aggregate downstream test results). The parent job exits before the downstream jobs were finished.
What shall I do?

  • Can I get Jenkins to build a git tag from a passed in parameter?
  • Web Deploy 3.0 won't work on CI server
  • Jenkins: How To Build multiple projects from a TFS repository?
  • How to trigger a jenkins build on specific node using pipeline plugin?
  • How to push changes to github after jenkins build completes?
  • Jenkins - Xcode build works codesign fails
  • Thanks.

  • How are environment variables used in Jenkins with Windows Batch Command?
  • Jenkins / Hudson environment variables
  • iOS app version and build numbers for iTunesConnect TestFlight
  • Jenkins hanging at “Fetching upstream changes from origin”
  • How to export environment variable from Jenkins Build Flow Plugin?
  • how to get progress bar data for a running jenkins job through the API
  • 6 Solutions collect form web for “Running parallel jobs in Jenkins”

    You can use multi-job plugin. This would allow you to run multiple jobs in parallel and the parent job would wait for the sub jobs to be completed. The parent jobs status can be determined by the sub jobs status.

    https://wiki.jenkins-ci.org/display/JENKINS/Multijob+Plugin

    Jenkins doesn’t really allow you to run things in parallel. You can however split your build into different jobs to achieve this. It would look like this.

    • Job to compile the source runs.
    • Jobs that run the tests are triggered by the completion of the compilation and start running. They copy compilation results from the previous job into their workspaces.

    This is a big kludgy though. The better alternative would be to parallelise within the scripts that run the tests, i.e. you run a single script and this then runs the tests in parallel. If this is not possible, you’ll have to split into different jobs though.

    Have you looked at the Jenkins JOIN Plugin? I have not used it but I believe it is what you are attempting to accomplish.

    – Mike

    Actually you can but you will need some coding behind.
    In my case, I have parallel test execution on jenkins.

    1) Create a small job with parameters that is supposed to do a test run with a small suite

    2) Edit this job to run on a list of slaves (where you have the proper environment)

    3) Edit this build to allow concurrent builds

    And now the hard part.

    4) Create a small java program for computing the list of parameters for each job to run.

    5) Iterate trough the list and launch a new Jenkins job on a new thread.

    Put a Thread.sleep(5000) between runs in order to avoid communication errors

    6) Join the threads

    At the end of each job, I send the results to a shared location in order to perform some reporting at the end of all tests.

    For starting a jenkins job with parameters use CLI

    I intend to make my code as generic as possible and publish it if anyone else will need it.

    You can use https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin with code like this

    parallel (

    // job 1, 2 and 3 will be scheduled in parallel.
    { build("job1") },
    { build("job2") },
    { build("job3") }
    

    )

    You can use any one of the followings:

    1. Multijob plugin

    2. Build Flow plugin

    Git Baby is a git and github fan, let's start git clone.