Maven & GIT Interview Questions Flashcards
How can you make sure that all team members are using the same Selenium version?
Use tools like Maven that give version and build control for team perspective and have the same version in pom.xml
What is Maven?
Maven is a build automation tool or a project management tool. In Maven we have many inbuilt templates. These templates are called archetypes.
As automation engineers using Maven, we can create project structure, manage project required dependencies and execute script from command line interface (CLI)
What is POM.XML?
POM stands for “Project Object Model”
The pom.xml file contains information of project and project configuration information for Maven to build the project such as dependencies, build directory, source directory, test source directory, plugin, goals etc.
Maven reads the pom.xml file then executes the goal.
What is the Maven Repository? What are their types?
Maven repository is a location where all the project jars, library jars, plugins or any other particular project related artifacts are stored and can be easily used by Maven.
Maven repository types:
● local - repository inside your computer (.M2)
● central (https://mvnrepository.com/)
● remote - developer’s own custom repository containing required libraries or other project jars.
For example, in a corporate office there may be projects or modules specific to the organization. In this case, organizations can create remote repositories and deploy these private artifacts.
This remote repository will be accessible only inside the organization.
What is dependency and how to handle dependencies in a framework?
In Maven we have dependencies. A dependency is a JAR file which will be added to the classpath. While executing the tasks we are going to update the dependencies in the POM.xml which is the heart of Maven project.
We use dependencies in our framework because of compatibility issues as we work in a team. For example, if the Selenium Webdriver version is not supported, we can simply update the dependency file with a different version.
Here we can simply change the version according to the compatibility.
How do you submit plugins in Maven? What are they? Version?
Maven Plugins are generally used to:
● Maven compiler plugin - compile code files
● Maven surefire plugin - is used during the test phase of the build lifecycle to execute the unit tests of an application
A plugin provides a set of goals, which can be executed using the following syntax:
mvn [plugin-name]:[goal-name]
List out some Maven build phases?
The following are the 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. These tests should not require the code be packaged or deployed
● package − take the compiled code and package it in its distributable format, such as a JAR.
● integration-test − process and deploy the package if necessary into an environment where integration tests can be run.
● verify − run any checks to verify the package is valid and meets quality criteria.
● install − install the package into the local repository, for use as a dependency in other projects locally.
● deploy − done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.
What type of version control do you use?
Version Control is essential to development, even if you’re working by yourself because it protects you from yourself. If you make a mistake, it’s a simple matter to roll back to a previous version of your code that you know works. This also frees you to explore and experiment with your code because you’re free of worries about whether what you’re doing is reversible or not.
We have used Maven for build generation and Git for version control.
Explain what is a Maven artifact?
Usually, an artifact is a JAR file which gets arrayed to a Maven repository. One or more artifacts a Maven build produces includes a compiled JAR and a sources JAR. Each artifact includes a group ID, an artifact ID and a version string.
What is GIT?
GIT is a distributed version control system and source code management (SCM) system with an emphasis to handle small and large projects with speed and efficiency.
- What is the function of git clone?
The git clone command creates a copy of an existing Git repository. To get a copy of a central repository, ‘cloning’ is the most common method used by programmers.
- What is the function of ‘git config’?
The ‘git config’ command is a convenient way to set configuration options for your Git installation. Behavior of a repository, user info, preferences etc. can be defined through this command.
How can you create a repository in Git?
In Git, to create a repository, create a directory for the project if it does not exist, and then run command “git init”. By running this command, the .git directory will be created in the project directory.
What is a ‘conflict’ in git?
A ‘conflict’ arises when the commit that has to be merged has some change in one place, and the current commit also has a change at the same place. Git will not be able to predict which change should take precedence.
What is ‘git status’ used for?
As ‘git status’ shows you the difference between the working directory and the index, it is helpful in understanding GIT more comprehensively.