Hello,

we are running jenkins version 1.463 and we execute a Junit test class
containing about 100.000 test cases. If I trigger a mouseover event
for a link of a failed test on the test results page (http://localhost:
8080/job/<jobname>/lastCompletedBuild/testReport/) a post request is
sent:

POST /job/<jobname>/lastCompletedBuild/testReport/<test-class>/<test-
case>/contextMenu

This post request causes that the method getCaseResult() of class
hudson.tasks.junit.ClassResult is called. This method contains a for-
loop over all test cases in the test class:

    public CaseResult getCaseResult(String name) {
        for (CaseResult c : cases) {
            if(c.getSafeName().equals(name))
                return c;
        }
        return null;
    }

In the for-loop the method getSafeName() is called, which calls
uniquifyName() of class hudson.tasks.test. In this method there is
another for-loop over all test cases of the test class:

   ...
   for (TestObject sibling : siblings) {
            if (sibling != this &&
uniquified.equals(UNIQUIFIED_NAMES.get(sibling))) {
                uniquified = base + '_' + ++sequence;
            }
        }
   ...

Therefore the inner for loop is called  (number of testcases) times
(number of testcases). For out test class the inner for-loop is
therefore called 10000000000 times. As a result the CPU goes to 100%
and Jenkins must be stopped.

Is there a possibility to improve getCaseResult() so that its
execution time scales linear in the numer of testcases?


Thomas

Reply via email to