testing - Don't understand the purpose of behavioral tests -


I hope someone can help me see the real value in these tests because I read a lot about them And I worked on a project recently but I did not really see the actual value in the tests. I'm sure I can understand why they are written and see how they can be useful. But it seems that there are very few ROIs on these types of tests, here are examples of some class in our code base:

  class ServiceObject: IServiceObject {dependency_ dependency; ServiceObject (dependency dependency) {this._dependency = dependency} bool SomeMethod () {dependency.SomePublicMethod (); }}  

Then in our behavioral tests, we will write the test (such as pseudo-code):

  zero ServiceObject_SomeMethod_Uses_Dependency_SomePublicMethod () {mimicking IServiceObject; Expect to call dependency. Expect to call for dependency. Call some public method for IServiceObject.SomeMethod to check mockserviceobject.SomeMethod to see if the expectation was finished}  

Obviously some details are missing, but if you are familiar with this Type test you will understand.

So my question really came out of the fact that I do not know how valuable it is to know that my service calls the object dependency method, I understand the reasoning behind this because you make sure The argument of the law is killing those parts which are considered to be it. But I do not know how this is a permanent test pattern?

I wrote the argument and knew how the code should work, after making sure of it, why would I ever change it, working? Now you can say that if you work in a team's environment then you want to ensure that no person is coming together and the code changes so that the assurance can be dropped accidentally and thus it is sure Would like to know that they know about it. But what happened if it was left for a valid reason. Then that whole test and maybe any other would have to be eliminated.

Anyway, I am hoping for anyone to turn on the light about the real potential of these types of tests.

The purpose is to test the orbit in isolation, actually testing the unit. Verify that it caters to its responsibilities.

In this case the code is rather trivial. The value of this type of test can be more pronounced when there is conditionality in the processing path, parameter dependency is passed and processing dependencies are done on the result. For example, there was a method like this instead:

  bool someMethod (int paramax, int para y) {if ((prix / param)> 5) dependency dependence. Doing (Paramax); } And {dependency dependency Domingelse (Paramy); }}  

Now we have some tests, and I think the value becomes more clear. Especially when we write zero with the Parameter set.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -