0

Hi,
>
> I have a question regarding testingUsing Junit ,I have to test the methods of a class in groups.
>
> For example,
> I have a class P and it has three methods, method int f(string) and the
> method float g(int) and the method string h(float), so I have another class testP which has to test the combinations h(g(f("first value from a file"))), h(g(f(h(g(f" first value from a file"))))))
> and so on.I can use some constraints for composition of functions but do not know how exactly to use them.
>
> My testP class should test as many combinations of methods as possible by
> composing them automatically.
>
> Please need help in this urgently.
>
> Thanks!
>

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by ~s.o.s~
0

That wouldn't be unit testing...

Let's suppose I have a class which implements two methods; finding the cube of a number and finding the square root of a number. As long as appropriate unit test cases are in place for each method, does it really matter how the combination of them would work?

Unit tests generally exercise the public API exposed by classes and run in isolation. This is the reason why mocking frameworks exist...

IMO, stacking up method calls in your unit test cases won't add any value to them.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.