Selenium Java Interview Questions and Answers Part-24
1) What is Git? What is the difference between Git and GitHub?
Git is a distributed version-control system for tracking changes in any set of files.
Git is a version control system to manage source code history but GitHub is a hosting service for Git repositories.
2) What is Maven and explain about different Maven goals?
Maven is a build automation tool used primarily for Java projects. Maven addresses two aspects of building software: how software is built and its dependencies.
A plugin goal represents a specific task which contributes to the building and managing of a project. Below are some of the phases and default goals bound to them:
compiler:compile the compile goal from the compiler plugin is bound to the compile phase
compiler:testCompile it is bound to the test-compilephase
surefire:test it is bound to testphase
install:install it is bound to installphase
jar:jar and war:war it is bound to package phase
3) What is the difference between SVN & GIT?
Git is a distributed version control system but SVN is a centralized version control system.
4) How do you maintain source code in GIT?
We maintain source code inside different repositories in GIT.
5) What are the different plugins used for Maven? And it’s use?
Some of the important plugins in Maven are:
– clean: cleans up the target directories after the build is completed
– compiler: compiles the Java Source Code
– deploy: Deploys the built artifact to remote repository
– failsafe: Runs the integration tests
– install: Install the built artifact in the local repository
– surefire: Runs the unit tests
6) What’s the difference between plug-ins and dependencies?
Plugins are core feature of Maven which allow reuse of common build logic across different projects.
Dependencies are different archives which is required to build/compile/run current project.
7) How do you define dependencies in your Maven Project?
While working with a Maven project we need different libraries to run the project. These libraries can be automatically downloaded and managed by Maven dependencies.
8) What is Maven and its advantages of using it in your Selenium Project ?
Maven is a build management tool. Maven is used to define project structure, build and test management.
9) What is the name of maven folder which contains all the libraries?
External Libraries contain all the libraries.
10) Explain the life cycle of Maven?
Lifecycle of maven is the process of building and distributing a particular artifact. There are 3 built in build lifecycles – default, clean and site.
11) Explain different Git commands?
git add – Add file contents to the index
git commit – Record changes to the repository
git pull – Fetch from and integrate with another repository or a local branch
git push – Update remote refs along with associated objects
git init – Create an empty Git repository or reinitialize an existing one
git clone – Clone a repository into a new directory
12) In Maven, from where the jar files will get downloaded from?
In maven jar files are downloaded from the maven central repository.
13) In Maven, do we have to manually download and configure/update the required jar files?
No. Maven automatically downloads and updates the required jar files and dependencies.
14) What are the different phases of Maven?
The default lifecycle comprises of the following phases :
validate – validate the project is correct and all necessary information is available
compile – compile the source code of the project
test – test the compiled source code using a suitable unit testing framework.
package – take the compiled code and package it in its distributable format, such as a JAR.
verify – run any checks on results of integration tests to ensure quality criteria are met
install – install the package into the local repository, for use as a dependency in other projects locally
deploy – done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.
15) What is Jenkins?
Jenkins is an open source Continuous Integration tool. It helps to automate the different stages of software development lifecycle like building, testing and deployment.
16) How do you start Jenkins?
We can start Jenkins by running the following command:
java -jar jenkins.war –httpPort=8080
17) How will you configure Jenkins?
We need to configure the following in Jenkins:
– Source Code Management
– Build Triggers
– Build Environment
– Build
– Post-build Actions
18) What are the basic plugins you used in Jenkins?
Some of the basic plugins in Jenkins are:
– Email Extension
– Git
– JUnit
– Maven Integration
– NodeJS Plugin
– SSH Plugin
– Pipeline
– Browserstack
19) How to create a job in Jenkins?
– Click on New Item in Jenkins dashboard
– Enter an item name
– Select type of project (Ex – Freestyle Project)
– Enter configuration details for the job
– Save the job
20) On what platform JENKINS will work?
Jenkins can run on Windows, Linux, MacOS and other Unix like operating systems.
21) How do you manage reports in Jenkins?
We can manage reports with the help of different reporting plugins like Junit, Cucumber, HTML.
22) How to integrate your test with Jenkins?
We can integrate our test by adding the git repository in the Source Code Management section and then invoking the maven goals in Build section to run the tests.
23) How do you setup Maven Project in Jenkins?
– Click on New Item in Jenkins dashboard
– Enter an item name
– Select type of project as Maven Project
24) Jenkins Tool – Scheduled Batch Run?
We can schedule our builds to run automatically in Jenkins by configuring the Build Triggers.
Ex – Select Build Periodically and enter H/15 * * * * to run the build every 15 minutes.
25) How to run the test scripts in Jenkins?
We can run test scripts in Jenkins in the following ways:
– By invoking Maven Goals in Build section
– By executing shell/batch command
Next Steps:
> More interview questions and answers on Selenium Java, continue to the next post (Click on Next Post link below)
> Check complete Selenium Java interview questions and answers here (Click here)
Please leave your questions/comments/feedback below.
Happy Learning ?
Connect to me on Linked In (Click here)
On a mission to contribute to the Software Testing Community in all possible ways.