Yes, you should test only one method / block. For example, TestNG recommends that you make such assumptions, allowing you to define test dependencies. If you test a method foo()that depends on the method bar(), make your test dependent on the one that checks bar(). If the test bar()does not work, tests for foo()will not be performed.
The disadvantage of this assumption (when you cannot determine test dependencies) is that when the method is bar()violated, the tests for foo()and bar()fail, making it difficult to find the main cause of the problem.
source
share