3

I added some methods in a class which was already under a JUnit coverage.
Now I want to extend the existing JUnit with some tests to validate the new methods.

I want to know if there is a way to do this via GUI, without installing any other plugin like this answer advices.

Thank you in advance.

Community
  • 1
  • 1
HAL9000
  • 3,562
  • 3
  • 25
  • 47
  • Why don't you want to just add methods to the class? What do you mean by "via GUI"? – Jon Skeet Jul 26 '14 at 14:37
  • 1
    @JonSkeet When you create a new JUnit you are asked which methods you want to test in a nice GUI. I'd like to have the same GUI where I can see the methods not covered and select which to add. It's not a must but it would be nice to have. – HAL9000 Jul 26 '14 at 14:40
  • 1
    Not sure what you mean by "a new JUnit" but I normally just write code. It really doesn't take that long to add methods by hand - or if it does, it's worth improving your typing speed. Note that if a GUI is encouraging you write write one test method method, you should resist that. For all but the most primitive methods, there are multiple scenarios you should be testing. – Jon Skeet Jul 26 '14 at 14:41
  • 1
    @JonSkeet the question is only because eclipse gives you a GUI to create a JUnit and I was wondering if the same tool had also a way to edit existing units. If not so, I have no problem to do it by hand. – HAL9000 Jul 26 '14 at 14:44

1 Answers1

1

Well, without the plugin, you always have the manual method.

Just add the test methods to your JUnit and annotate them with @Test. This will allow JUnit to recognize the method as a test and execute it. In these newly added methods, you should invoke the newly added methods of your class and check their behavior.

Pat
  • 2,223
  • 4
  • 19
  • 25