maven-idea-plugin generates projects that do not work properly with JUnit 4.
----------------------------------------------------------------------------

                 Key: MNG-2950
                 URL: http://jira.codehaus.org/browse/MNG-2950
             Project: Maven 2
          Issue Type: Bug
          Components: Plugins and Lifecycle
    Affects Versions: 2.0.6
         Environment: Windows XP Pro,
maven-idea-plugin V 2.1-SNAPSHOT
            Reporter: Kevan Dunsmore
            Priority: Critical
         Attachments: testbug.zip

Generating a project using the maven-idea-plugin results in project files that 
cause Idea to be unable to execute Junit 4 tests where the test classes are 
POJOs in a hierarchy.

For example, if I have the following JUnit 4 test classes, Idea does not 
recognize the valid test hierarchy:

public abstract class BaseTest {
    @Test
    public void foo() {
        // Test code here.
    }
}

public class MySpecializedTest extends BaseTest { }

1. Right clicking on MySpecializedTest does not show the "Run 
MySpecializedTest" test context menu option.
2. Executing all tests in the package returns an error stating that no test 
classes could be  found.

If you change MySpecializedTest to this:

public class MySpecializedTest extends BaseTest {
    @Test
    public void bar() {
        // Specialized test code
    }
}

Then Idea finds the MySpecializedTest.bar() test and executes it but does not 
execute the inherited foo() test case.

This problem is caused by the inclusion of the following element in the ipr 
file:

  <component name="JUnitProjectSettings">
    <option name="TEST_RUNNER" value="UI" />
  </component>

After I manually removed the element (actually commented it out) and restarted 
Idea, it was able to detect the correct number of tests in the test class 
hierarchy.


Please find attached to this issue a zip file containing a project illustrating 
this bug. I have modified the .ipr file to comment-out the problem element 
shown above. As such, the project is configured such that Idea will correctly 
identify the JUnit tests. To view the bug behavior, open the .ipr file and 
uncomment the element (it's the first one in the file under the root "project" 
element).


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to