- What is Selenium Grid and when do we go for it?
- What are the advantages of Selenium Grid?
- What is a Hub in Selenium Grid?
- What is a Node in Selenium Grid?
- Explain how Selenium Grid works?
- Can we use Selenium Grid for performance testing?
- What are Selenium Grid Extras and the additional features does it add to Selenium Grid?
- Can’t we execute tests parallel without using Selenium Grid?
- How do you execute tests in Selenium Grid?
- Suppose in selenium grid, there are 4 nodes connected and the test execution started in grid paralleled. In middle of the execution one of the nodes got disconnected. What happens with the execution?
- Suppose in selenium grid, if you are doing parallel testing in 3 browsers. How many reports will your framework generate and how do you segregate each browser execution results?
- When we execute test cases in grid where results will be stored in node or hub?
Selenium Questions Part12: Selenium Grid
Selenium Questions Part11: Selenium Framework Questions
1. What is a Framework?
Answer: A set of guidelines like coding standards, test-data handling, object repository treatment etc. Which when followed during automation scripting produce beneficial outcomes like increase code re-usage, higher portability, reduced script maintenance cost etc. Mind you these are just guidelines and not rules; they are not mandatory and you can still script without following the guidelines. But you will miss out on the advantages of having a Framework.
2. What are the different types of Frameworks?
Answer: Types of Automated Testing Frameworks
- Linear Automation Framework - It's sometimes known as a linear scripting framework or a record and play back framework. It works like this: testers create and write test scripts sequentially, performing it individually for each individual test case, hence the record and play back.
- Modular Based Testing Framework - Modular framework is like creation of small, independent scripts that represents modules, sections and functions of the application under test. Testers use Modular testing framework to divide an application into multiple modules and create test scripts individually.
- Library Architecture Testing Framework - It divides the application-under-test into procedures and functions in its place of scripts. This framework requires the creation of library files that represent modules, sections, and functions of the application-under-test.
- Data-Driven Framework - Data-driven is a test automation framework which stores test data in a table or spread spreadsheet format.
- Keyword-Driven Framework - A keyword-driven framework is a table-driven testing or action word based testing. This is used to speed up automated testing by utilizing the keywords for a common set of actions.
- Hybrid Testing Framework - Hybrid Driven Framework is a combination of both the Data-Driven and Keyword-Driven framework. ... Keywords are maintained in a separate Java class file and test data can be maintained either in a properties file/excel file
3. What is the principle difference between a Data-driven
framework and a Keyword Driven Framework?
Answer: In data driven testing, we can run our tests on multiple data in multiple combinations with the help of parameterization. Here the data is treated as an input to the test script logic. Each data set can be treated as a separate test case.
In keyword driven testing, the keywords that are developed represent an action. A list of keywords maintained in sequence form a test case. Thus a keyword once developed can be used in multiple test scripts.
4. What are the advantages of Automation Framework?
Answer: Utilizing a framework for automated testing will increase a team’s test speed and efficiency, improve test accuracy, and will reduce test maintenance costs as well as lower risks. They are essential to an efficient automated testing process for a few key reasons:
- Improved test efficiency
- Lower maintenance costs
- Minimal manual intervention
- Maximum test coverage
- Re usability of code
5. What are the different components of your framework
and explain each?
Answer: Please refer below article to understand about
different component in a framework
https://www.automationtestinginsider.com/2020/02/selenium-data-driven-framework-with-pom.html
6. While explaining the framework, what are points which
should be covered?
Answer: This question answered in detail on
question#8
7. How do you decide a particular framework for a
project?
Answer: To help determine which framework is right for your organization, ask yourself the following helpful questions:
- Consider the application and the technology involved.
- Think about testing requirements.
- Determine license cost of the tool.
- Evaluate the skill sets available within your organization.
8. Can you explain the Selenium Framework which you have
used in your project?
Answer: When we give any answer in the interview the one and only important thing we need to keep in mind is It should be brief and to the point so that interviewer should not lose interest from our answer.
So whenever we need to give answer about framework we can divide framework in terms of different components which we are using to build a structure which we called a framework and which we use in our company
We can start like mentioned below.
1. We are using Page Object with Page Factory framework with functional/structural implementation.
Make sure you know what functional/structural implementation in this framework.
2. We are using standardized maven project for build, execution & dependency management.
Make sure you know about a build tool like ant/maven
3. Language and IDE: We are using JAVA/Ruby as our binding language and eclipse as IDE. We use java because it is known to most people when we started automation.
4. Action Driver - We also have library package to maintain common functions related to All action method/Selenium/waits/directory creations etc
5. We also have a base page class for common functions use by all pages – to load config.properties file and Web Driver initialization.
Make sure you know why we have Base Page class in page object
5. We have maintained a page class for every page in our application and a page test class to maintain test for that pages. E.g. Product listing page, Add to cart page, Payment page, Invoice generation page.
Make sure you know we maintain different page and all different annotations in page factory
Page Objects Package- com.mystore.pageobjects
Page Class – AddToCart.java
6. We have maintained separate package for page test e.g.
Test Package - com.mystore.testcases
Test Class – AddToCartTest.java
Note: Maintaining different packages is always a good practice to follow.
7. Utility component - Extent Class, Log4j class, Listeners, Data Providers
Package Name: com.mystore.utility
8. For handling data driven cases we are passing data using xlsx file/xls file /csv file.
>> Make sure you know about libraries like openCSV,JXL/APACHE POI/Java Properties class
9. For ordering tests we are using testng framework.
Make sure you know how to use different annotations and run testng.xml using maven
10. We are using log4j library to maintain logging of our project. We are using all kinds of logging statements like INFO, DEBUG, and ERROR etc. We have maintained a separate class for it in com.mystore.utility package
>> Make sure you know this library usage in java, we can use log4j by mentioning properties of this framework in a xml file or a properties file and putting that file on build path.
11. We are using Extent Report for reporting purpose. It is a third party report and it is easily available at maven central repo.
We are using maven postman plugin / JAVA API to send generated extent reports as an attachment to client Distribution list.
>> Make sure you know about this plugin of maven or Java API
12. We check in our code into client repository using a version controlling tool git bash on windows system.
13. CI tool - We have integrated our project with CI tool i.e. Jenkins to run the build automatically.
Summary: - We should talk about all major components in our project like Logging, Emailing, Page Objects, Page Factory Annotations, TestNG, Exception Handling, Build tool, Version controlling tool, DataDriven usage etc.
10. How you build object repository in your project
framework?
Answer: page object model using page factory
11. What is Test Driven Development (TDD) Framework?
Answer: Test-Driven Development is a testing methodology or a programming practice implemented from a developer’s perspective. In this technique, a QA engineer starts designing and writing test cases for every small functionality of an application. The purpose of TDD is to make the code clearer, simple and bug-free.
TDD instructs developers to write new code only if an automated test has failed. This avoids duplication of code. The full form of TDD is Test-driven development.
The simple concept of TDD is to write and correct the failed tests before writing new code (before development). This helps to avoid duplication of code as we write a small amount of code at a time in order to pass tests. (Tests are nothing but requirement conditions that we need to test to fulfill them).
![]() |
TDD Cycle |
12. What is Behavior Driven Development (BDD) Framework?
Answer: Behavior -Driven Development (BDD) is a testing approach derived from the Test-Driven Development (TDD) methodology. In BDD, tests are mainly based on systems behavior. This approach defines various ways to develop a feature based on its behavior. In most cases, the Given-When-Then approach is used for writing test cases. Let’s take an example for better understanding:
- Given the user has entered valid login credentials
- When a user clicks on the login button
- Then display the successful validation message
The simple language used in the scenarios helps even non-technical team members to understand what is going on in the software project. This helps and improves communication among technical and non-technical teams, managers, and stakeholders.
Behavior Driven Development (BDD) framework is a software development process that is an offshoot of Test Driven Development (TDD) framework. BDD is an agile testing methodology. It is the process of development, based on test-driven development and domain-driven.
13. What are the main traits of a good Software Test
Automation framework?
Answer: Below are some of the key parameters that a software tester needs to keep in mind, while developing a test automation framework.
- Handle scripts and data separately.
- Create libraries.
- Follow coding standards.
- Offer high extensibility.
- Less maintenance
- Script/Framework version control
Tips:
- Proper knowledge of Programming language concept
- Write page classes for all the pages
- Test Classes may be differ based on the requirements
- Write validations (Assertions) in the test class only
- Write the user actions In Page class only
- Use proper waiting mechanism in page class (user actions) only
- Usage of proper Naming convention
- Always add the comments when you create new class
- All test cases should be independent as possible
14. Where you have applied OOPS in Automation Framework?
Answer: Please refer below YouTube video
https://www.youtube.com/watch?v=v0Yz8mXQA18&list=PLsGOlyTzNH6dQREgTsqPy6C79wWyouEcu&index=10
15. How do you accommodate project specific method in
your framework?
Answer: 1st go through all the manual test cases and
identify the steps which are repeating. Note down such steps and make them as
methods and write into ProjectSpecificLibrary.
16. Where you encounter synchronization in your project?
Answer: Synchronization is a mechanism which involves two or more components working parallel with each other. Usually, in test automation, there will be two components such as application under test and the test automation tool. Both of them will have specified speeds and the test scripts should be written in a way such that both these components will work with same speed. This will help to avoid “Element Not Found” error which otherwise will consume more time to clear off.
https://www.automationtestinginsider.com/2020/02/waits-in-selenium-webdriver.html
17. Which Test Automation Framework you are using and
why?
Answer: Please refer question#8
18. Mention the name of the Framework which you are using
currently in your project, explain it in details along with its benefits?
Answer: Please
refer question#8
19. Mention the name of the Framework which you have
hands on experience?
Answer: Please
refer question#8
20. Can you explain the Selenium framework which you have
used in your project?
Answer: Please refer question#8
21. Where did you implement hashmap concept in framework
Answer: Please refer below YouTube video
https://www.youtube.com/watch?v=KAYzkFKlGaQ&list=PLsGOlyTzNH6dQREgTsqPy6C79wWyouEcu&index=9
Project github link: https://github.com/hverma22/MyProject.git
22. Why we are using constructor in framework
Answer: To initialize the page objects in page class
24. Where to use abstract class in framework
Answer: Please refer below YouTube video
https://www.youtube.com/watch?v=v0Yz8mXQA18&list=PLsGOlyTzNH6dQREgTsqPy6C79wWyouEcu&index=10
25. Which files can be used as data source for different
frameworks?
Answer: Some of the file types of the dataset can be:
Excel xml, text, csv, etc.
26. How can I read test data from Excel files?
Answer: Please
refer below YouTube video
https://www.youtube.com/watch?v=isEQPMuB4YU&list=PLsGOlyTzNH6dhM1NCjkbfMTXg-hXnjeqd
27. What is the difference between POI and JXL Jars?
Answer: Difference
between JXL and POI is that Java JXL does not support the Excel 2007+ ". xlsx"
format; it only supports ". xls" format. Apache POI supports both
with a common design.
28. What is Page Object Model (POM) and its advantages?
Answer: Page Object Model
Page Object Model is a design pattern to create Object Repository for web UI elements. Under this model, for each web page in the application, there should be corresponding page class. This Page class will find the Web Elements of that web page and also contains Page methods which perform operations on those Web Elements.
Advantages
- Object Repository: You can create an Object Repository of the fields segmented page-wise. This as a result provides a Page Repository of the application as well. Each page will be defined as a java class.
- Functional Encapsulation: All possible functionality or operations that can be performed on a page can be defined and contained within the same class created for each page. This allows for clear definition and scope of each page's functionality.
- Low maintenance: Any User Interface changes can swiftly be implemented into the interface as well as class.
- Programmer Friendly: Robust and more readable. The Object-oriented approach makes the framework programmer friendly.
- Low Redundancy: Helps reduce duplication of code. If the architecture is correctly and sufficiently defined, the POM gets more done in less code.
- Efficient & Scalable: Faster than other keyword-driven/data-driven approaches where Excel sheets are to be read/written.
29. What is Page Factory?
Answer: Page Factory is a class provided by Selenium
WebDriver to support Page Object Design patterns. In Page Factory, testers use
@FindBy annotation. The initElements method is used to initialize web elements.
@FindBy: An annotation used in Page Factory to locate and declare web elements
using different locators.
30. What is the difference between Page Object Model and
Page Factory?
Answer: Page Object Model (POM) and Page Factory have following differences:
A Page Object Model is a test design pattern which says organizes page objects as per pages in such a way that scripts and page objects can be differentiated easily. A Page Factory is one way of implementing PageObject Model which is inbuilt in selenium.
- In POM, you define locators using ‘By’ while in Page Factory, you use FindBy annotation to define page objects.
- Page Object Model is a design approach while PageFactory is a class which provides implementation of Page Object Model design approach.
- POM is not optimal as it does not provide lazy initialization while Page Factory provides lazy initialization.
- Plain POM will not help in StaleElementReferecneException while Page Factory takes care of this exception by relocating web element every time whenever it is used.
- In plain page object model, you need to initialize every page object individually otherwise you will encounter NullPointerException while In PageFactory all page objects are initialized (Lazily) by using initElements() method.
31. What are the advantages of Page Object Model?
Answer: Covered in question#28
32. In POM how to pass value from 1 page to another page?
Answer: Passing another page object:
Try to initiate the page objects in your test and use it from there. To do that just don't return the DashboardPage object from the submit method.
33. Explain what is a data driven framework?
Answer: Data-driven is a test automation framework which stores test data in a table or spreadsheet format. This allows automation engineers to have a single test script which can execute tests for all the test data in the table.
Why Data Driven Testing?
Look at the following Example:
We want to test the login system with multiple input fields with 1000 different data sets.
To test this, you can take following different approaches:
Approach 1) Create 1000 scripts one for each data-set and runs each test separately one by one.
Approach 2) manually change the value in the test script and run it several times.
Approach 3) Import the data from the excel sheet. Fetch test data from excel rows one by one and execute the script.
In the given three scenarios first two are laborious and time-consuming. Therefore, it is ideal to follow the third approach. Thus, the third approach is nothing but a Data-Driven framework.
34. Explain what is a keyword driven framework?
Answer: In keyword driven testing, the keywords that are developed represent an action. A list of keywords maintained in sequence form a test case. Thus a keyword once developed can be used in multiple test scripts.
35. How can you prepare customized HTML report using
TestNG in hybrid framework?
Answer: Please refer question#12 from below link
https://www.automationtestinginsider.com/2019/10/selenium-questions-part7-testng.html
36. How can you generate HTML report from your test
scripts?
37. Write the code for Reading and Writing to Excel
through Selenium?
Answer: Please refer below YouTube video
https://www.youtube.com/watch?v=isEQPMuB4YU&list=PLsGOlyTzNH6dhM1NCjkbfMTXg-hXnjeqd
38. How do you use Map Collections in your Selenium
Project (Give some examples) ?
Answer: Please refer below YouTube video
https://www.youtube.com/watch?v=KAYzkFKlGaQ&list=PLsGOlyTzNH6dQREgTsqPy6C79wWyouEcu&index=9
39. How
do you read and write into a PDF file?
40. What is the folder structure of your framework and
explain each folder?
Answer: Please refer below YouTube video
https://www.youtube.com/watch?v=iFEoctz-wy4&list=PLsGOlyTzNH6dQREgTsqPy6C79wWyouEcu&index=1
41. What do you use for reporting in your Selenium
Project?
Answer: Please refer below YouTube video
https://www.youtube.com/watch?v=eYVirg_ZuJk&list=PLsGOlyTzNH6dQREgTsqPy6C79wWyouEcu&index=7
42. What is a Data Provider and what is its return type?
Answer: Data provider returns a two-dimensional JAVA
object to the test method and the test method, will invoke M times in a M*N
type of object array. For example, if the DataProvider returns an array of 2*3
objects, the corresponding testcase will be invoked 2 times with 3 parameters
each time.
43. How to create the reusable methods for reading the
data from the Excel files?
Answer: Refer Complete excel library
44. How to create the reusable methods for reading the
data from the XML files?
45. What is an interface and where you have used in your
Framework?
Answer: Please refer below YouTube video
https://www.youtube.com/watch?v=v0Yz8mXQA18&list=PLsGOlyTzNH6dQREgTsqPy6C79wWyouEcu&index=10
46. Draw the architecture of a framework implementing
Page Object Model and its uses?
Answer: Please refer below YouTube video
https://www.youtube.com/watch?v=iFEoctz-wy4&list=PLsGOlyTzNH6dQREgTsqPy6C79wWyouEcu&index=1
47. Why do we go for Page Object Model (POM) and what is
its purpose?
Answer: POM is a design pattern which is commonly used in Selenium for Automating the Test Cases. The Page object is an object-oriented class which acts as an interface for the page of your Application under test. Page class contains web elements and methods to interact with web elements.
48. What have you done to improve the performance of
selenium framework?
Or How to Make Selenium WebDriver Scripts Faster
Answer: There are multiple things that can improve the
Selenium WebDriver scripts speed:
- use fast selectors
- use fewer locators
- create atomic tests
- dont test the same functionality twice
- write good tests
- use only explicit waits
- use the chrome driver
- use drivers for headless browsers
- re-use the browser instance
- run scripts in parallel
- use HTTP parse libraries
- pre-populate cookies
- do not load images in the web page
49. We have heard about frameworks well it can be broadly
classified into these TDD, BDD and ATDD frameworks .What’s the Difference?
Answer: Few, Differences between TDD BDD and ATDD
- TDD is a development technique that focuses more on the implementation of a feature.
- BDD focuses on the behavioral aspect of the system rather unlike the TDD focuses on the implementation aspect of the system.
- Acceptance Test-Driven Development is very similar to Behavioral-Driven Development. However, a key difference between them is: BDD focuses more on the behavior of the feature, whereas ATDD focuses on capturing the accurate requirements.
50. What is the difference between data driven and
modular frameworks?
Answer: Modular: In modular frameworks, the application can be divided into different modules which can be tested independently. Data-Driven Framework: In data-driven frameworks, test data is separated from test scripts and stored in an external resource such as text file, excel spreadsheet, CSV file or database table.
Please refer below YouTube video:
Selenium Questions Part10: Jenkins
1. What is CI?
Answer: What is
Continuous Integration?
Continuous Integration is a development practice in which the developers are required to commit changes to the source code in a shared repository several times a day or more frequently. Every commit made in the repository is then built. This allows the teams to detect the problems early. Continuous Integration is the most important part of DevOps that is used to integrate various DevOps stages. Jenkins is the most famous Continuous Integration tool.
Continuous Integration comprises of:
- Development and Compilation
- Database Integration
- Unit Testing
- Production Deployment
- Code Labeling
- Functional Testing
- Generating and Analyzing Reports
Below is the list of few popular Continuous Integration
tools:
- Jenkins
- TeamCity
- Travis CI
- Go CD
- Bamboo
- GitLab CI
- CircleCI
- Codeship
Continuous Integration: CI or Continuous Integration is an engineering practice in which members of a development team integrate their code at a very high frequency. Teams implementing CI aim to integrate code daily or, in some cases, even hourly.
Continuous Delivery: CD or Continuous Delivery is the practice of ensuring that code is always in a deployable state. This means that all changes to code – new features, bug fixes, experiments, configuration changes – are always ready for deployment to a production environment.
Continuous Deployment: CD can also mean Continuous Deployment – a practice in which all changes are automatically deployed into production. Unlike Continuous Delivery, there is no final manual approval step before releasing into production.
2. What is Jenkins?
Answer: Jenkins is an open source automation tool written in Java with plugins built for Continuous Integration purpose. Jenkins is used to build and test your software projects continuously making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. It also allows you to continuously deliver your software by integrating with a large number of testing and deployment technologies. Jenkins integrates development life-cycle processes of all kinds, including build, document, test, package, stage, deploy, static analysis and much more. Jenkins achieves Continuous Integration with the help of plugins. Plugins allows the integration of Various DevOps stages. If you want to integrate a particular tool, you need to install the plugins for that tool. For example: Git, Maven, HTML publisher etc.
Advantages:
Advantages of Jenkins include:
- It is an open source tool with great community support.
- It is easy to install.
- It has 1000+ plugins to ease your work. If a plugin does not exist, you can code it and share with the community.
- It is built with Java and hence, it is portable to all the major platforms.
3. What
is a Jenkins Pipeline?
Answer: Jenkins Pipeline (or simply “Pipeline”) is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins.
4. What
is Groovy in Jenkins?
Answer: Groovy is the default scripting language that is being used in the development of JMeter Version 3.1. Currently Apache Groovy is the dynamic object-oriented programming language that is used as a scripting language for the Java platform. Apache Groovy comes with some useful features such as Java Compatibility and Development Support.
5. Diff between maven, Jenkins, ant
Answer: Maven is a build tool, in short a successor
of ant. It helps in build and version control. However Jenkins is continuous
integration system, where in maven is used for build. Jenkins can be used to automate
the deployment process.
6. Which SCM tools Jenkins supports?
Answer: below are the Source code management tools supported by Jenkins:
- AccuRev
- CVS
- Subversion
- Git
- Mercurial
- Perforce
- Clearcase
- RTC
7. What is the relation between husdon and Jenkins?
Answer: There is no such difference between Hudson and Jenkins. Jenkins is actually the renamed version of Hudson
Jenkins was forked from Hudson when Sun was acquired by Oracle who aimed to develop a commercial version of the software. Since the fork, Jenkins has grown to be much more than a CI solution.
8. How to make sure that your project builds doesn’t
break in Jenkins?
Answer: To make sure Jenkins build isn't broken in the slightest degree we need to make sure that we tend to perform a successful clean install on the local machine with all unit tests.
Then make sure that all code changes are checked in without any issues.
Then synchronize with a repository to make sure that all needed config and changes and any variations are checked into the repository.
9. How to move or copy Jenkins from one server to another
Answer:
1. Copy all the files in your JENKINS_HOME directory over to the new server.
2. Point JENKINS_HOME on the new server at the new directory.
3. Copy the Jenkins war file (or your servlet container setup if you have one) over to the new machine and start it up.
All Jenkins settings, jobs, plugins, config, etc. live in JENKINS_HOME.
You just need a copy of it to start it elsewhere.
10. How can we create a backup and copy files in Jenkins?
Answer: to create a backup all you need to do is to periodically back up your JENKINS_HOME directory.
This contains all of your build jobs configurations, your slave node configurations, and your build history.
To create a back-up of your Jenkins setup, just copy this directory. You can also copy a job directory to clone or replicate a job or rename the directory.
You can create a cron job to do so.
Or you can use “Thin Backup” plugin in Jenkins.
11. How can you clone a git repo via Jenkins?
Answer: To create a clone repository via Jenkins you need to use your login credentials in the Jenkins System. To achieve the same you need to enter the Jenkins job directory and execute the git config command.
12. How to run smoke and sanity using Jenkins?
Answer: Please
refer below YouTube video
https://www.youtube.com/watch?v=KG47Y8uUtVI&list=PLsGOlyTzNH6f6azWCMyTpW11F-3gyDYxV&index=2
13. How to reset Jenkins username and password
Answer: To reset the jenkins admin password, You can simply disable the security in the config.xml file.
1. If your jenkins is running on the Linux OS, edit the below file.
vi /var/lib/jenkins/config.xml file.
2. Search for the word <useSecurity>true</useSecurity>
and change the word true to false.
3. Restart the Jenkins server.
service jenkins restart
4. Now go to the Jenkins portal again and Jenkins will not ask any credentials this time. You navigate to "Manage Jenkins" to set the administrator password again.
5. Enable the security again by changing settings to <useSecurity>true</useSecurity> and restart the Jenkins again.
Note:
If your jenkins is running on Windows OS, config.xml file located in C:\Program Files (x86)\Jenkis\ folder.
14. How do you setup Maven Project in Jenkins?
Answer: Please refer below link and videos –
https://www.automationtestinginsider.com/2020/06/selenium-integration-with-jenkins-part-a.html
15. How do you start Jenkins?
Answer: To start Jenkins from command line
Open command prompt.
Go to the directory where your war file is placed and run the following command: java -jar jenkins.war
16. How to create a job in Jenkins?
Answer: Few of
the steps given below
Step 1 − Go to the Jenkins dashboard and Click on New Item.
Step 2 − in the next screen, enter the Item name, in this case we have named it Helloworld.
Step 3 − the following screen will come up in which you can specify the details of the job.
Step 4 − we need to specify the location of files which need to be built.
17. What are the basic plugins you used in Jenkins?
Answer:
Maven Integration - This plug-in provides, for better and for worse, a deep integration of Jenkins and Maven.
Git plugin - This plugin integrates Git with Jenkins.
TestNG Results Plugin - This plugin integrates TestNG test reports to Jenkins.
HTML Publisher plugin - This plugin publishes HTML reports.
Email Extension - This plugin is a replacement for Jenkins's email publisher. It allows to configure every aspect of email notifications: when an email is sent, who should receive it and what the email says.
Email Extension Template Plugin - This plugin allows administrators to create global templates for the Extended Email Publisher.
External Monitor Job Type Plugin - Adds the ability to monitor the result of externally executed jobs
Green Balls- Because green is better than blue! For color blind support configure user property.
18. On which platform JENKINS will work?
Answer: It is built with Java and hence, it is portable to all the major platforms.
19. Mention what are the commands you can use to start
Jenkins manually?
Answer: To start Jenkins manually, you can use either of the following
(Jenkins_url)/restart: Forces a restart without waiting for builds to complete
(Jenkin_url)/safeRestart: Allows all running builds to complete
20. Mention what are the two components Jenkins is mainly
integrated with?
Answer: Jenkins is mainly integrated with two components
- Version Control system like GIT, SVN
- And build tools like Apache Maven.
21. What are Triggers?
Answer: Trigger in Jenkins defines the way in which
the pipeline should be executed frequently. PollSCM, Cron, etc are the
currently available Triggers.
Please refer below YouTube video to understand the explanation of above Q/A
Selenium Questions Part9: Git and Github
1. What
is Git? What is the difference between Git and GitHub?
Answer: Git
is a version control system that lets you manage and keep track of your source
code history. GitHub is a cloud-based hosting service that lets you manage Git
repositories. If you have open-source projects that use Git, then GitHub is
designed to help you better manage them.
2. What
is the advantage of using GitHub for Selenium?
Answer: GitHub is a cloud-based hosting service that lets you manage Git repositories; it helps to have a backup code in case of physical failures.
- github supports branching, so we can have multiple versions of code.
- github supports project cloning, so it helps in easily distribution of project across multiple teams and multiple locations
- github supports code pull so anyone with access rights can pull code in local machine. This can also be integrated with jenkins.
- github supports code push so anyone with access rights can checkin code in github central repository.
3. How to
handle git conflicts?
Answer: Git can handle on its own most merges by using its automatic merging features. There arises a conflict when two separate branches have made edits to the same line in a file, or when a file has been deleted in one branch but edited in the other. Conflicts are most likely to happen when working in a team environment.
- Identify the files that have caused the conflict.
- Make the necessary changes in the files so that conflict does not arise again.
- Add these files by the command git add.
- Finally to commit the changed file using the command git commit
Please refer
below YouTube video link
https://www.youtube.com/watch?v=CQqdTDBlopg&feature=youtu.be
4. Explain
different Git commands?
Answer: Below are the most git commands
1. Initialize a repo
Create an empty git repo or re-initialize an existing one
$ git init [repository path]
2. git remote add [variable name] [Remote Server Link]
This command is used to connect your local repository to the remote server.
Example:
git remote add origin https://github.com/hverma22/Test5
3. git clone
This command is used to obtain a repository from an existing URL.
git clone [url]
Example: navigate to your repo path where you want to clone and write below command in cmd
git clone https://github.com/hverma22/Test2
4. How to Create a New Branch in Git
To create a new branch use:
$ git checkout -b <new_branch_name>
5. How to List Branches in Git
$ git branch
Example output:
develop
my_feature
master
6. git log
git log
This command is used to list the version history for the current branch.
Example:
git log --oneline
7. git merge
git merge [branch name]
This command merges the specified branch’s history into the current branch.
8. How to Switch Branches in Git
When you create a new branch then Git automatically switches to the new branch.
If you have multiple branches, then you can easily switch between branches with git checkout:
$ git checkout master
$ git checkout develop
$ git checkout my_feature
You can get the specific previous version as well.
Command: git checkout <ChangeID> <filePath with extenion>
Example:
git checkout 6475fgh5 pom.xml
9. How to Delete Branches in Git
To delete a local branch:
$ git branch -d <local_branch>
To delete a remote branch on origin:
$ git push origin :<remote_branch>
10. Git Stage Files
To stage or simply add files, you need to use git add command. You can stage individual files:
$ git add foo.js
or all files at once:
$ git add .
11. git diff
This command shows the file differences which are not yet staged.
Example:
git diff –-staged
git diff [first branch] [second branch]
12.Git Unstage Changes
If you want to remove a certain file from the stage:
$ git reset HEAD foo.js
Or remove all staged files:
$ git reset HEAD .
13. Git Status
If you want to see what files have been created, modified or deleted, Git status will show you a report.
$ git status
14. git rm
This command deletes the file from your working directory and stages the deletion.
git rm [file]
15.git commit
git commit -m “[commit message]”
This command records or snapshots the file permanently in the version history.
Example:
git commit -m “First Commit”
16. git show
git show [commit]
This command shows the metadata and content changes of the specified commit.
Command: git show <ChangeID>:<FilePath>
Example:
git show 45dhfg56:/src/test/newtest.xml
17. Undoing Commits
The following command will undo your most recent commit and put those changes back into staging, so you don’t lose any work:
$ git reset --soft HEAD~1
To completely delete the commit and throw away any changes use:
$ git reset --hard HEAD~1
18. git push - After you have committed your changes, next is to push to a remote repository.
git push [variable name] master
This command sends the committed changes of master branch to your remote repository.
Example:
Push a local branch for the first time:
git push origin master
git push origin master --force
After that, then you can just use
$ git push
19. To push a local branch to a different remote branch, you can use:
$ git push origin <local_branch>:<remote_branch>
20. Undo Last Push
If you have to undo your last push, you can use:
$ git reset --hard HEAD~1 && git push -f origin master
21.git config
This command sets the author name and email address respectively to be used with your commits.
git config –global user.name “[name]”
git config –global user.email “[email address]”
Example:
git config user.name "Hitendra Kuamar Verma"
git config user.email "Hitendra@Hitendra-PC"
22. git pull
git pull [Repository Link]
This command fetches and merges changes on the remote server to your working directory.
Example:
git pull https://github.com/hverma22/Test2.git
5. What
is the version control tool you are using and tell me the steps what you follow
and how will you resolve conflicts?
Answer: Please
refer below YouTube video link
https://www.youtube.com/watch?v=CQqdTDBlopg&feature=youtu.be
6. What
is the difference between SVN & GIT?
Answer: Below are the differences -
- Git is a distributed VCS; SVN is a non-distributed VCS.
- Git uses multiple repositories including a centralized repository and server, as well as some local repositories; SVN is a centralized version control system.
- The content in Git is stored as metadata; SVN stores files of content.
- Git branches are easier to work with than SVN branches.
- Git does not have the global revision number feature like SVN has.
- Git has better content protection than SVN.
- Git was developed for Linux kernel by Linus Torvalds; SVN was developed by CollabNet, Inc.
- Git belongs to the 3rd generation of Version Control tools; SVN belongs to the 2nd generation of Version Control tools
7. How do
you maintain source code in GIT?
Answer:
Please refer below link –
https://www.automationtestinginsider.com/2020/06/selenium-integration-with-git-and-github.html
8. Suppose
there are 10 classes & I want to push only 5 classes, how do you do that?
Answer: Normally we commit to git, all files are going to git but in your scenario push only single file git. For this, you have to run specific command to push the only single file to git.
$ git commit -m "Message goes here" filename
Example
to push to single file to git
$ git commit -m "Pushing Only Single file to git" config/file1.txt
Let’s take look how to push one or two or three files to git in a single commit.
$ git commit -m "Message goes here" file1 file2 file3
Example
to push to three files to git
$ git commit -m "Pushing Only three files to git" config/file1.txt config/file2.txt config/file3.txt
9. Mention
the various Git repository hosting functions.
Answer:
- Github
- Gitlab
- Bitbucket
- SourceForge
- GitEnterprise
10. In
Git how do you revert a commit that has already been pushed and made public?
Answer: There can be two approaches to tackle this question and make sure that you include both because any of the below options can be used depending on the situation:
Remove or fix the bad file in a new commit and then push it to the remote repository. This is the most obvious way to fix an error. Once you have made necessary changes to the file, then commit it to the remote repository using the command: git commit -m “commit message”
Also, you can create a new commit that undoes all changes that were made in the bad commit. To do this use the command
git revert <name of bad commit>
11. What
is the difference between git pull and git fetch?
Answer: Git pull command pulls new changes or commits from a particular branch from your central repository and updates your target branch in your local repository.
Git fetch is also used for the same purpose but it works in a slightly different way. When you perform a git fetch, it pulls all new commits from the desired branch and stores it in a new branch in your local repository. If you want to reflect these changes in your target branch, git fetch must be followed with a git merge. Your target branch will only be updated after merging the target branch and fetched branch. Just to make it easy for you, remember the equation below:
Git pull = git fetch + git merge
12. What
is git stash?
Answer: Often, when you’ve been working on part of your project, things are in a messy state and you want to switch branches for some time to work on something else. The problem is, you don’t want to do a commit of half-done work just so you can get back to this point later. The answer to this issue is Git stash.
Stashing takes your working directory that is, your modified tracked files and staged changes and saves it on a stack of unfinished changes that you can reapply at any time.
$ git status
modified: index.php
modified: css/styles.css
Apply Git Stash
$ git stash
Saved working directory and index state WIP on master:
2dfe283 Implement the new login box
HEAD is now at 2dfe283 Implement the new login box
Git's Stash is meant as a temporary storage. When you're ready to continue where you left off, you can restore the saved state easily:
$ git stash pop
13. What
is the function of ‘git stash apply’?
Answer: If you want to continue working where you had left your work then ‘git stash apply‘command is used to bring back the saved changes onto your current working directory.
git stash apply n
To get list of stashes:
git stash list
14. What
is the function of ‘git config’?
Answer: Git uses your username to associate commits with an identity. The git config command can be used to change your Git configuration, including your username.
Now explain with an example.
Suppose you want to give a username and email id to associate a commit with an identity so that you can know who has made a particular commit. For that I will use:
git config –global user.name “Your Name”: This command will add a username.
git config –global user.email “Your E-mail Address”: This command will add an email id.
15. How
will you know in Git if a branch has already been merged into master?
Answer: To know if a branch has been merged into master or not you can use the below commands:
git branch --merged – It lists the branches that have been merged into the current branch.
git branch --no-merged – It lists the branches that have not been merged.
16. Can
you explain the Gitflow workflow?
Answer: To record the history of the project, Gitflow workflow employs two parallel long-running branches – master and develop:
Master – this branch is always ready to be released on LIVE, with everything fully tested and approved (production-ready).
Hotfix – these branches are used to quickly patch production releases. These branches are a lot like release branches and feature branches except they’re based on master instead of develop.
Develop – this is the branch to which all feature branches are merged and where all tests are performed. Only when everything’s been thoroughly checked and fixed it can be merged to the master.
Feature – each new feature should reside in its own branch, which can be pushed to the develop branch as their parent one.
Please refer below YouTube video to understand the explanation of above Q/A
Please refer below Git and Github Playlist here:
Selenium Questions Part8: Maven
- 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 distributed 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.
- clean: deletes all artifacts and targets which are created already.
- compile: used to compile the source code of the project.
- test: test the compiled code and these tests do not require to be packaged or deployed.
- package: package is used to convert your project into a jar or war etc.
- install: install the package into the local repository for use of another project.
- Better dependency management
- More powerful builds
- Better debugging
- Better collaboration
- More componentized builds
- Reduced duplication
- More consistent project structure
- Better dependency management
- More powerful builds
- Better debugging
- Better collaboration
- More componentized builds
- Reduced duplication
- More consistent project structure
- create jar file
- create war file
- compile code files
- unit testing of code
- create project documentation
- create project reports
- clean-clean up after build.
- compiler-compiles java source code.
- deploy-deploys the artifact to the remote repository.
- failsafe-runs the JUnit integration tests in an isolated classloader.
- install-installs the built artifact into the local repository.
- resources-copies the resources to the output directory for including in the JAR.
- site-generates a site for the current project.
- surefire-runs the JUnit unit tests in an isolated classloader.
- verifier-verifies the existence of certain conditions. It is useful for integration tests.
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MyStoreProject</groupId>
<artifactId>MyStoreProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.0.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${xmlFiles}</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<appURL>${url}</appURL>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
- Windows: C:\Users\<User_Name>\.m2
- Linux: /home/<User_Name>/.m2
- Mac: /Users/<user_name>/.m2
- And of course, for both on Linux or Mac:
- Linux/Mac: ~/.m2