hi guys j

is there a way on how to analyze java snippet of codes, like for loops, while loop to check to see what will be the result of it, whether it would run, what results, or if it would give you any kind of syntax error, run time error or logical error,
do you have that facility on this site available.

1 Year
Discussion Span
Last Post by JamesCherrill

Unit testing is a means to test the "smallest units" (methods) in your code. You either provide all the parameters, or you create mocks for services required by your method (if you search for this, it returns result A, if you search for that, it returns result B, if you search for yet something else, it 'll throw an exception, ...)


Here are a few links sure worth reading through:

you can write tests that cover your entire code, meaning you'll be able to test every possible scenario of the application before it's even used, and thus prevent any mistakes.


At a far far simpler level I have a NetBeans project that looks a bit like

   class test {
      public static void main(String[] args) {
         // put code to test here

so when some interesting bit of code appears on DaniWeb I can just paste it in there and compile/run/debug it with roughly zero effort.

I have a similar one that creates and dsiplays an empty JFrame, so I can check out Swing code quickly.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.