Link to home
Start Free TrialLog in
Avatar of chima
chima

asked on

JUnit Eclipse

Hello,
I have two packages in one Project.  In the first package I have a java file that contains "main," and in the other java file I have the code I am working with.  I am running them as "Java Application," but I wish to run them as a JUnit.  If I would have started the java files off as JUnits from the beginning I would not have this problem now.  So I need to convert the java files I now have to run as JUnit.  How shall I do this.  I have tried setting the Debug Configuration, but I run into one problem or the other.
Avatar of Ajay-Singh
Ajay-Singh

In eclipse, you can select a folder and right click->New->Junit Testcase
More on how to write testcase http://www.thekirschners.com/articles/how-to-write-test-cases.html
SOLUTION
Avatar of muktajindal
muktajindal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chima

ASKER

Ajay-Singh, I am looking more for the Eclipse setting of the "Run Configuration" or the "Debug Configurtation.  I think it is more the Debug Configuration."

muktajindal, If I had started with JUnit I would not have this problem.  Of course I could set it up as JUnit and copy the code over, but I wanted to learn how to get from a Java run as "Java Application" to "Run as JUnit."  I have seen it done once, but when I go to do it, I run into a couple of different problems.  One says; No test for JUnit 4 or 3.  And the other just does not let me select the java file I want.
Avatar of chima

ASKER

Now I see what you mean by "extending Testcase" and yes this was the problem.  Now I have a related problem, which I found a web site explaining "multiple inheritance."  I see that it is not straight forward, so I wanted to ask; I have  public class XmlTest extends XMLTestCase.  How would I add another extention, i.e., public class XmlTest extends Fixture, XMLTestCase
Extending or adding Fixture
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chima

ASKER

Ajay-Singh, not directly, but it is possible, right?  http://pclc.pace.edu/~bergin/patterns/multipleinheritance.html explains how, or at least I think it does.  I have not had time to read through it.
It is possible for interfaces (which are not concrete classes), not for concrete classes. I was referring to
concrete classes, where there is no multiple inheritance.
Avatar of chima

ASKER

thanks, more to come