-1

Is there any automated testing tool or framework which will test our Java code without writing any piece of code in test cases from developer view?

3 Answers3

3

There's a tool called javac which will run some rudimentary tests on your code.

For example, if your code is missing a }, it will tell you. Also, it will detect when you try to call a function with the wrong type of argument, or call a function that doesn't exist.

You may find FindBugs useful, since it can warn about potentially dangerous code, but it has a lot of false positives.

Beyond that, what you're asking for is some sort of programmer AI. If the computer could tell that you've implemented your code correctly, why not just have the computer write it for you?

Brendan Long
  • 53,280
  • 21
  • 146
  • 188
  • 2
    Random Code Generator + Automated Testing Tool = Effortless Success! I like it a lot! – emory Apr 14 '12 at 06:37
1

You can consider static code analysis tools such as Coverty or FindBugs, which will try to find potential bugs just based on the source code without actually executing it.

You can also try randoop, which automatically generates random JUnit test cases (random sequences of method calls) looking for object contract violations. It discards method sequences that result in illegal argument exceptions and such, which is a nice positive. It also remembers method sequences that construct complex objects, and sequences that result in contract violations.

If your code has specification written in JML, ESC/Java by Compaq can verify your code against those.

K Mehta
  • 10,323
  • 4
  • 46
  • 76
1

Actually, there seem to be some tools, but I have not used any of them. Additionally, if you write some tests, you can have PIT modify your existing code to find potential pitfalls.

Community
  • 1
  • 1
matsev
  • 32,104
  • 16
  • 121
  • 156