Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Best Practices re JUnit
Best Practices re JUnit [message #515394] Thu, 18 February 2010 11:32 Go to next message
Eclipse UserFriend
I would like some advice on the best way to organize my JUnit test classes in Eclipse 3.5.1. Should a given JUnit test class be in the same package as the class that it is testing? Or should it be in a different package within the same project? Should it be in the same project as the one being tested or perhaps in a separate project?

I'm not having any trouble writing and executing my JUnit tests; I'm just not sure about the best way to organize them within Eclipse.

--
Rhino
Re: Best Practices re JUnit [message #515547 is a reply to message #515394] Fri, 19 February 2010 05:42 Go to previous messageGo to next message
Eclipse UserFriend
Reinhardt Christiansen wrote:
> I would like some advice on the best way to organize my JUnit test
> classes in Eclipse 3.5.1. Should a given JUnit test class be in the
> same package as the class that it is testing? Or should it be in a
> different package within the same project? Should it be in the same
> project as the one being tested or perhaps in a separate project?
In Eclipse we use separate projects because it gives a clear separation
and makes building the (runtime) product easier.

Dani
>
> I'm not having any trouble writing and executing my JUnit tests; I'm
> just not sure about the best way to organize them within Eclipse.
>
> --
> Rhino
Re: Best Practices re JUnit [message #515593 is a reply to message #515547] Fri, 19 February 2010 08:50 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for that information, Dani.

What do you do about package names for test cases? For example, if the package being tested is com.foo.baz, does the package for the test cases have the same name or does it get a different name, something like com.foo.baz.test?

--
Rhino
Re: Best Practices re JUnit [message #515601 is a reply to message #515593] Fri, 19 February 2010 08:52 Go to previous messageGo to next message
Eclipse UserFriend
Reinhardt Christiansen wrote:
> Thank you for that information, Dani.
>
> What do you do about package names for test cases? For example, if the
> package being tested is com.foo.baz, does the package for the test
> cases have the same name or does it get a different name, something
> like com.foo.baz.test?
See http://wiki.eclipse.org/Naming_Conventions

Dani
>
> --
> Rhino
Re: Best Practices re JUnit [message #515605 is a reply to message #515601] Fri, 19 February 2010 09:16 Go to previous message
Eclipse UserFriend
I see! So my test package would be com.foo.tests.baz and it would be in its own project.

Thank you very much, Dani!

--
Rhino
Previous Topic:How to highlight reconciliation error in the texteditor
Next Topic:Viewing MANIFEST files for JARs in my build path
Goto Forum:
  


Current Time: Sun Mar 16 00:12:43 EDT 2025

Powered by FUDForum. Page generated in 0.03875 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top