Pages

Thursday, 30 December 2021

Top 20 Jenkins Interview Questions and Answers 2022 for SDET - DevOps - Automation QA? Refer for Getting pro in Jenkins.

 


Below are the common interview q&a : Jenkins interview questions for devops and Jenkins interview questions for testers. Jenkins is the most use ci cd tool, so if you are preaparing ci cd pipeline interview questions and answer do refer the post.

11. What are the two major components which are integrated with Jenkins?

Ans: Below are the two major components:
         - Build tools like Maven script.
         - Version control system or source code repository like Git repository.

Pipeline Script Fundamentals

12. Can you write a pipeline script where you can call your Maven with 
automation suite?
node {
stage ('SCM checkout'){
git "https://gitlab.com/mbabilo/experitest"
}
stage ('Build'){
dir("comtest") {
sh "mvn clean install"
}
dir("comtest/target") {
sh "java -jar com.test-1.0-SNAPSHOT.jar"
}
}
}

13. How to control the flow in Jenkins?

Ans: Jenkins flow can be controlled using Stage, Lock and Milestone.

  • stage - the stage step remains but is now focused on grouping steps and providing boundaries for Pipeline segments.

  • lock - the lock step throttles the number of concurrent builds in a defined section of the Pipeline.

  • milestone - the milestone step automatically discards builds that will finish out of order and become stale.

14. How to create parameterized jobs in Jenkins? VERY IMP

15. How to resolve the invalid service logon credentials in windows?

Ans: When installing a service to run under a domain user account, the account must have the right to logon as a service. This logon permission applies strictly to the local computer and must be granted in the Local Security Policy.

Perform the following steps below to edit the Local Security Policy of the computer you want to define the ‘logon as a service’ permission:

  1. Logon to the computer with administrative privileges.

  2. Open the Administrative Tools and open the Local Security Policy

  3. Expand Local Policy and click on User Rights Assignment

  4. In the right pane, right-click Log on as a service and select properties.

  5. Click on the Add User or Group… button to add the new user.

  6. In the Select Users or Groups dialogue, find the user you wish to enter and click OK

  7. Click OK in the Log on as a service Properties to save changes.

After completing the steps above, try logging in again with the added user.


16. How to send email notification in Jenkins using groovy script? VERY IMP

ANS: Click Here For Answer with Groovy Script Steps


17.  What is the ideal memory requirements for the controller in Jenkins?
 
Ans: The amount of memory Jenkins needs is largely dependent on multiple factors, which is why the RAM allotted for it can range from 200 MB for a small installation to 70+ GB for a single and massive Jenkins controller. However, you should be able to estimate the RAM required based on your project build needs.

Each build node connection will take 2-3 threads, which equals about 2 MB or more of memory. You will also need to factor in CPU overhead for Jenkins if there are a lot of users who will be accessing the Jenkins user interface.

18. How you can Fail a build in JenkinsFile?

Ans:  By using error step from pipeline DSL we can be able to Fail a build, like : error("Build failed due to ....")

error: Error signal

Signals an error. Useful if you want to conditionally abort some part of your program. You can also just throw new Exception(), but this step will avoid printing a stack trace.

19. What is Pipeline, Node and Stage in Jenkins?

ANS: Click Here for All Pipeline Concepts and Terminology

20. How to catch error in jenkins file and set build result to failure?

Ans: By using catchError.

If the body throws an exception, mark the build as a failure, but nonetheless continue to execute the Pipeline from the statement following the catchError step. The behavior of the step when an exception is thrown can be configured to print a message, set a build result other than failure, change the stage result, or ignore certain kinds of exceptions that are used to interrupt the build.

node {
    catchError {
        sh 'might fail'
    }
    step([$class: 'Mailer', recipients: 'admin@somewhere'])
}
To explore more, please refer: catchError()
Click Here :   DevOps Related Posts

21. How to resolve out of memory error in JENKINS?

Ans: There are two types of OutOfMemoryError messages that you might encounter while a Jenkins job runs:
  • java.lang.OutOfMemoryError: Heap space – this means that you need to increase the amount of heap space allocated to Jenkins when the daemon starts.
  • java.lang.OutOfMemoryError: PermGen space – this means you need to increase the amount of generation space allocated to store Java object metadata. Increasing the value of the -Xmx parameter will have no affect on this error.

On Ubuntu 12.04 LTS, uncomment the JAVA_ARGS setting on line ten of /etc/default/jenkins:

  • To add more Java heap space, increase the value of the -Xmx Java parameter. That sets the maximum size of the memory allocation pool (the garbage collected heap).
  • To add more PermGen space, add the parameter XX:MaxPermSize=512m (replace 512 with something else if you want more. The permanent generation heap holds meta information about user classes.

To learn more, please refer EXPLORE JENKINS ERROR


Suggested Post:

ALL ABOUT AUTOMATION FRAMEWORK DESIGN

Java Interview question Set-1:

SET-01 1-10

Java Interview question Set-2:

SET-02 10-20

Java Interview question Set-3:

SET-03 21-30

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions


Friday, 3 December 2021

Top 60 API Testing Interview questions and answers? Refer for concepts, revision and interview preparation?

 


Flash News:

TRAINING SESSION for API - Microservice - SDET TESTING

Training Session for API-Microservice-SDET will start soon, for demo session soon please reach out on whatsapp @ 91-9619094122. For more details refer : https://automationreinvented.blogspot.com/p/test_14.html
========================

Check below link for question and answers with code:

Top API Interview Question 1-10

 

51. How to add .pem and .key file for authorization in testing an API using Postman?

Ans: Go to Postman Settings-->Certificate and then upload .pem under crt and key under key as shown in below screenshot:

Do remember to mention the server address under the host field



52. How to convert the API request in Postman to cURL command so that we can run it in the cloud setup?

Ans: In Postman tool go to the Code snippet and from the list select cURL as shown in below screenshot:


53. If we don't have the API endpoints, then how we can fetch it from the UI?

Ans: If it's a web application, then the Network tab under Developer tools will help to capture the endpoints.

54. Let's consider a scenario where the username and password is correct but we don't have access rights for any resources or  API which we are trying to access, then what should be the expected status?

Ans: Status code should be 403-Forbidden


55. How to Create a POJO class? How to convert Json to Pojo ?


56. What do you mean by asynchronous Rest Clients?

Ans: Asynchronous clients don’t have to wait for a response to continue working. Therefore, microservices in an app can continue to process and send data, even when one of their partner services runs into issues. This capability provides more reliable service to the user and can be especially valuable in cases where service availability is low or overloaded with demand.


57. What is the use of JSON-RPC?

Ans:  JSON-RPC is a protocol similar to XML-RPC, it is a remote procedure calls (RPCs), and uses JSON instead of XML format to transfer data.  While calls may contain multiple parameters, it only expects one result.


58. How to automate POST-PUT-PATCH method in API Automation?


59. Name two commonly used architectural approaches while using APIs?

Ans: 
        - SOA-service-oriented architecture
        - Microservices architecture



60. Let's assume you have an endpoint /users/{user_id} , 
      and if we provide user id which is not present in database, 
      then which status code we expect from server?


Ans: Status Code should be 404 NOT FOUND, because the user id is not present in the database.

***********************************************

How to run selenium tests from Jenkins? Maven and Jenkins Integration with Testng-Selenium?Run selenium maven project from command line?

Click Here For Steps with Screenshot

*********************************************** 



61. How to Create API Testing positive and negative scenario's from the provided API endpoint?

Ans: Click Here For Test Scenarios On API Testing


62. Assume that you have a response body as below, if you want to fetch all the key and value of id=2 then what method you will use?


63. If the request body for POST method is missing some mandatory field, then what will be the status code?

Ans:  400 bad request because when we send a post request all the mandatory field need to be present in request body.

64. How to Create Fake-API which can be used for Testing in Postman or Rest Assured? Very Useful for real-time practice

 Ans: Steps with Screenshot to Create API from Scratch - Click Here


65. What are most used API Status Codes?

200:  OK

201:  Created

204:  No Content

400:  Bad Request

401: Unauthorized

403: Forbidden

404: Not Found

302: Redirect

405: Method Not Allowed

422: Unprocessable Entity

417: Expectation failed

500: Internal Server Error


If you like my work and want to say thank you then spread the word or buy me a coffee :)

🍵🍵🍵🍵 Buy Me A Coffee  🍵🍵🍵🍵

*******************************************************************
For any doubts or career guidance, arrange a 1:1 call with me 


********************************************************************



Check below link for question and answers with code:

Top API Interview Question 1-10

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions