I have a program with many classes. I manage the DI with Guice, btw.
I wanted to write in-progress tests to my code (unit tests and higher level).
I have few questions\difficulties:
- How high should my tests be?
How high should my tests be?
I know there is no "right\wrong" answer.I know there is no "right\wrong" answer. If I write the test too high it might be difficult for me to simulate all test cases.
If I write the test too high it might be difficult for me to simulate all test cases.If I write the tests too low, every class\structural re-factoring I'll do will break the tests and that would be very tedious to maintain.
I guess the solution is combining both? Or is there any best-practice guideline?
How would you call tests that call the highest API of my code, when I use mocks only for out-of-process services (DB, Http service etc)? They are not unit-tests because I don't mock all dependencies?
What is the best practice to inject mock using Guice in PROD code? create a mainModule class for each test-class? but then if I want a different data from the mock for each test - then I'll have as many mainModule classes as many test cases?
If I write the tests too low, every class\structural refactoring I'll do will break the tests and that would be very tedious to maintain.
I guess the solution is combining both? Or is there any best-practice guideline?
How would you call tests that call the highest API of my code, when I use mocks only for out-of-process services (DB, Http service etc)? They are not unit-tests because I don't mock all dependencies?
What is the best practice to inject mock using Guice in PROD code? create a mainModule class for each test-class? but then if I want a different data from the mock for each test - then I'll have as many mainModule classes as many test cases?
I could add a concrete example, but I thought the qquestion might be cleared in general. No?