void (Description description, String methodName) { final List<List<Description>> parents = myParents.get(description); if (myCurrentTest != null && (parents == null || parents.isEmpty() || !parents.get(0).contains(myCurrentTest))) { if (!myWaitingQueue.containsKey(description)) { myWaitingQueue.put(description, new TestEvent()); return; } } myCurrentTest = description; final String classFQN = JUnit4ReflectionUtil.getClassName(description); List<Description> parentsHierarchy = new ArrayList<>(); if (parents != null && !parents.isEmpty()) { parentsHierarchy = parents.remove(0); } if (parentsHierarchy.isEmpty()) { parentsHierarchy = Collections.singletonList(Description.createSuiteDescription(classFQN)); } if (methodName == null) { methodName = getFullMethodName(description, parentsHierarchy.get(parentsHierarchy.size() - 1)); if (methodName == null) return; } int idx = 0; Description currentClass; Description currentParent; while (idx < myStartedSuites.size() && idx < parentsHierarchy.size()) { currentClass = myStartedSuites.get(idx); currentParent = parentsHierarchy.get(parentsHierarchy.size() - 1 - idx); if (isHierarchyDifferent(parents, currentClass, currentParent)) { break; } idx++; } for (int i = myStartedSuites.size() - 1; i >= idx; i--) { currentClass = myStartedSuites.remove(i); myPrintStream.println( "##teamcity[testSuiteFinished name='" + escapeName(getShortName(JUnit4ReflectionUtil.getClassName(currentClass))) + "']"); } for (int i = idx; i < parentsHierarchy.size(); i++) { final Description descriptionFromHistory = parentsHierarchy.get(parentsHierarchy.size() - 1 - i); final String fqName = JUnit4ReflectionUtil.getClassName(descriptionFromHistory); final String className = getShortName(fqName); if (!className.equals(myRootName)) { myPrintStream.println("##teamcity[testSuiteStarted name='" + escapeName(className) + "'" + getSuiteLocation(descriptionFromHistory, description, fqName) + "]"); } myStartedSuites.add(descriptionFromHistory); } myPrintStream.println("##teamcity[testStarted name='" + escapeName(methodName.replaceFirst("/", ".")) + "' " + NODE_NAMES_MANAGER.getTestLocation(description, classFQN, methodName) + "]"); myCurrentTestStart = currentTime(); }