Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » separating JUnit test files from source files
separating JUnit test files from source files [message #312171] Thu, 01 February 2007 17:02 Go to next message
Eclipse UserFriend
Originally posted by: sjannicelli.microwavedata.com

I'm working on a project in Eclipse. Originally all of our source files
and JUnit tests were in the same directory. I tried to separate out the
test files to a different directory. If the test files are moved away from
the source files, the test files no longer work.

Originally they were in the folder .../src/company/package/source.java and
.../src/company/package/test_source.java

When I move them to the file .../src/test/package/test_source.java I get
the error in Eclipse "The declared package "company.package" does not
match the expected package "test.package".

How do I set Eclipse so it doesn't declare a test.package? I need them to
be in the package company.package because the tests access protected
methods.

Thanks in advance
Re: separating JUnit test files from source files [message #312174 is a reply to message #312171] Thu, 01 February 2007 18:06 Go to previous messageGo to next message
Eclipse UserFriend
You should make separate src and test folders and add both of them to
'Source folders on build path' (right-click on the project, select
Properties>Java Build Path and choose the Source tab).
You have tried to make the nested source folders, but that is not
allowed in Eclipse.

Snjeza

Stacy wrote:
> I'm working on a project in Eclipse. Originally all of our source files
> and JUnit tests were in the same directory. I tried to separate out the
> test files to a different directory. If the test files are moved away
> from the source files, the test files no longer work.
> Originally they were in the folder .../src/company/package/source.java
> and ../src/company/package/test_source.java
>
> When I move them to the file .../src/test/package/test_source.java I get
> the error in Eclipse "The declared package "company.package" does not
> match the expected package "test.package".
>
> How do I set Eclipse so it doesn't declare a test.package? I need them
> to be in the package company.package because the tests access protected
> methods.
>
> Thanks in advance
>
Re: separating JUnit test files from source files [message #312185 is a reply to message #312174] Fri, 02 February 2007 08:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sjannicelli.microwavedata.com

Snjezana Peco wrote:

> You should make separate src and test folders and add both of them to
> 'Source folders on build path' (right-click on the project, select
> Properties>Java Build Path and choose the Source tab).
> You have tried to make the nested source folders, but that is not
> allowed in Eclipse.

> Snjeza


Thank you for your reply. I'm sorry. I am a bit confused at what you are
suggesting I do.

Right now I have my source and test files in the directory: D:\Documents
and Settings\myName\workspace\myProject\ and the Eclipse project source
file settings are currently myProject (include all, exclude none)

So I'd love to separate all the JUnit test files into another directory
maybe D:\Documents and Settings\myName\workspace\Test

I tried making a new project for D:\Documents and
Settings\myName\workspace\Test and adding D:\Documents and
Settings\myName\workspace\myProject\ as a source file for that project. I
still got the error ""The declared package "company.package" does not
match the expected package "package".
Re: separating JUnit test files from source files [message #312188 is a reply to message #312185] Fri, 02 February 2007 09:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: krzysztofHMMMMdaniel.gmail.com

Hi Stacy,

Please do following steps.

Click your project, then select new->source folder, and name it f.e.
application.

Repeat the action and create new source folder called tests.

Now try to move in one folder your classes, into other tests.

Please let me know if it helps.

Regards,
--
Chris
Re: separating JUnit test files from source files [message #312191 is a reply to message #312188] Fri, 02 February 2007 10:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sjannicelli.microwavedata.com

Thank you! This worked perfectly for me, so far. :)

I very much appreciate the help!

Stacy
Re: separating JUnit test files from source files [message #312245 is a reply to message #312191] Sat, 03 February 2007 19:02 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse5.rizzoweb.com

Stacy wrote:
> Thank you! This worked perfectly for me, so far. :)
>
> I very much appreciate the help!

Do you actually understand what you did, though? If not, you'll
undoubtedly run into further problems.

I strongly suggest you open the Eclipse Help Contents and navigate to
the Java Development User Guide > Getting Started, and go through the
tutorials there. Otherwise you will find yourself bumping your head
against other issues in the future.

Hope this helps,
Eric
Previous Topic:[DataBinding] What methods is BeansObservables looking for in my model?
Next Topic:No Java Project
Goto Forum:
  


Current Time: Thu Jul 17 20:06:09 EDT 2025

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

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

Back to the top