any application that is created today is based on the apis and apis play a very important role in all the applications without apis any of the application will not work so we need to make sure that whatever the apis that we building are properly tested so let's understand how the big giants develop apis and how big giants test their apis and how they make sure that their apis are worthy of the production hey what's up everyone and welcome to daily quod buffer in this video we are going to understand the 12 ways that we can do API testing so let's get started the first one is the smoke testing so we do for our API smoke testing which means that we do basic sanity of our API that means that whatever the API that we make is working that's it no extra things nothing whatever you build it is functionally so that's the idea about the smoke testing that whatever you build it should work so that particular testing is done when you are doing your development the next comes is the functional testing so functional testing you are doing to make sure that whatever the functionality of the API is that is completely working fine so within the functional testing there are three parts to it the first part is the contract testing So within the contract testing what we do is we make sure that whatever our producers and consumers are there those are functioning properly which means that whatever the contract that we have designed for the producer and the consumer so suppose I am the producer that I have created this API and this API will be of get type it will be of this URL this this parameters this query parameters or this request body and it will return this type of data that it should return the body of this type if there is any error it will return this type and all sorts of things once it has been identified once the contractor has been identified both the party the producer and the consumer should be agreeing to that particular contract and both of the application should connect to each other using that particular apepi contract so that testing of that particular contract has to be done using the contract testing the next part to it is the component testing so as a part of functional testing whatever the small components are created right so whenever you are creating the API that API consumes of different components internally all the business Logics and everything are there so we need to make sure that whatever the data that we are passing to make sure that all the functional things are working correctly those are correct so your valid data and invalid data both should be tested properly so we can make sure that whatever the components are there those are properly tested the next part to this functional testing is the scenario testing So within the scenario testing what we have to make sure is whatever the functionality is there whatever the scenarios are there for my application has to be tested properly has to be flown perfectly how it is intended to be so suppose if I give you the example of order management system that I have the API to create the order so I need to make sure that whatever the order API I have created that order API is taking a proper input suppose that input is the list of items that I want to order the address details and whatever payment details and everything those data is is been been taken properly and whatever the scenarios are there positive scenarios or negative scenarios like if order is successful what should happen if order fails what should happen what are the refund possibilities and all sorts of things has to be tested properly to make sure that whatever the scenarios are there for your apis are fulfilling as per your contracts and you can make sure that your functional testing is completed now this is what we discuss everything about your API which you have created but your API doesn't work in a vacuum right so your API works with a different system so that's where ation testing comes into picture so you need to make sure that you are doing the integration testing of your apis throughout the system so if you have multiple systems upwards and multiple systems downwards so you need to make sure that at least we do one up one down integration testing and possibly throughout the system so we need to make sure that end to end testing with the integration testing of our API is completed properly so the same example that if I take that the order API that I'm taking so I need to make sure that are there any Upstream system that is been used for the calling this order API are there any Downstream systems are there any system that has been called from this order API suppose payment add to card all those things can happen so I need to make sure that all those apis are working correctly in circumference with my existing API right so I need to make sure that integration testing of my API is done throughout these systems to make sure that n2n functionality is working properly now once my API is created I have done the integration testing as well with upstream and downstream system I need to make sure that the performance of my Epi is as per the standards of my application so I need to make sure that I do the performance testing of my Epi that's where the performance testing comes and I need to make sure that whatever the performance is there right suppose I need to make sure that whatever the benchmarks that I'm getting are those benchmarks as per the expected from the business are those expected from the product perspective all those performance testings I need to do for my apis within this performance testing there are three more testing that are under this you can consider under this performance testing or you can consider separate as well but there are other testing methods also make sure that we do the next API testing is the stress testing so in this testing what we try to do is we try to do this stress on the system so what we try to do is we try to spike the system on a very short period of duration and we try to understand that if there is any High request coming through or if there is any Peak there for very short duration how much is the load that this API can handle and in what time my API can recover from this Spike so that's what I need to identify using the stress testing that what is the maximum stress I can give to my API so that it can handle everything and in case of any error it can recover from that situation so that's what we test in the stress testing the next is the soak testing soak testing is something that we do to push the limits of our apis so that's the endurance testing of our apis so what we do is whatever we did for the stress testing we do that for a very long period of time so we need to understand that if there is a stress on my system on a very longer period suppose that longer period I can give you example as a maybe there is a Amazon Festival Flipkart Festival right so big billion days and all so there is a very high number of users interacting with your application and there is a really high throughput and there is a really high load on your system so you need to make sure that your application is able to handle that much amount of load or not so you need to make sure that you test all those scenario as well and you make sure that your API is capable of doing all those things so that's what you do the endurance testing your soak testing for your API using this very high load stress for a really long duration of time now once you have done everything your API is now in production that you have done everything to make sure that your API is in production with all the different testing that you need to do now if there are any changes to your application if there is any improvements or new functionalities added to it you need to make sure that your existing things are not broken so for that you do regression testing regression testing is performed Whenever there is a release going on and you need to make sure that whatever has been built for your system is everything working correctly so you do regressions when you are doing a continuous roll out of your application to the production systems so regression has been done to make sure that whatever has been built is working correctly and whatever the new things are going I have done all the new testings for that particular thing load testing performance testing stress testing soak testing functional testing and everything with that my regression is also working fine so that's what you do to make sure that you are publishing your changes to the production the next testing we do is the penetration testing that is a pen test so what we do is we need to make sure that there should not be any vulnerabilities to your apis is my API is vulnerable to any attacks or not that testing particularly we do to make sure that our API is secure enough so that there is no attack can happen on your apis then you do is the first testing you need to make sure that whatever the apis are created is not vulnerable to The Fuzzy data that means that so you pass the data to your apis which does not make any sense any random sorts of data your Escape characters your your characters which generally can cause the issue right so all those characters all those data has been passed to your epis to make sure that your Epi can handle all sorts of data if your API should not work on those data your apepi is properly saying that this data is not allowed and everything all sorts of testing needs to be done for your fuzzy data as well so all those things are done in the FY testing then comes is the unit testing unit testing is a really important part of your apis this is like you are debugging line by line code of your apis so you need to make sure that whatever the line of code that youve written for your apis every line is tested properly so you write unit test for your apis line by line to make sure all the lines are covered properly and you get a better coverage to make sure that whatever the functional code that you have written is working as expected there is no extra thing added to it and all the flows should work properly so your unit test will cover all the nooks and crannies of your apis all the edge cases and everything to make sure that your API is able to handle all those scenarios then comes the UI testing your apepi is something which will not be worked directly by the users your epis will be connected to the UI and your UI is something your user will be working so you need to make sure that you do UI testing as well which will eventually come to your entire scenarios entire flows right so from UI if you're API has been getting called are those API calls correct as per the expectations all your throw ports your TPS everything are expected as per the requirements your UI is getting a proper data how it is expected and it's able to show the data correctly or not all those testing should be done in UI testing part to make sure that your API is working as per expectations so these are all the different testing ways of your API to make sure that your API is tested properly and it is available and it is Worthy of a production so that your API is now can go to the production once you do all sorts of testing so this is used widely across the industries to make sure that your API is tested properly with all the details around it about everything not just your functional part but your security part your load testing part your performance of your apis your securities your fuzzy data handling exception handling and everything so this is how you should be treating your apis testing your apis to make sure that they are developed correctly for the production applications and you are not expecting any unexpected scenarios after going to the production so this is what you do to make sure that whatever the things comes in production whatever the things comes once you go live everything is handled correctly so this was all about the different ways you do testing to make sure that your API is developed correctly if you like this video give us a thumbs up and subscribe to my channel for the upcoming videos you can also ask any questions if you have in the description below that's it for now I will see you in the next video till then Happy coding bye-bye