Benefits of API Test Automation over UI Test Automation? – Mostly asked Interview Question

API testing has many benefits over UI testing:

  • First, API testing is much faster than UI testing. This is because API tests do not have to wait for a page to load, as they interact directly with the application’s backend.
  • Second, API tests are more reliable than UI tests. This is because UI tests are subject to the vagaries of the user interface, such as changes in the layout or position of elements. API tests, on the other hand, are not affected by such changes.
  • Third, API tests are easier to create and maintain than UI tests. This is because UI tests often require a lot of code to simulate user interactions, whereas API tests only need to make calls to the application’s API.
  • Fourth, with API testing, one can find bugs related to functionality, reliability, performance, and security early in the SDLC and hence those are cheaper to fix.

In conclusion, API testing has many advantages over UI testing, and should be used whenever possible.

Top 15 REST API Interview Questions and Answers

  1. Client/server Error Codes
  2. Success codes
  3. Use of GET, PUT, POST, PATCH, DELETE
  4. Difference between Put and Patch
  5. Difference between Put and Post
  6. How to handle authentication?
  7. Difference between webserver and API
  8. Json/xml structure format
  9. How to validate json response?
  10. Use of JsonPath
  11. How to construct json body for Put, Post, Patch request?
  12. Use of JsonObject.
  13. What’s is URI?
  14. What’s a resource?
  15. What are the common headers used?

~via Shammi Jha (WhatsApp Group)

Common Interview Questions for Software Test Automation Engineers in Java

*******************
Java-Basic
*******************
1. Types of polymorphism
2. Difference between override and overload
3. Methods that cannot be overloaded
4. Static block and instance block
5. Difference in Static and non static
6. Encapsulation and common use cases
7. Abstract vs interfaces
8. Inheritance in java
9. Methods that cannot be overloaded
10. Type casting in java
11. String buffer and string builder
12. Why string is immutable in java
13. How to handle exceptions
14. Can I write try catch without the catch block
15. Difference between throws and throw
16. Use of iterator in java
17. Difference in Final, finally and finalize
18. Boxing and unboxing in java
19. Increment and decrement operation
20. Variable Args
21. This and super keyword in java
22. Issues during Swtich case without break
23. Upcasting and downcasting
24. Baseclass of all class in java
25. Baseclass of error and exceptions
26. Access specifiers
27. Continue and break statement
28. Can main method return any value
29. Can we overload main method. What happens when overloaded
30. how to execute and statement before main method
31. Difference between == and equals()
32. Can user declare constructor as final
33. Can we cast any other type to Boolean data with type casting.
34.does java compile if user use ‘static public void’ instead of ‘public static void’
35.can we use this() and super() in a constructor
36. Can we create object of abstract class
37. Can we create reference for an abstract class
38. Can we declare a class as static
39. What is instanceOf keyword
40. What’s the load factor of HashMap
41. How to prevent a class from being sub classes
42. Final variable, final method and final class
43. Ways to create a string variable.
44. What is gc() – garbage collector
45. Subclass and innerclass
46. Infinite loop in java
47. How to make copy of an element
48. Checked and unchecked exceptions

*******************
Java Collection
*******************

1. Classes inside List interface, Set interface, Map Interface
2. Arraylist vs Linkedlist
3. Arraylist vs array
4. Arraylist vs vector or stack
5. Which class of List Interface to be used if user have more insertions and deletions
6. Which class of List Interface to be used if user have more retrieval
7. Set Interface: HashSet, TreeSet, SortedSet
8. Map – HashMap, HashTable, TreeMap, LinkedHashMap.
9. Stack and Queue
10. How to maintain insertion order in Set, List and Map
11. How to sort elements in ascending order in Set and Map

*******************
Java Programs
*******************

1. String reverse
2. String Palindrome
3. String Anagram
4. Find occurrences of characters in a string
5. Find the count of Capital and Small letters in a string
6. Remove duplicate characters from string
7. Swap to numbers without temporary variable
8. Reverse number
9. factorial
10. Fibonacci
11. Count number, alphabet and special characters

~via Shammi Jha (WhatsApp Group)

[Tips] What must be checked when performing API testing?

Seems easy but yet a tricky interview question. Here is the answer by Katalon experts:

During the API testing process, a request is raised to the API with the known data. This way you can analyze the validation response. While testing an API, you should consider:

  1. Accuracy of data
  2. Schema validation
  3. HTTP status codes
  4. Data type, validations, order and completeness
  5. Authorization checks
  6. Implementation of response timeout
  7. Error codes in case API returns, and
  8. Non-functional testing like performance and security testing

Rest- Assured API Testing Automation Interview Questions

  1. What is difference between API and WebService.
  2. What is difference between SOAP & Rest API.
  3. Can you write a sample of API(URL) and JSON.
  4. How do you handle Authentication token.
  5. How many type of Authentication in POSTMAN/ Rest-Assured.
  6. What is difference between OAuth1.0 and OAuth2.O ,When and where do you use and how. Can you write a sample code.
  7. What is baseURI in RestAssured.
  8. Can you explain RequestSpecification request = RestAssured.given();
  9. What will be returned type of response.jsonPath().getJsonObject(“XYZ”);
  10. How do you extract the values of JSON and how do you validate response.
  11. Can you write a code of save the response in a JSON file.
  12. How do you validate headers of response.
  13. What is difference between Headers and Header class.
  14. What is difference between response.header(“xyz”) and response.headers() methods.
  15. Can you extract all the headers from response at run time.
  16. What is JSONObject() , request.header(“xyz”), response.path(“lable”) , response.body().asString() , response.getBody().prettyPrint(); , RestAssured.given().queryParam(“xyz”,”abc”);
  17. What is difference between request.get(“https//dev-mode.com/api/allcustomers”) and request.request(Method.GET,"/ allcustomers ");
  18. What is difference between PUT and Patch . Have you ever used and where.
  19. What are status code(2xx ,3xx ,4xx, 5xx) in API.
  20. How do you print your response in JSON format.
  21. How do you post body in POST and how many way to post.
  22. What all are the dependency for Rest-Assured.

– Questions shared by Mr. Hari.
Happy Testing

Performance Testing Interview Questions – Part 1 (Scenario Based included)

Q: What is Endurance Testing & Spike Testing?

  • Endurance Testing – It is a type of performance testing where the testing is conducted to evaluate the behavior of the system when a significant workload is given continuously.
  • Spike Testing – It is a type of performance testing that is performed to analyze the behavior of the system when the load is increased substantially.

Q: What are the top 3 Response KPIs for Performance Testing?

  • Average response time – time to first byte or last byte
  • Peak response time – tells your longest cycle
  • Error rate – percentage of problems compared to all requests

Q: What Is Distributed Load Testing?

  • Distributed load testing is the process of simulating a very high workload of an enormous number of users using multiple systems. As a single system cannot generate a large number of threads (users), multiple systems are used for load testing. It helps to distribute the tests and the load.

Q: What is the difference between front-end and back-end performance testing? Which one is more important?

  • Front-end performance is concerned with how quickly text, images, and other page elements are displayed on a user’s browser page.
  • Back-end performance is concerned with how quickly these elements are processed by the site’s servers and sent to the user’s machine upon request. Remember: Front-end performance is the part of the iceberg above the water line, and back-end performance is everything underneath that you can’t see.
  • Both are important because they can both determine whether a user continues to use your application.

Q: You run a load test against a server with 4GB RAM and the results show an average response time of 30 seconds for a particular request. The production server has been allocated 8GB RAM. What would you expect the average response time of the same request to be in production given the same load?

  • While you may be tempted to answer that the response time would be halved to 15 seconds, reality is rarely that convenient. Response times are a factor of so much more than memory. Things like CPU utilisation, network throughput, latency, load balancing configuration, and just application logic are always going to influence load tests. You can’t assume a linear progression in response time just because you’ve upgraded one part of the hardware. This is why it’s important to load test against an environment that is as production-like as possible.

Q: After running a load test, the results show that 300 transactions were executed with a PASSED status and returning responses of HTTP 200. However, the DBA tells you that there were no records written to the database as a result of the transactions. How would you troubleshoot this?

  • Its important to add various counters and monitors DB servers too. + Its very important to add assertions to make sure a request is successful. In the above mentioned case, it can be a bug or it can be due to poor scripting too. Adding right assertions, and counters will help in troubleshooting.

Q: Have you heard about New Relic or Datadog?

  • These are the monitoring tools.

Q: What are the benefits of monitoring tools like – New Relic , Datadog, etc?

  • Monitoring tools lets you monitor all your infrastructure in one place by creating monitors that will continuously check the health of your infrastructure. Access everything you need in one dashboard and see the data as it comes in straight from your systems.
  • Establishes end-to-end application performance and stability, by identifying and leveraging preventative tasks on-demand.
  • Creation of active metrics associated with data response times, CPU usage, load-balance alarms, exceptions etc.

Stay Tuned For Part 2..