This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Testing and the fly likes The source attachment does not contain the source for the file testCase.class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "The source attachment does not contain the source for the file testCase.class" Watch "The source attachment does not contain the source for the file testCase.class" New topic
Author

The source attachment does not contain the source for the file testCase.class

joseph cooper
Ranch Hand

Joined: Nov 08, 2005
Posts: 44
I am trying to figure out how to write a JUnit test case.

The source attachment does not contain the source for the file testCase.class. This happens on a Class File Editor screen. It also
give me the option to change attached the source. When I try to change
the attached source (workspace, external file, or external folder), I
get the same error.

I am running on WSAD 5.1.2

What needs to be done??


[ April 12, 2006: Message edited by: Lasse Koskela ]
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30789
    
157

Joseph,
Do you have junit.jar in the classpath for that WSAD project?

You don't need the junit source to be available - just the .class files in the jar.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
joseph cooper
Ranch Hand

Joined: Nov 08, 2005
Posts: 44
Yes I have junit jar in the class path.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
How does the source attachment and viewing the junit.framework.TestCase class relate to trying to write a JUnit test class? Are you trying to "read the source, Luke" in order to figure out what you need to do?

Anyway, what you've got is mostly correct. Just remove the constructor and you're all set... Except that you also don't want that try-catch in there. Just declare your test* methods to throw an Exception like so:

[ April 12, 2006: Message edited by: Lasse Koskela ]

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
 
 
subject: The source attachment does not contain the source for the file testCase.class