NullPointerException in ConcurrentReporterManager, falsely report of "No tests 
were executed!"
----------------------------------------------------------------------------------------------

                 Key: SUREFIRE-744
                 URL: http://jira.codehaus.org/browse/SUREFIRE-744
             Project: Maven Surefire
          Issue Type: Bug
          Components: Junit 4.7+ (parallel) support
    Affects Versions: 2.8.1
            Reporter: Aslak Knutsen
         Attachments: MavenSurefireJUnit47RunnerTestCase.java

See SUREFIRE-629, same result, just this time the assumption is on the use of 
multiple @Ignore test cases

JUnitCoreRunListener.fillTestCountMap prefill a Map with all the Descriptions 
for this testrun, but it gets a bit confused when multiple tests use @Ignore on 
Class Level. 

JUnit will report these as Description.isTest because they have no children, 
but they are not, all their children are ignored.
So these are added as Methods to some other Class, which means the TestSet 
Class lookup on testSkipped results in null.


a possible crude fix would be:

{code:title=org.apache.maven.surefire.junitcore.JUnitCoreRunListener}
    private void fillTestCountMap( Description description )
    {
        final ArrayList<Description> children = description.getChildren();

        TestSet testSet = new TestSet( description );
        Class<?> itemTestClass = null;
        for ( Description item : children )
        {
            if ( item.isTest() && item.getMethodName() != null)
            {
                testSet.incrementTestMethodCount();
                if ( itemTestClass == null )
                {
                    itemTestClass = item.getTestClass();
                }
            }
            else if ( item.getChildren().size() > 0 )
            {
                fillTestCountMap( item );
            }
            else 
            {
                classMethodCounts.put( item.getClassName(), testSet );
            }
        }
        if ( itemTestClass != null )
        {
            classMethodCounts.put( itemTestClass.getName(), testSet );
        }
    }
{code}

-- 
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