1. What is Jenkins?
Jenkins is an open-source automation tool used for Continuous Integration (CI) and Continuous Delivery (CD). It helps automate build, test, and deployment processes.
2. What is Continuous Integration (CI)?
CI is a development practice where developers frequently merge code into a shared repository, and automated builds/tests are triggered to detect issues early.
3. What is Continuous Delivery (CD)?
CD is the process of automatically preparing code changes for release to production after successful testing.
4. Why is Jenkins used in Automation Testing?
- Automates test execution
- Supports scheduled execution
- Integrates with Selenium, Maven, Git, TestNG
- Generates reports
- Helps in CI/CD pipeline
5. What are the advantages of Jenkins?
- Open-source and free
- Large plugin support
- Easy integration with tools
- Platform independent
- Supports distributed builds
6. What is a Jenkins Job?
A Jenkins job/project is a task or automated process configured in Jenkins, such as build execution or test execution.
7. What are the types of Jenkins Jobs?
- Freestyle Project
- Pipeline Project
- Multibranch Pipeline
- Maven Project
8. What is a Jenkins Pipeline?
A Jenkins Pipeline is a sequence of automated steps written as code to build, test, and deploy applications.
9. What is the difference between Declarative and Scripted Pipeline?
| Declarative Pipeline | Scripted Pipeline |
| Simple syntax | Complex and flexible |
| Easy to maintain | Requires Groovy scripting |
| Structured format | More customization |
10. What is Jenkinsfile?
A Jenkinsfile is a text file containing pipeline script written in Groovy that defines CI/CD workflow.
Example:
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Build Started'
}
}
}
}
11. What is Maven in Jenkins?
Maven is a build management tool used to compile code, manage dependencies, and run test cases in Jenkins.
12. How do you integrate Selenium with Jenkins?
Steps:
- Create Selenium Maven project
- Push code to GitHub
- Configure Jenkins job
- Add Git repository URL
- Add Maven commands like: clean test
- Execute build
13. What plugins are commonly used in Jenkins for Automation Testing?
- Git Plugin
- Maven Integration Plugin
- TestNG Plugin
- HTML Report Plugin
- Allure Report Plugin
- Pipeline Plugin
14. How do you schedule a Jenkins job?
Using Build Triggers with CRON expressions.
Example:
H 10 * * *
Runs daily at 10 AM.
15. What is SCM in Jenkins?
SCM stands for Source Code Management. Jenkins integrates with tools like Git and SVN to fetch source code.
16. What is a Jenkins Node and Agent?
- Master: Controls Jenkins
- Agent/Node: Executes jobs assigned by master
17. How does Jenkins trigger automated tests?
Jenkins can trigger tests:
- On code commit
- On schedule
- Manually
- After another job completion
18. How do you generate TestNG reports in Jenkins?
- Add TestNG plugin
- Configure post-build action
- Provide TestNG result XML path
Example:
test-output/testng-results.xml
19. What is Blue Ocean in Jenkins?
Blue Ocean is a modern UI for Jenkins that provides better visualization for pipelines.
20. What happens if a Jenkins build fails?
- Build status becomes FAILED
- Notification can be sent
- Logs help identify issues
- Developers/testers fix the issue and rerun build
21. How do you parameterize a Jenkins job?
By enabling:
This project is parameterized
Parameters:
- String Parameter
- Choice Parameter
- Boolean Parameter
22. What is the difference between Build and Release?
- Build: Compiling and packaging code
- Release: Deploying application to users/environment
23. How can Jenkins send notifications?
Using:
- Slack
- Microsoft Teams
- Telegram plugins
24. What is Git integration in Jenkins?
Jenkins connects with GitHub or Git repositories to pull latest code automatically for execution.
25. Explain Jenkins CI/CD workflow.
- Developer commits code to Git
- Jenkins detects changes
- Build starts automatically
- Test cases execute
- Reports are generated
- Deployment happens if build passes
26. What is the use of Workspace in Jenkins?
Workspace is the directory where Jenkins stores project files and executes builds.
27. What is Poll SCM in Jenkins?
Poll SCM checks source code repository periodically for changes.
Example:
H/5 * * * *
Checks every 5 minutes.
28. How do you run Selenium tests in headless mode through Jenkins?
Use browser options.
Example:
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless");
29. What are post-build actions in Jenkins?
Actions performed after build completion like:
- Publishing reports
- Sending emails
- Archiving artifacts
30. What is an Artifact in Jenkins?
Artifacts are files generated after build execution like:
- JAR files
- Reports
- Logs
- Screenshots