lundi 14 novembre 2016

Why are mocking test frameworks helpful?

It seems like all of the Mockito examples I have looked at, "fake" the behavior of the object they are testing.

If I have an object that has a the method

public int add(int a, int b) {return a+b}

I would simply use JUnit to assert whether two integers passed in would result in the correct output.

With all of the examples I've seen with Mockito, people are doing things like when.Object.add(2,3).thenReturn(5). What's the point of using this testing framework, if all you're doing is telling the object how to act on the test side, rather than the object side?

Aucun commentaire:

Enregistrer un commentaire