0
0
Selenium Pythontesting~10 mins

Jenkins integration in Selenium Python - Interactive Code Practice

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

Complete the code to import the Jenkins library in Python.

Selenium Python
import [1]
Drag options to blanks, or click blank then click option'
Arequests
Bjenkinsapi
Cselenium
Djenkins
Attempts:
3 left
💡 Hint
Common Mistakes
Using selenium instead of jenkins for Jenkins integration.
Importing requests which is for HTTP calls but not Jenkins specific.
2fill in blank
medium

Complete the code to create a Jenkins server object with URL 'http://localhost:8080'.

Selenium Python
server = jenkins.Jenkins([1])
Drag options to blanks, or click blank then click option'
A'http://127.0.0.1:8080'
B'http://0.0.0.0:8080'
C'http://localhost:8080'
D'http://jenkins.local:8080'
Attempts:
3 left
💡 Hint
Common Mistakes
Using IP address instead of 'localhost'.
Forgetting quotes around the URL string.
3fill in blank
hard

Fix the error in the code to trigger a Jenkins build for job 'TestJob'.

Selenium Python
server.[1]('TestJob')
Drag options to blanks, or click blank then click option'
Abuild_job
Btrigger_build
Cstart_build
Drun_job
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like 'start_build' or 'run_job'.
Confusing method names that do not exist in the Jenkins API.
4fill in blank
hard

Fill both blanks to check if the last build of 'DeployJob' was successful.

Selenium Python
last_build_number = server.get_job_info('DeployJob')['[1]']['number']
status = server.get_build_info('DeployJob', last_build_number)['[2]']
Drag options to blanks, or click blank then click option'
AlastBuild
Bresult
CbuildStatus
Dlast_build
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect keys like 'buildStatus' or 'last_build'.
Confusing the keys for job info and build info.
5fill in blank
hard

Fill all three blanks to trigger a build with parameters for job 'TestJob'.

Selenium Python
params = {'branch': 'main', 'env': 'staging'}
server.[1]('TestJob', [2]=[3])
Drag options to blanks, or click blank then click option'
Abuild_job
Bparameters
Cparams
Dbuild_with_parameters
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'build_with_parameters' instead of 'build_job'.
Mixing up argument names and variable names.