0
0
Jenkinsdevops~10 mins

Parallel test execution in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to run two test stages in parallel in Jenkins pipeline.

Jenkins
pipeline {
  agent any
  stages {
    stage('Parallel Tests') {
      steps {
        parallel {
          test1: {
            echo 'Running Test 1'
          },
          test2: [1]
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
A{ echo 'Running Test 2' }
B[ echo 'Running Test 2' ]
C( echo 'Running Test 2' )
D< echo 'Running Test 2' >
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets [] or parentheses () instead of braces {} for parallel stages.
Forgetting to wrap the steps inside braces.
2fill in blank
medium

Complete the code to define parallel stages with names 'Unit Tests' and 'Integration Tests'.

Jenkins
parallel {
  [1]: {
    echo 'Running Unit Tests'
  },
  integrationTests: {
    echo 'Running Integration Tests'
  }
}
Drag options to blanks, or click blank then click option'
AunitTests
BUnitTests
Cunit_tests
Dunit-tests
Attempts:
3 left
💡 Hint
Common Mistakes
Using dashes '-' in stage names which is invalid syntax.
Using uppercase letters at the start which may cause confusion.
3fill in blank
hard

Fix the error in the parallel block by completing the missing keyword.

Jenkins
pipeline {
  agent any
  stages {
    stage('Tests') {
      steps {
        [1] {
          testA: {
            echo 'Test A'
          },
          testB: {
            echo 'Test B'
          }
        }
      }
    }
  }
}
Drag options to blanks, or click blank then click option'
Asteps
Bsequence
Cstages
Dparallel
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'stages' or 'steps' instead of 'parallel' causes syntax errors.
Omitting the keyword entirely.
4fill in blank
hard

Fill both blanks to create a parallel block with two test stages that each run a shell command.

Jenkins
parallel {
  testOne: {
    sh [1] 'echo Test One'
  },
  testTwo: {
    sh [2] 'echo Test Two'
  }
}
Drag options to blanks, or click blank then click option'
A"script"
B'script'
C"command"
D'command'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes for the argument name causes errors.
Using 'command' instead of 'script' as the argument name.
5fill in blank
hard

Fill all three blanks to define a parallel block with three test stages, each echoing a different message.

Jenkins
parallel {
  testA: {
    echo [1]
  },
  testB: {
    echo [2]
  },
  testC: {
    echo [3]
  }
}
Drag options to blanks, or click blank then click option'
A'Running Test A'
B'Running Test B'
C'Running Test C'
D'Running Test D'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up the messages between stages.
Forgetting to use quotes around the echo messages.