It's not a secret anymore!
The moose likes Testing and the fly likes what is a test case? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "what is a test case?" Watch "what is a test case?" New topic

what is a test case?

ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Dear All,
Now I'm working on a support project.

1) After I've implemented a desired functinality, they're asking me to write a Junit Test case.
I got nervous.
I haven't heard that good word "TestCase" in my career till now!
So what is a TestCase & why we are using it ?
What is the speciality of a JunitTestCase & what is unit Testing?
I want the words of people who have practical experience in this so that it may sound simple & concise.

2) One more trivia doubt.
While using Eclipse, to navigate to the next consecutive occurence of a word what is the short cut
Ctrl + ?

If i use Ctrl+F then i need to press forward to move to consecutive words.
I need a key board short cut to achieve that in Eclipse.
What is that?
I remember using that but I've forgotten it now. It's also Ctrl + ? certainly sure it's not Ctrl+F
Seeking your help.


MyBest Regards to all of you.
Ankit Garg

Joined: Aug 03, 2008
Posts: 9465

Well I'm not a pro at JUnitTesting but it is used to test units of your project. You can design a class which will be used to test the functionality of methods of another class. It's mostly an automatic process. You just choose a class whose test case you want to design and then test cases are generated for you. Then you decide the inputs and tell the unit testing system what the expected output should be. Then you run the test case and see if the correct result was produced during runtime.

It's not very difficult. I tried it a long time ago on netbeans when I didn't had any experience. Just read an article or two on the internet ...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46397
Eclipse->help->key assist, and then it appears to be ctrl-K. Not that I can get it to work. Ctrl-F will open the find and replace dialogue.

I think your testing question would sit better on the test forum, so I shall move you . . . whenever I can persuade the JavaScript on my browser to work
sean lopez

Joined: Oct 31, 2008
Posts: 25
A test case is a list of the conditions or issues of what the tester want to test in a software. For example a group of interviewers will first identify the areas they want to ask you questions on before coming up with the specific questions.
Test case helps to come up with test data ( just like the scenario of interview above)

Test Management
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Is unit testing in any way related to test cases?
Then what is unit-testing?

Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33129

Unit testing is a concept - writing tests to test a small unit of code
Test cases are specific tests.

To use both in the same sentence, test cases are used to unit test a specific scenario.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Yuvamurugan Pugazhenthi

Joined: Oct 19, 2007
Posts: 4
It is sample inputs that are given to the program inorder to check the program is error free...
Balagopal Kannampallil
Ranch Hand

Joined: Oct 18, 2004
Posts: 136

You can define a unit test case as a piece of code which simulates the things which are expected to happen when the code is up and running and the people are using your code. You pump in dummy values into the methods which you want to test and see how it behaves to different inputs. It is done to make sure that your code is running error free.

SCJP 5.0 and now fighting with ExtJS
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46397
"Yuva" please read the important administrative private message which I shall send you very soon.
I agree. Here's the link:
subject: what is a test case?
It's not a secret anymore!