facebook

MyEclipse wrongly trying to use JUnit 4 instead of JUnit 3.8

  1. MyEclipse Archived
  2.  > 
  3. Bugs
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #265455 Reply

    I have MyEclipse’s build path set up to use JUnit 3.8. However, when I try to run a JUnit Test Class OR Test Suite, the following error message pops up:

    Cannot find ‘org.junit.Test’ on project build path. JUnit 4 tests can only be run if JUnit 4 is on the build path.

    Below is my .classpath file contents and my system setup. Thanks for your help.

    SS

    ——- .classpath file contents ————————
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <classpath>
    <classpathentry kind=”lib” path=”extralib/junit-3.8.1.jar”/>
    <classpathentry kind=”src” path=”src”/>
    <classpathentry kind=”src” path=”tstsrc”/>
    <classpathentry kind=”con” path=”org.eclipse.jdt.launching.JRE_CONTAINER”/>
    <classpathentry kind=”con” path=”com.genuitec.eclipse.j2eedt.core.J2EE14_CONTAINER”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/jstl.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/standard.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/ojdbc14.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/log4j-1.2.14.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/commons-beanutils.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/commons-collections.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/commons-digester.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/commons-fileupload.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/commons-lang.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/commons-logging.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/commons-validator.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/jakarta-oro.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/struts-legacy.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/struts.jar”/>
    <classpathentry kind=”lib” path=”WebRoot/WEB-INF/lib/c3p0-0.9.1.jar”/>
    <classpathentry kind=”output” path=”WebRoot/WEB-INF/classes”/>
    </classpath>

    ——- End of .classpath file contents —————-

    ——- System setup ———————————-

    *** Date:
    Thursday, February 1, 2007 11:12:49 AM CST

    ** System properties:
    OS=WindowsXP
    OS version=5.1
    Java version=1.5.0_08

    *** MyEclipse details:
    MyEclipse Enterprise Workbench
    Version: 5.1.0 GA
    Build id: 20061111-5.1.0-GA

    *** Eclipse details:
    MyEclipse Enterprise Workbench

    Version: 5.1.0 GA
    Build id: 20061111-5.1.0-GA

    Eclipse Graphical Editing Framework

    Version: 3.2.1.v20060921
    Build id: 20060921-1617

    Eclipse Platform

    Version: 3.2.1.r321_v20060921-b_XVA-INSQSyMtx
    Build id: M20060921-0945

    Eclipse RCP

    Version: 3.2.1.r321_v20060801-2ekW2BxmcpPUOoq
    Build id: M20060921-0945

    Eclipse Java Development Tools

    Version: 3.2.1.r321_v20060905-R4CM1Znkvre9wC-
    Build id: M20060921-0945

    Eclipse Project SDK

    Version: 3.2.1.r321_v20060801-tQ1w49KnTArT0FZ
    Build id: M20060921-0945

    Eclipse startup command=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    C:\Program Files\MyEclipse Enterprise Workbench 5.1.0 GA\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    754_88
    -data
    C:\development\eclipse\workspace_Warranty
    -vm
    C:\Program Files\MyEclipse Enterprise Workbench 5.1.0 GA\jre\bin\javaw.exe

    ————- End of System Setup —————————–

    #265480 Reply

    Riyad Kalla
    Member

    If you remove your JUnit library and instead going to the Libraries tab and hit Add Library, then select the JUnit library, you should be able to add the 3.8.1 libraries from there and I believe that should let Eclipse no what version of JUnit you will be using.

    #265482 Reply

    I tried what you said and still get the same error. Thanks for your help.

    SS

    #265484 Reply

    Riyad Kalla
    Member

    SS,
    I created a sample web project with Struts and JSTL capabilities added along with JUnit 3.8.1 libraries added. I created a single class and a single test case and everything seems to run fine. Can you download and import this project and try and run the MyClassTest class and see if things work? You can grab it here.

    #265487 Reply

    We actually tried creating a new project and going from there. The new project doesn’t have any problems running JUnit tests. It uses JUnit-3.8 and everything works great.

    We are trying to avoid having to migrate the code in our exisiting project to a new project.

    Anything else we can try? Could there be a place in one of the MyEclipse workbench property files that JUnit 4 is specified in?

    Thanks for your help.

    SS

    #265513 Reply

    Riyad Kalla
    Member

    SS,
    I think what is going on is just a simple configuration mishap. If you click the down arrow on your Run menu, and go to Run As…, you can select your run configuration for your Ant test case, and on the first page you select the Runner (JUnit 3/4) that you want to use. Make sure that is set to 3.

    #265523 Reply

    Riyad,
    that did it! We were spinning our wheels quite a bit with this. I never noticed that setting being there. Thanks for your help!

    SS

    #265529 Reply

    Riyad Kalla
    Member

    SS, I’m glad that helped.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: MyEclipse wrongly trying to use JUnit 4 instead of JUnit 3.8

You must be logged in to post in the forum log in