Open w2vgd opened 3 years ago
While keeping the door open for others' comments about this specific situation, here are some general thoughts:
When writing test cases for something, decisions to make include:
Factors to consider include:
As usual, it requires a judgement call for each specific situation. If the code has dependencies, it is more common to use a hybrid approach rather than pure unit and integration testing.
Regarding the second part of your question, I think it is heavily dependent on what you're comfortable with. If you feel like there may be changes to some essential part of the code down the line, unit testing is definitely a better choice as it won't be too dependent on other parts of the code working. However, if you feel like you're close to completion, integration testing could be a good sanity check to see if different modules of your product are working.
Hi, I realized that in the original AB3 code, when testing the
Person
class inPersonTest
, the code usesPersonBuilder
which in turn uses all of the attribute classes such asName
andPhone
to build thePerson
object. So in this case, isPersonTest
a form of integration testing? If it is, why is it tested using integration testing instead of unit testing in this case?Another follow up question is when do we know if a class should be tested using unit testing (isolated from other class and only uses stubs if necessary) or integration testing?