• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Test by JUnit

 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the benefit of testing the assignment by JUnit or any tools while everything is working fine??? :roll:
I don't see any benefit of that because (let us say using JUnit) suppose to be at the beginning of the assignment not at the end...
I created a small testing class which contains many clients (of course not JUnit, but it was a java class) to test lock and unlock. both methods working fine.
Now, shall we test it or not test it, that is the Question?
Is it compulsary to using testing tools or what?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11865
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Qusay
what is the benefit of testing the assignment by JUnit or any tools while everything is working fine??? :roll:

How do you know it is working fine if you don't test it?
And if you make a change to your class that you believe is working fine, how can you test that it still passes the correct input and gives proper exceptions on bad input?
I don't see any benefit of that because (let us say using JUnit) suppose to be at the beginning of the assignment not at the end...

One of the big problems coders have had in the past (and no doubt still have) is that they wait until the end of the project before doing testing, and then the only do what amounts to "end user" testing - testing that the basic functionality works, and that any error scenarios they can think of for the "application as a whole" are handled.
If an error is found, then you have to work through the entire application to determine where the problem is (unless you know the entire application inside out).
Even then, you have only tested for the errors you can see the user creating within the confines of the application.
Using something like JUnit, you start testing at a much earlier stage, testing each unit as you build it. You actually sit down and try and work out all the scenarios (both successful and failures) that the unit should handle. Then you test them. If you later modify that unit, you can simply re run your tests to make sure it still works according to the criteria you determined.
Now, shall we test it or not test it, that is the Question?

Well, I think everyone does some testing. It is just a question how formally they do their testing.
The SCJD assignment is an excellent place to learn a tool like JUnit. You have a nice small application, with no time limits.
It would be a nightmare trying to learn how to use a testing tool when you have just inherited a huge project that you dont know and have a deadline for when the next version of it is due to come out.
Also, getting into the discipline of using a testing tool early on makes it easier to use one later in life.
Is it compulsary to using testing tools or what?

No, it is not compulsary, but it is a very good idea.
Regards, Andrew
 
Qusay Jaafar
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Andrew for your comments...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic