Answer the question
In order to leave comments, you need to log in
How to test PHPUnit random data?
Hello! For example, we can easily test that some method will throw an exception when passing an incorrect value, or that when we pass 1, 2 to the add method of the calculator class, we will get 3. But what about the same calculator if I want to test whether it breaks he, if I enter 250, 250, that he will still return the correct amount of 500 to me, but I will not transfer the array from 1 to 500 by hand, and the sequence may not be 1,2,3, but in discord. But the calculator is too simple, we already know, even without testing, that it will work. Another thing is if there is a method with complex calculations that can take from 4 parameters and not just add them, but multiply, divide, subtract, compare, etc. how to be in that case? Well, I'll write the transfer of 10 options, I will manually calculate what the correct result should be (which would also be automated somehow), but who knows what will happen if I pass option 11 or 21, suddenly something goes wrong. How to be in this case? I'm quite new to testing and maybe I don't understand something, but I hope I've described in detail what's bugging me. Perhaps those 10 options that I will give for the test will be enough. Thanks in advance
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