This question already has an answer here:

I am new to Junit. I have a class with four methods. I am creating a test class with test cases. Can I have a test case that uses more than one methods of testing class or there should one test case per one method. What is good practice ?

marked as duplicate by gnat, Kilian Foth, durron597, user40980, user22815 Aug 4 '15 at 2:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Could not get my answer reading this. – want2learn Aug 3 '15 at 4:22
  • 1
    it took you how long, 8-9 minutes to study all the answers over there, along with the links to further reading referred from these answers? – gnat Aug 3 '15 at 4:30
  • 1
    @gnat: it took me 30 seconds to see that the other question is not a duplicate - it is about the contents of tests, not about their structure. – Doc Brown Aug 3 '15 at 5:08

Can I have a test case that uses more than one method of the tested class

Obviously yes, how will you otherwise test methods which need a specific initialization before? For example

  fooCalculator = new FooCalculator(someParameters);
  result = fooCalculator.Calc(); 

If, however, your question is "Can I have a test case that tests more than one method", then the answer is "you should avoid that", because that will typically result in too large tests. See this former question for a detailed explanation.

Not the answer you're looking for? Browse other questions tagged or ask your own question.