-2

I seek a method written in Java that tests a method with as greater code coverage as possible. Meaning, I want to know how can I count a number of instructions executed by this method in Java.

How do I do it?

Please provide your practical inputs.

Pavel Bucek
  • 5,304
  • 27
  • 44
  • a code coverage is not a specific thing that you plug it in. Each method / functionality needs a specific series of tests which "cover" some aspects, the more aspects are covered the greater the code coverage. The tests depend on the functionality, for example fo some simple and/or triviual inputs, check that the correct outputs are returned. This is unit testing, meaning testing basic units of functionality by themselves as for their own specific functionality. Check jUnit – Nikos M. May 29 '15 at 15:01
  • You are asking for a tutorial on testing. – Raedwald May 29 '15 at 16:06
  • I want to develops an small function testing that cover code in any function , count the instruction in any input function – user3916281 May 29 '15 at 16:27

1 Answers1

0

If your question is how to work out how much of your code was covered by your tests, then google for java code coverage tools.

There are many out there, both commercial and opensource. I've used Clover and Emma in the past.

Phil Anderson
  • 3,146
  • 13
  • 24