Excellent test summary API test

What is API?
API is a set of routines, protocols and tools used to build software applications. The API specifies how a software program should interact with other software programs.
Routine: A program that performs a specific task. Routines are also called procedures, functions or subroutines.
Protocol: The format for transferring data between two systems.

Let's look at some API examples in a more approachable way.
Assume that the API is a waiter in a restaurant.
At the restaurant, you can place an order based on the items available on the menu. The waiter in the restaurant writes down your order and delivers it to the kitchen where the meal is prepared. After the meal is prepared, the waiter picks up your food from the kitchen and offers it to you at your table.
In this case, the role of the server is similar to the API. As a server, the API receives the request from the source, receives the request to the database, obtains the requested data from the database, and then returns the response to the source.
Let us now look at another example.
If you are using a flight service engine, say Expedia and search for flights on a specific date. After data such as departure place, destination, arrival date and return date, click Search. Expedia sends a request to the airline via API based on your search details. The API then sends the airline's response to your request back to Expedia.
The API gets the request from the user and gives a response without exposing the internal logic. API is like an abstract OOPS concept.
What is API testing?

API testing is a type of software testing that involves directly testing APIs and is part of integration testing to check whether the API meets expectations in terms of application functionality, reliability, performance, and security. In API testing, our main focus is the business logic layer of the software architecture. API testing can be performed on any software system that contains multiple APIs. API testing will not focus on the appearance of the application. API testing is completely different from GUI testing.
Let us see how UI testing is different from API testing?
UI (User Interface) testing is to test the graphical interface part of the application. Its main focus is to test the appearance of the application. On the other hand, API testing supports communication between two different software systems. Its main focus is the business layer of the application.
API test type?
API testing usually involves the following practices:
• Unit testing: Testing the functionality of a single operation
• Functional testing: Testing the functionality of a wider range of scenarios by using a set of unit test results tested together
• Load testing: Testing the functionality and performance under load
• Running Time/error detection: Monitor the application to identify problems, such as anomalies and resource leaks
• Security testing: Ensure that the implementation of the API is not affected by external threats
• UI testing: This test is part of the end-to-end integration test to ensure the user interface All aspects of the system can run as expected
• Interoperability and WS conformance testing: Interoperability and WS conformance testing is a type of testing suitable for SOAP API. Check the interoperability between SOAP APIs by ensuring compliance with the Web service interoperability profile. WS-* compliance is tested to ensure that standards such as WS-Addressing, WS-Discovery, WS-Federation, WS-Policy, WS-Security and WS-Trust are properly implemented and utilized.
• Penetration testing: look for attacks from Application vulnerability
• Fuzzing: Test the API by forcing the input system to try to forcefully crash
the common tests of
the API : Some common tests that we perform on the API are as follows.
• Verify that the return value is based on input conditions. The API response should be verified against the request.
• Verify that the system is verifying the results when the API updates any data structure
• Verify whether the API triggers other events or request other APIs
• Verify the behavior of the
API without a return value The advantages of API testing:
• Compared with GUI testing, API Testing is time-saving. API test automation requires less code, so it can provide faster and better test coverage.
• API testing can help us reduce testing costs. Through API testing, we can find some small errors before GUI testing. These small errors will become bigger during GUI testing. Therefore, finding these errors in API testing is cost-effective for the company.
• API testing is language independent.
• API testing is very helpful for testing core functions. We can test the API without a user interface. In GUI testing, we need to wait until the application is available to test the core functions.
• API testing can help us reduce risks.
What exactly needs to be verified in API testing?
Basically, in API testing, we use known data to send a request to the API and then analyze the response.
• Data accuracy
• HTTP status code
• Response time
• Error code when API returns any error
• Authorization check
• Non-functional testing, such as performance testing, security
testing Tools for API testing:
Some tools used for API testing are as follows:
• Postman
• Katalon Studio
• SoapUI
• Assertible
• Tricentis Tosca
• Apigee
• JMeter
• Rest-Assured
• Karate DSL
• API Fortress
• Parasoft
• HP QTP(UFT)
• vREST
• Airborne
• API Science
• APIary Inspector
• Citrus Framework
• Hippie-Swagger
• HttpMaster Express
• Mockbin
• Ping API
• Pyresttest
• Rest Console
• RoboHydra Server
• SOAP Sonar
• Unirest
• WebInject What
is the difference between API test and unit test?
Unit testing:
• Unit testing is conducted by the development team
• Unit testing is a form of white box testing
• Perform unit testing before including the code in the build
• Source code involves unit testing
• In unit testing, the scope of testing is limited, so only basic functions are considered for testing
API testing:
• API testing is performed by the quality inspection team
• API testing is a form of black box testing • API testing is
carried out after the build can be used for testing
• API testing does not involve source code
• In API testing, the scope of testing is very wide, so all normal operation issues should be considered.
Challenges in testing API testing:
When performing API testing, some of the challenges we face are as follows:
• Choosing the right parameters and their combinations
• Correctly classifying parameters
• Correct call sequencing is required, as this may lead to insufficient test coverage
• Verification and Verification output
• Since there is no GUI, it is difficult to provide input values
. Types of errors we encounter when performing API tests:
The problems observed when performing API tests are
• Stress, performance and safety issues
• Duplicate or missing functions
• Reliability Sexual issues
• Improper message delivery
• Incompatible error handling mechanism
• Multithreading issues
• Wrong wrong
API testing best practices:
• Test expected results
• Send a series of API load tests to increase the pressure on the system
• API testing by test category Use case grouping
• Use all possible input combinations to create test cases to fully cover the test
• Prioritize API function calls to make them easy to test
• Create tests to deal with unforeseen problems
• Automate API testing as much as possible

Guess you like

Origin blog.csdn.net/weixin_46033259/article/details/110524165