Answer the question
In order to leave comments, you need to log in
What is the correct approach to writing tests for a task?
Please explain by what principle unit tests are written for a specific task.
I beg you not to answer "senders to read something and somewhere" and even "proof-liners" - "like here is an article in English in 70 sheets, go study"
I'm not even interested in an example of some kind of test, but in the very organization of thoughts - what does it mean - to write a test, and how it means depends on the task. Here is a seminar, for example, from the developers of Badoo, where they say that you need to write 2 tests for each function, and be sure to test for the REST api.
My test task is to bring down the REST api system. But given that I write these tests myself, and write them for my own code, I can’t predict how this system can fall.
Let's say if rest_api accepts a json file as input, then they immediately pop up in the head to check the mime / type, check the extension, check the file content, put protection on the number of requests from one ip per minute, put something else ... well, that is, they pop up in head ideas how to modify the original code.
In this case, it becomes unclear to me - why write and, most importantly, how to write a test, if the ideas are here - take it and wind it up in general code, revealed vulnerabilities.
Here in this vein I would like to see the general view of the example. It’s even good if it’s not a specific code, but in the language of explanations - they say rest api, here’s the get method, such and such tests will be needed, and therefore.
But in general, many will decide to keep the commercial secret of Zen unit testing, because technology since the advent of mankind has been a means of manipulation - when the priests came up with the idea that God sends rain - they began to wear women and food.
So help me who realized the benefit of one knowledge for all, and not a marketer who understands the value of what I'm asking about.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question