API Testing in DRF | StreamPlatform API Testing | Django Rest Framework || How to Test API In DRF

preview_player
Показать описание
Introduction to Testing in Django and Django Rest Framework:
This article will go over the basics of testing and how to write tests for our Django APIs.

I'm gonna be honest, I only started writing tests 3 months ago. It was the start of my new project and I've decided to develop the habit of writing good maintainable code.

I didn't know how to judge my code apart from code reviews with other developers but I quickly understood from research that good code requires tests.

So I've embarked on the journey of writing tests and it was pretty bumpy the first few times. My tests were long and slow, colleagues were complaining but I eventually got the hang of it.

Right now testing is something I unconsciously do and I believe I've become a much better developer because of it.

Coming back to this article, I've wanted to share what I learned during the past three months and hopefully convince you to write some tests yourself.

I know this is a Django Rest API testing tutorial, but the principles learned here can be applied to all programming languages and domains.
Prerequisites

Basic knowledge of Python, Django and Django Rest Framework.
Python installed locally in your machine.

Why should you test?
The first hurdle I had to overcome was to convince myself and my manager on why should I spend more time on tasks to write tests. I did my research and have come up with eight different reasons to write tests.
Easy to Find Bugs

Tests help to find bugs in two distinct ways.

The first way is that if you test the common functionality then finding the edge cases where your code might break is much easier. These kinds of bugs are hard to find manually because they require certain scenarios to be present, that's why writing tests for edge cases make sure that they never happen again.

The second way that tests help with bugs, is that it immediately notifies you of regression bugs. Regression bugs happen when you alter or add new features which cause old features to break. This is one of the most important benefits of writing tests because it provides a safety net to write code. You can safely refactor code and if all tests pass, you can rest assured that no regression bugs were caused.

I wholly believe that tests allowed me to experiment with my code using different best practices. I've become a much better developer because of this in a short period.

Keywords:
REST API Testing with Django REST Framework
3 API Testing StreamPlatform | Django Rest Framework
Django REST API UNIT Testing [3/3]
Django REST Framework (Hindi)
API Testing Tutorial. Unit Testing Authentication. Django rest framework project tutorial[14]
Django Rest Framework Series - JWT Token Authentication with React - Part-3
20.Configuring URL and Testing App in Postman | Django Rest Framwork
Build a Rest API with the Django REST Framework
Django Rest framework Tutorial. Multiple user authentication in Rest API. part 1

Hahstags:
#codeFast
#this_is_coding_zone
#code_like_pro
#being_coder
#beingCoder #django #python #djangounchained #programming #quentintarantino #coding #javascript #programmer #tarantino #leonardodicaprio #java #html #machinelearning #webdevelopment #pythonprogramming #php #css #pulpfiction #github #djan #killbill #onceuponatimeinhollywood #developer #movie #code #jamiefoxx #pythoncode #cinema #film #reservoirdogs
Рекомендации по теме
join shbcf.ru