Is there any way that i need not write junit test cases and it gets generated automatically.
Actually i have an application which is fully tested but has no junit written for it. So i am sure that it is complete and has not much error. But my client wants a code coverage report for the same.
Is there any tool available which can generate test cases automatically.
I am using java, jboss portal.
Check Google's CodePro Analytix. It even has options to generate test cases with mocks. There is also an eclipse plugin. http://code.google.com/javadevtools/codepro/doc/features/junit/test_case_generation.html
For mathematical formulas try https://github.com/junit-team/junit/wiki/Theories
and example of a tool for generating tests: https://developers.google.com/java-dev-tools/codepro/doc/features/junit/test_case_generation http://sourceforge.net/projects/junitgenerator/
Maybe use Cucumber and Datatable inputs for different scenarios http://jeannotsweblog.blogspot.com/2013/02/cucumber-4-advanced-gherkin.html
I am looking into trying the Json input http://collectiveidea.com/blog/archives/2011/07/12/test-your-api-with-cucumber-and-json_spec/
Writing the unit tests for the sake of writing or for coverage is a bad idea. Unit tests should be written to actually test your code. In your situation you could start writing the tests for the more important classes first and then gradually work towards increasing the code coverage. You might even find some real bugs in this process.
Randoop is the framework you need https://randoop.github.io
I do agree that generating tests is definitely not the way to go, but may be the starting point for writing real tests. careful: CodePro generates really silly tests sometimes! But when you say your code is fully tested then I assume that you have written some sort of main-method that is doing all the testing stuff. Generating test reports for these main-method-based-tests would be similar to JUnit test coverage reporting. For example by using cobertura, you first instrument your compiled classes, start your test-main methods and examine the generated coverage-report-files with "sonar" for example.
The same should work if you manually test your application use case for use case. But in this case I would strongly suggest to automate these tests at least with some tool like selenium etc.