facebook

JUnit tests in a Struts-based webapp

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #222758 Reply

    jccartwright
    Member

    Hello All,

    what is the preferred setup for managing JUnit tests in a webapp? I would like to have manage the business object unit tests along with the rest of the project.

    Previously, I used ant to manage the project and had a directory struture like:

    /project
    /src
    /java (java src heirarchy. struts classes as well as business objects
    /test (parallel test package heirarchy)
    /resource

    /build (generated webapp)
    /WEB-INF
    /classes
    /lib

    /test (contains test classes and output)

    Is a similar heirarchy supported/recommended using myeclipse?

    Thanks!

    — john

    #222763

    Riyad Kalla
    Member

    Actually no, the best setup for MyEclipse (and any other IDE as well) is to use an exploded WAR format, basically:

    
    /<Project Root>
      /src <Java Source>
      /docs <License docs, readme, etc.>
        /api <Generated Javadoc>
      /webroot <Web root set in MyEclipse>
        /META-INF <Any context.xml or important files>
        /WEB-INF
          /classes <Output dir from source dir>
          /lib <All libraries your app needs go here>
    

    You can keep your build script in your project root. You can do the test dir if you still want it and feel free to add any more dirs you need, but the ones above will give you the best out-of-box experience since it directly maps to the web application format specified by Sun, so most all IDEs will pick these layout up right away without a problem.

    #222764

    jccartwright
    Member

    @support-rkalla wrote:

    Actually no, the best setup for MyEclipse (and any other IDE as well) is to use an exploded WAR format, basically:

    
    /<Project Root>
      /src <Java Source>
      /docs <License docs, readme, etc.>
        /api <Generated Javadoc>
      /webroot <Web root set in MyEclipse>
        /META-INF <Any context.xml or important files>
        /WEB-INF
          /classes <Output dir from source dir>
          /lib <All libraries your app needs go here>
    

    You can keep your build script in your project root. You can do the test dir if you still want it and feel free to add any more dirs you need, but the ones above will give you the best out-of-box experience since it directly maps to the web application format specified by Sun, so most all IDEs will pick these layout up right away without a problem.

    Hi Riyad,

    thanks for your prompt reply. Doesn’t this “exploded WAR format” end up with the all the test src mingled with the other src, and all the test classes (which one doesn’t want in the webapp distribution war) mixed in with the other classes?

    This seems to be different than the structure Maven uses by default – is this a problem? Or to digress a little, does Maven coexist with MyEclipse comfortably? I have the mevenide plugin for eclipse, but it’s not clear to me how they work together.

    Thanks again for your help and advice – I’m obviously a newcomer to eclipse/MyEclipse.

    — john

    #222765

    Riyad Kalla
    Member

    Doesn’t this “exploded WAR format” end up with the all the test src mingled with the other src, and all the test classes (which one doesn’t want in the webapp distribution war) mixed in with the other classes?

    Yes the way I have it above it does, you can create another source dir from the project root like /test to contain just the test classes, the key is the structure of the webroot folder.

    This seems to be different than the structure Maven uses by default – is this a problem?

    I don’t know what Maven uses by default, but ME is one of the more (most?) flexible IDEs out there, you can probably get it working with some tinkering.

    does Maven coexist with MyEclipse comfortably? I have the mevenide plugin for eclipse, but it’s not clear to me how they work together.

    Me neither, but I know Maven integration is somewhere on our Todo list… one of our developers is the creator of a MavenIDE plugin for Eclipse.

    #232234

    I vote for Maven integration!

    #232590

    Alex Hamer
    Member

    Hi all,

    Are you currently using Maven? How did you setup your directory structure in MyEclipse? Did you follow the Maven directory convention? Im still debating if I can use Maven for my upcoming project as Im not too sure of the benefit of using it along side MyEclipse. Any advice would be great.

    jade

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: JUnit tests in a Struts-based webapp

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