Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Maven Integration (M2E) » Running test case in Eclipse?
Running test case in Eclipse? [message #13442] Thu, 24 July 2008 01:56 Go to next message
Eclipse UserFriend
Originally posted by: barbariansouth.ymail.com

Hello all,

I've been using Maven for some time and new to the m2e plugin..... After
I installing the plugin and make my project maven enabled, I notice that
when I code some test case and want to run directly in eclipse, the
binaries of the test case seems not re-compiled and the test is executed
using the old version.... I need to manually run the "mvn install" or
something like that before my test case is refreshed during the test case
execution....

Is there any way to make my test case run with the latest binaries?
Thanks in advance...
Re: Running test case in Eclipse? [message #13462 is a reply to message #13442] Thu, 24 July 2008 02:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: igor.ifedorenko.com

Barbarian,

Assuming you're using junit, you should be able to right-click on the
project or individual test, Run As->JUnit Test. This will construct
proper Maven test classpath (see [1] if you're interested in details)
but use Eclipse JUnit UI to show test execution progress and results.

Generally, m2e does not automatically package/installs the projects,
but, uses project output folders instead. We call it "workspace artifact
resolution". It is enabled by default for all actions performed by m2e
directly (compile classpath resolution, project import, run as junit
test, etc) but needs to be explicitly enabled for Run As Maven ...
actions (see [2]).

[1] http://docs.codehaus.org/display/M2ECLIPSE/Runtime+classpath
[2]
http://docs.codehaus.org/display/M2ECLIPSE/Developing+and+de bugging+Maven+plugins

Barbarian South wrote:
> Hello all,
>
> I've been using Maven for some time and new to the m2e plugin.....
> After I installing the plugin and make my project maven enabled, I
> notice that when I code some test case and want to run directly in
> eclipse, the binaries of the test case seems not re-compiled and the
> test is executed using the old version.... I need to manually run the
> "mvn install" or something like that before my test case is refreshed
> during the test case execution....
>
> Is there any way to make my test case run with the latest binaries?
> Thanks in advance...
>
Re: Running test case in Eclipse? [message #13483 is a reply to message #13462] Thu, 24 July 2008 07:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: barbariansouth.ymail.com

I am using Junit as you assumed but without luck things seems don't
work.... Let me try from scratch.......

1. I did a mvn clean on my project manually
2. I removed all eclipse project's files (.settings / .classpath / etc...)
3. I right-click on the package-explorer and select import to import my
maven project
4. I de-selected "seperate projects for modules" (so that all sub-modules
are in the same project) and "resolve workspace project"
5. After the maven project is ready, I right-click on some test case and
run as junit test (tests are under the folder {submodule}/src/test/java)
6. The test failed with the error that it cannot found a file that were
supposed to be in {submodule}/src/main/resources.....

I tried the above steps with a single module (without submodules) and it
failed too........ any help would be appreciated....
Re: Running test case in Eclipse? [message #13504 is a reply to message #13483] Thu, 24 July 2008 07:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: barbariansouth.ymail.com

In addition, I am using Eclipse Europa 3.3.2

Barbarian South wrote:

> I am using Junit as you assumed but without luck things seems don't
> work.... Let me try from scratch.......

> 1. I did a mvn clean on my project manually
> 2. I removed all eclipse project's files (.settings / .classpath / etc...)
> 3. I right-click on the package-explorer and select import to import my
> maven project
> 4. I de-selected "seperate projects for modules" (so that all sub-modules
> are in the same project) and "resolve workspace project"
> 5. After the maven project is ready, I right-click on some test case and
> run as junit test (tests are under the folder {submodule}/src/test/java)
> 6. The test failed with the error that it cannot found a file that were
> supposed to be in {submodule}/src/main/resources.....

> I tried the above steps with a single module (without submodules) and it
> failed too........ any help would be appreciated....
Re: Running test case in Eclipse? [message #13524 is a reply to message #13504] Thu, 24 July 2008 15:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: igor.ifedorenko.com

Can you please open bug report in JIRA [1] and provide sample project
that demonstrates the problem? [2] describes what information we
generally would like to see in a bug report.

In the mean time, you'll likely get better results with separate
projects for modules (may have to run clean build after import, to make
sure all resources are filtered/copied). Separate projects for modules
is our recommended way to work with multi-module projects as it more
closely matches behaviour of maven CLI. For example, individual modules
will have proper compile classpath, which is not possible with one
project for all modules. Likewise, individual modules can have different
eclipse natures/builders to match their pom.xml, which is not possible
for one big project.

[1] http://jira.codehaus.org/browse/MNGECLIPSE
[2] http://docs.codehaus.org/display/M2ECLIPSE/Reporting+Issues

Barbarian South wrote:
> In addition, I am using Eclipse Europa 3.3.2
>
> Barbarian South wrote:
>
>> I am using Junit as you assumed but without luck things seems don't
>> work.... Let me try from scratch.......
>
>> 1. I did a mvn clean on my project manually
>> 2. I removed all eclipse project's files (.settings / .classpath /
>> etc...)
>> 3. I right-click on the package-explorer and select import to import
>> my maven project
>> 4. I de-selected "seperate projects for modules" (so that all
>> sub-modules are in the same project) and "resolve workspace project"
>> 5. After the maven project is ready, I right-click on some test case
>> and run as junit test (tests are under the folder
>> {submodule}/src/test/java)
>> 6. The test failed with the error that it cannot found a file that
>> were supposed to be in {submodule}/src/main/resources.....
>
>> I tried the above steps with a single module (without submodules) and
>> it failed too........ any help would be appreciated....
>
>
Re: Running test case in Eclipse? [message #13543 is a reply to message #13524] Thu, 24 July 2008 15:32 Go to previous message
Eclipse UserFriend
Originally posted by: barbariansouth.ymail.com

I'll try to create one when I finished my task in hand. Thanks so far.
Previous Topic:stable dev build 0.9.5.20080627-1151 is published
Next Topic:How to add Eclipse marker on file when Maven build failed ?
Goto Forum:
  


Current Time: Thu Apr 25 16:36:38 GMT 2024

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

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

Back to the top