Thursday, July 8, 2021

Important JavaScript Executor methods


         ********************************************************
         Important JavaScript Methods to cater selenium need
         ********************************************************




//HIGHLIGHT ELEMENT
public static void highlightElement(WebElement element, WebDriver driver){
JavascriptExecutor jex = (JavascriptExecutor) driver;
String bgcolor = element.getCssValue("backgroundColor");
for (int i =0;i<10;i++){
changeColor("rgb(0,200,0)",element,driver);
changeColor(bgcolor,element,driver);
}




//DRAWBORDER FOR AN ELEMENT
public static void drawBorder(WebElement element, WebDriver driver){
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].style.bordere3px solid red"',element);
}



//CLICK ON AN ELEMENT
public static void clickEleByJS(WebElement element, WebDriver driver){
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScriptrarguments(0).click();", element);
}




//REFRESH BROWSER
public static void refreshBrowser(WebDriver driver){
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("history.go(0)");
}




//FLASHING ELEMENT USING COLOR CHANGE LOGIC
public static void changeColor(String color, WebElement element, WebDriver driver){
JavascriptExecutor jex = (JavascriptExecutor) driver;
jex.executeScript("arguments[01.style.backgroundColor ="4-color+—, element);
try{
Thread.sleep(20);
} catch(InterruptedException e){
    }
}




//GENERATE ALERT
public static void generateAlert(WebElement element, WebDriver driver,String message){
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("alert('"+message+1");
}




//GET PAGE TITLE
public static String getTrtleByJs(WebDriver driver){
JavascriptExecutor js = (JavascriptExecutor) driver;
String Title = js.executeScript("return document.titleatoString(); return Title;)




//GET PAGE TEXT
public static String getPagelnnerTextByJs(WebDriver driver){
JavascriptExecutor js = (JavascriptExecutor) driver;
String PageText = js.executeScript("return document.documentElementinnerText;").toString();
return PageText;
}





//SCROLL PAGES
//SCROLL BY PIXEL
public static void scrollPageDown(WebDriver driver){
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScriptrwindow.scrollBy(0,600");
}




//SCROLL TO BOTTOM
public static void scrollPageDown(WebDriver driver){
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScriptcwindow.scrollTo(0,document.body.scrollheight");





//SCROLL INTO VIEW
public static void scrolllntoView(WebElement element,WebDriver driver){
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScriptc[arguments[0].scrollIntoView(true);",element);
}




//SEND KEYS
public static void scrolllntoView(WebElement element,WebDriver driver){
JavascriptExecuter executor = (JavascriptExecutor)driver;
executor.excuteScript(“document.getElementById(element).value=’new value’);
}

Wednesday, July 7, 2021

Latest top 20 API Automation Interview Questions and Answer Set 5








********************************************************************************
                                                API Important interview Questions
********************************************************************************

1 What do you understand by REST?
REST stands for Representational State Transfer. It is a web standards based architecture and take advantage of ubiquity of HTTP protocol and leverages HTTP method for data communication and to define actions.

It completely revolves around resources where every component is a resource and a resource is accessed by a common interface using HTTP standard methods.

In the architecture of REST, a REST Server provides access to resources and REST client accesses and presents the resources. Each resource in REST is identified by URIs or global IDs. It uses various representations to represent different resources like text, JSON and XML. Now a days JSON is the popular format and being commonly used in web services.


2. Explain the RESTFUL webservice?
A.2. Web services that are written by applying REST architectural concept are known as RESTFUL web services. HTTP methods are used in these services to implement the concept of REST architecture. It mainly focuses on system resources and defines how state of resource should be transported over HTTP protocol to different clients written in different language.

They usually defines a URI that provides resource representation such as JSON and set of HTTP Methods. HTTP methods like GET, POST, PUT and DELETE can be used to perform CRUD operations in RESTFUL webservices.


3. What is a Resource in REST and how to represent a Resource?
In REST architecture, every component is treated as a resource. These resources can be text files, images, videos, html pages or dynamic business data. REST Server provides access to resources and REST Client accesses and modifies those resources. Each resource in REST is identified by URIs or global IDs

Each resource in REST is identified by logical URLs or global IDs. Unlike SOAP web services, we view the product data as a resource and this resource should contain all the required information.

REST uses various representations like text, JSON and XML to represent a resource . XML and JSON are the most popular and commonly used representations of resources.


4. Mention some key characteristics of REST?
Below are some of the key characteristics of REST:
Rest is defined as stateless, hence the server has no state or no session data.
The server can be restarted between two calls as every data is passed to the server. This is possible with a well-applied REST API.
Mostly Web Services uses POST method to make operations, but REST uses GET method to access the resources.


5. What are the best practices to design a resource representation?
Below are some of the best practices that needs to be considered while designing a representation format of a resource in a RESTful web services −
Understandability: Both the Server and the Client should understand and utilize the representation format of the resource.
Completeness: The Format used should be able to represent a resource completely. It should be able to represent simple as well as complex structures of resources.
For eg., one resource can contain another resource.
Likability : One resource can have a linkage to another resource, hence a format should be able to handle such situations.


6. What are the core components of a HTTP Request?
There are 5 parts of a HTTP Request−
Verb: It indicates HTTPS methods like GET, PUT, POST, DELETE.
URI: It is Uniform Resource Identifier that is used to identify the resource on Server.
HTTP Version: It indicates the version of HTTP, for eg. HTTP v1.1
Request Header: It contains the metadata for HTTP request message like key-value pairs. For eg.: client or browser type, format supported by client, format of message body, cache settings,etc.
Request Body: It contains Message content or Resource representation.
Q.7. What are the HTTP methods that are supported by REST?


A.7. Below are the HTTP methods that are supported by REST:
GET: It is used to request a resource at the request URL. It do not contain a request body.
POST: It is used to submit information to the service for further processing. It typically returns the modified or new resource.
PUT: It is used to update the resource at the request URL.
DELETE: It is used to remove the resource at the request URL.
OPTIONS: It is used to indicate the supported techniques.
HEAD: It returns the information about the request URL.



8. What are the core components of HTTP Response?
There are 4 parts of a HTTP Response:
Status/Response Code: It indicates server status for the requested resource. For eg. Code 200 means response is ok and code 404 means resource is not found
HTTP Version: It indicates the version of HTTP, for eg. HTTP v1.1
Response Header: It contains the metadata for HTTP response message like key-value pairs. For eg.: content length, content type, response data, server type,etc.
Response Body: It contains Response Message content or Resource representation.




9. What is URI and its purpose in REST based webservices? What is the format of a URI in REST architecture?
URI stands for Uniform Resource Identifier. In REST Architecture, each resource is identified by its URI.
The main purpose of URI is to locate a resource on the server that is hosting the webservice.

The format of URI is:
<protocol>://<service-name>/<ResourceType>/<ResourceID>


10.What are the best practices to create a standard URI for a web service?
Below are the best practices that should be followed while creating a standard URI:
Use Plural Noun: We should use plural noun to define the resources. For eg., To identify users as a resource ‘users’ should be used.
Avoid using spaces: Always use underscore(_) or hyphen(-) while using long resource name. For eg. use ‘devlabs_alliance’ instead of ‘devlabs alliance’
Use Lower case letters: Use lower case letter in the URI.
Maintain backward compatibility: Since WebService is a public service, so a URI once made public should always be available. If URI gets updated, then the older URI should be redirected to new URI using HTTP status code, 300.
Use HTTP Verb: Always use HTTP verbs like GET, PUT, POST or DELETE to do any operation on the resource.



11. What is statelessness in RESTful Webservices?
Below are the advantages of statelessness in RESTFUL web services:
Each method request can be treated independently by Web services.
Web services are not required to maintain client’s previous interactions. It helps in simplifying application design.
RESTFUL Web services work seamlessly with HTTP protocol as HTTP is itself a statelessness protocol.


12. What are the advantages of statelessness in RESTFUL Webservices?
Below are the advantages of statelessness in RESTFUL web services:
Each method request can be treated independently by Web services.
Web services are not required to maintain client’s previous interactions. It helps in simplifying application design.
RESTFUL Web services work seamlessly with HTTP protocol as HTTP is itself a statelessness protocol.


13. What are the disadvantages of statelessness in RESTFUL Webservices?
Below is the major disadvantage of statelessness in RESTFUL web services:
Web services are required to get extra information in each request and then it needs to interpret that to get the client’s state, in case client interactions are to be taken care of.



14. Explain the architectural style for creating web API.
Below is the architectural style for creating web API:
HTTP is used for client server communication
XML/JSON is used as formatting language
Simple URI is used as the address for the services
Stateless communication is there


15. What is Caching in REST API?
Caching refers to a process when server stores response in client itself so that a client needs not to make server request for same resource again and again.

A server response should contain an information about how a caching is to be done. This helps a client to know whether it needs to cache some response for a period of time or caching the server response is not needed.


16. What are the best practices for caching?
Below are the best practices to be followed while caching:
Always keep the expiry date of static contents like images, css, JavaScript cacheable, to 2-3 days. Never keep a high expiry date.
Always cached the Dynamic contents just for few hours only.



17. What is JAX-RS?
 JAX-RS stands for JAVA API for RESTFUL Web Services. It is a JAVA based programming language API and specification that is used to provide support for created RESTful Webservices.

JAX-RS makes heavy use of annotations that are available from Java SE 5 to simplify development of JAVA based web services and their deployment. It also provides supports to create clients for RESTful web services.


18. List out the tools or API for developing or testing web api.
The testing tools for webservices for REST API are:
Spring REST web service using MVC
Jersey API
Axis
CFX
Restlet



19. What are the best practices to be followed while designing a secure RESTFUL web service?
Below are the best practices to be followed while designing a RESTful web service −
Validation: Ensure validation of all inputs on the server. Always protect your server from SQL injection attacks.
Session based authentication: Always use session based authentication to authenticate a user whenever a request is made to a Web Service method.
No sensitive data in URL: Never keep username, password or session token in URL , these values should always be passed to Web Service via POST method.
Restriction on Method execution: Always allow restricted use of methods like GET, POST, DELETE.
Validate Malformed XML/JSON: Always check that well formed input is passed to a web service method.
Throw generic Error Messages: A web service method should always use HTTP error messages like 403 to show access forbidden etc.





Friday, July 2, 2021

Manual QA Lead position Interview Questions and Answers SET-2





***********************************************************************************
Manual QA Lead position Interview Questions and Answers SET-2
***********************************************************************************


21. How do you provide estimations?

Best practices for providing estimations are that:
Add buffer time, so that it helps to deal with delays caused due to any unexpected reasons
Resource planning. Have balanced team with variant experience and skills
Past experience. Use the learnings from your past experience while estimating, assuming possibilities



22. What good practices you can bring in the team?

As a QA lead, there will be opportunities to put the ideas the way wanted. Few things that can be practiced within the team can be:
  • Documentation standards
  • Review standards
  • Metris
  • Recognitions
  • Teamwork and bonding
  • Continuous scope of learning

23. When is the bug in the new state, as a responsibility to open it, what factors you look into?
When the bug has to be Opened and assigned, below factors should be considered by QA Lead:
  • Is the bug valid
  • Is the bug information complete
  • Are all the fields provided correct values
  • Is the proper analysis done before logging the bug
  • Is the bug duplicate / out-of-scope for the release
  • Is it really a bug or environment issue
If the bug logged during regression, is it linked to test case that is failed because of this bug


24. What Are The Steps You Follow To Create A Test Script?
Creating a test script usually requires the below steps.
Step-1# The primary requirement is to get a thorough understanding of the Application Under Test.
To achieve this, we will read the requirements related documents very thoroughly.
In case the requirements document is not available with us, then we will use other available references like the previous version of the application or wire-frames or screenshots.
Step-2# After developing an understanding of the requirements, we will prepare an exhaustive list of the areas to be tested for the AUT. The focus in this step is to identify “What” to test. Thus the outcome of this step is a list of test scenarios.
Step-3# After we are ready with the test scenarios, our focus shifts on “How” to test them. This phase involves writing detailed steps about how to test a particular feature, what data to enter (test data) and what is the expected outcome.
With all this done we are ready for testing.



25. What Are The Key Elements In A Bug Report?
An ideal bug report should contain the following key points.

A unique ID.
Defect description – a short description of the bug.
Steps to reproduce – include the detailed test steps to emulate the issue. We should also provide the test data and the time of its occurrence.
Environment – add any system settings that could help in reproducing the issue.
Module/section of the application in which issue has occurred.
Severity
Screenshots.
Responsible QA – This person is a point of contact in case you want to follow-up regarding this issue.



26. How Will You Overcome The Challenges Due To Unavailability Of Proper Documentation For Testing?

If the standard documents like System Requirement Specification or Feature Description Document are not available then QAs may have to rely on the following references if available.
Screenshots.
A previous version of the application.
Wireframes.
Another reliable method is to have discussions with the developer and business analyst. It helps in closing the doubts and opens a channel for bringing clarity on the requirements. Also, the e-mails exchanged could also be useful as a testing reference.

SMOKE testing is another good option which will help to verify the main functionality of the application. It also reveals some very basic bugs in the application.

If none of these work we can just test the application from our previous experiences.


27. Is There Any Difference Between Quality Assurance, Quality Control, And Software Testing. What Is It?
Quality Assurance (QA): QA refers to the planned and systematic way of monitoring the quality of process which is followed to produce a quality product. QA tracks the outcomes and adjusts the process to meet the expectation.

Quality Control (QC) is related to the quality of the product. QC not only finds the defects and suggests improvements also. Thus the process that is set by QA is implemented by QC. QC is the responsibility of the testing team.

Software Testing is the process of ensuring that product which is developed by the developer meets the user requirement. The motive to perform testing is to find the bugs and make sure that they get fixed. Thus it helps to maintain the quality of the product to be delivered to the customer.



28. What Is The Best Approach To Start QA In A Project?
A good time to start the QA is from the beginning of the project startup. In this way, the QA team will get enough time to do proper planning for the processes followed during the testing life cycle.

It’ll also ensure that the product to be delivered to the customer satisfies the quality criteria.

QA also play an important role to initiate the communication between the domain teams. The testing phase starts after the test plans are written, reviewed and approved.



29. Explain The Difference Between Smoke Testing And Sanity Testing?
The main differences between smoke and sanity testing are as follows.
Whenever there is a new build delivered after bug fixing, it has to pass through sanity testing. However, smoke testing is done to check the major functionalities of the application.

Sanity testing is done either by the tester or the developer. However, smoke testing is not necessarily done by a tester or developer.
Smoke tests precede sanity test execution.

Sanity testing touches critical areas of the product to ensure the basics are working fine. However, smoke tests include a set of high priority test cases focussing on a particular functionality.



30. Is There Any Difference Between Retesting And Regression Testing?
The possible differences between Retesting and Regression testing are as follows.
We perform retesting to verify the defect fixes. But the regression testing assures that the bug fix didn’t break other parts of the application.
Also, regression test cases verify the functionality of some or all the modules.
Retesting involves the execution of test cases that are in a failed state. But the regression ensures the re-execution of passed test cases.
Retesting has a higher priority over regression. But in some cases, both get executed in parallel.



31. What Is The Best Approach To Start QA In A Project?
A good time to start the QA is from the beginning of the project startup. In this way, the QA team will get enough time to do proper planning for the processes followed during the testing life cycle.
It’ll also ensure that the product to be delivered to the customer satisfies the quality criteria.
QA also play an important role to initiate the communication between the domain teams. The testing phase starts after the test plans are written, reviewed and approved.


32. Explain The Difference Between Smoke Testing And Sanity Testing?
The main differences between smoke and sanity testing are as follows.
Whenever there is a new build delivered after bug fixing, it has to pass through sanity testing. However, smoke testing is done to check the major functionalities of the application.
Sanity testing is done either by the tester or the developer. However, smoke testing is not necessarily done by a tester or developer.
Smoke tests precede sanity test execution.
Sanity testing touches critical areas of the product to ensure the basics are working fine. However, smoke tests include a set of high priority test cases focusing on a particular functionality.



33. Is There Any Difference Between Retesting And Regression Testing?
The possible differences between Retesting and Regression testing are as follows.
We perform retesting to verify the defect fixes. But the regression testing assures that the bug fix didn’t break other parts of the application.
Also, regression test cases verify the functionality of some or all the modules.
Retesting involves the execution of test cases that are in a failed state. But the regression ensures the re-execution of passed test cases.
Retesting has a higher priority over regression. But in some cases, both get executed in parallel.



34. What Are The Severity And Priority Of A Defect? Explain Using An Example.
Priority reflects the urgency of the defect from the business point of view. It indicates – How quickly we need to fix the bug?
Severity reflects the impact of the defect on the functionality of the application. Bugs having a critical impact on the functionality require a quick fix.
Here are examples which show the bugs under different priority and severity combinations.
High Priority And Low Severity.
The display of the company logo is not proper on its website.
High Priority And High Severity.
While making an online purchase, if the user sees a message like “Error in order processing, please try again.” at the time of submitting the payment details.
Low Priority And High Severity.

Suppose we have a typical scenario in which the application crashes, but such a scenario has a rare occurrence.
Low Priority And Low Severity.

These are typo errors in the displayed content like “You have registered success”. Instead of “successfully”, “success” is written.



35. What Is The Role Of QA In Project Development?
QA stands for QUALITY ASSURANCE. QA team assures the quality by monitoring the whole development process. QA tracks the outcomes after adjusting the process to meet the expectati
  • Quality Assurance (QA) does many tasks like the following.
  • Responsible for monitoring the process to be carried out during development.
  • Plans the processes to follow for the test execution phase.
  • Prepares the time-table and agrees on the Quality Assurance plan for the product with the customer.
  • Communicates the QA process to other teams and their members.
  • Ensures traceability of test cases to requirements.



36. As Per Your Understanding, List Down The Key Challenges Of Software Testing?
Following are some of the key challenges of software testing.

Availability of Standard documents to understand the application.
Lack of skilled testers, tools, and training.
Understanding requirements, Domain knowledge, and business user perspective understanding
Agreeing on the Test Plan and the test cases with the customer.
Re-execution efforts due to changing requirements.
The application is stable enough to be tested otherwise retesting efforts become high.
Testers always work under stringent timelines.
Deciding on to which tests to execute first.
Testing the complete application using an optimized number of test cases.
Planning test cases for other stages of testing like Regression, Release, and Performance testing.



37. It’s observed that the testers in your organization are performing tests on the deliverable even after significant defects have been found. This has resulted in unnecessary testing of little value because re-testing needs to be done after defects have been rectified.

You are the test manager and going to update the test plan with recommendations on when to stop testing. List the recommendations you are going to make.

Following steps need to be taken:
a) Acceptance criteria should tighten.
b) Test cases should be re-evaluated (preferably peer review).
c) If possible more test cases should be added. With boundary value and equivalence class partition cases.
d) More test cases with the invalid condition should be added.
e) Stop criteria needs to be modified.



38. Do you write test cases?

The answer always should be a resounding “Yes”. Test leads are testers too.


39. How do you resolve team member issues?

Informally, first. Ask them out for coffee individually and listen to each one’s side of the issue. If it’s a simple misunderstanding, ask them to resolve it within themselves mutually. If need be, call for a meeting and talk to them without letting things escalate. Tolerate until things do not impact work. When they start to cascade and affect project, warn and if necessary, escalate to human resources as a last resort.



40. How do you provide feedback to a team member who isn’t doing very well?

First and foremost, set guidelines for all team members of what is expected of them and in what time frame. In short, define the parameters of success. For example, if it’s a new team member, let them know what you expect from them:
What module they will be working on?

Timelines
Deliverables
Formats of deliverables
Updating/managing work on tools (such as QC, Rally, JIRA, etc.)
Timesheets and so on…
Set a period of time after which to evaluate, such as 30 days or so. Once done, collect statistics-


41. How do you handle induction of new team members? OR What do you do to train new team members?
  • Set aside time for knowledge transfer and orientation
  • Share all the information regarding who to get in touch with in case of questions regarding different areas of the system and their email addresses or physical introductions (For example: BA, networking team, tool admins, help desk, Dev team etc.)
  • Provide tool accesses
  • Share documentation, templates, previous artifacts, test plans, test cases, etc
  • Share the expectations in terms of their performance (refer to the answer to questions number: 3)
  • When possible, assign a team member to work with them closely for a brief amount of time
  • Keep the channels of communication open to stay in touch and understand their progress


42. How much is your involvement in reviews of test cases, defects and status reports?

I am involved in the test case reviews just as any other team member is. We do periodic peer reviews. I do not review every one’s work; however we review each other’s work. There are very strict processes established before this process begins so all of us can share work and make sure this goes on smoothly.

All the defects are re-checked by me to make sure they are valid, not duplicates and complete in their description. This is more of a task in the beginning of the test cycles, however as we get more into testing, this step reduces as the teams are more comfortable with the process and can do this effectively. All status reports are consolidated and sent by me as this is a team lead’s job as per the company’s process.





Manual QA Lead position Interview Questions and Answers SET-1



How to install Java on EC2

***************************************** How to install Java on EC2 ***************************************** To be continued, In this post...

All Time Popular Post