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.
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.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
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
Extending or adding Fixture
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
concrete classes, where there is no multiple inheritance.
ASKER
thanks, more to come
More on how to write testcase http://www.thekirschners.com/articles/how-to-write-test-cases.html