@@ -81,8 +81,6 @@ public void testRunFinished(final Result result) throws Exception {
8181 public void testStarted (final Description description ) throws Exception {
8282 final String uuid = testCases .get ();
8383 final TestResult result = createTestResult (uuid , description );
84- result .getLabels ().addAll (getLabels (description ));
85- getDisplayName (description ).ifPresent (result ::setName );
8684 getLifecycle ().scheduleTestCase (result );
8785 getLifecycle ().startTestCase (uuid );
8886 }
@@ -125,8 +123,6 @@ public void testIgnored(final Description description) throws Exception {
125123 testCases .remove ();
126124
127125 final TestResult result = createTestResult (uuid , description );
128- result .getLabels ().addAll (getLabels (description ));
129- getDisplayName (description ).ifPresent (result ::setName );
130126 result .setStatus (Status .SKIPPED );
131127 result .setStatusDetails (getIgnoredMessage (description ));
132128 result .setStart (System .currentTimeMillis ());
@@ -244,20 +240,28 @@ private StatusDetails getIgnoredMessage(final Description description) {
244240 }
245241
246242 private TestResult createTestResult (final String uuid , final Description description ) {
247- return new TestResult ()
243+ final String className = description .getClassName ();
244+ final String methodName = description .getMethodName ();
245+ final String name = Objects .nonNull (methodName ) ? methodName : className ;
246+ final String fullName = Objects .nonNull (methodName ) ? String .format ("%s.%s" , className , methodName ) : className ;
247+
248+ final TestResult testResult = new TestResult ()
248249 .withUuid (uuid )
249250 .withHistoryId (getHistoryId (description ))
250- .withName (description . getMethodName () )
251- .withFullName (String . format ( "%s.%s" , description . getClassName (), description . getMethodName ()) )
251+ .withName (name )
252+ .withFullName (fullName )
252253 .withLinks (getLinks (description ))
253254 .withLabels (
254255 new Label ().withName ("package" ).withValue (getPackage (description .getTestClass ())),
255- new Label ().withName ("testClass" ).withValue (description . getClassName () ),
256- new Label ().withName ("testMethod" ).withValue (description . getMethodName () ),
257- new Label ().withName ("suite" ).withValue (description . getClassName () ),
256+ new Label ().withName ("testClass" ).withValue (className ),
257+ new Label ().withName ("testMethod" ).withValue (name ),
258+ new Label ().withName ("suite" ).withValue (className ),
258259 new Label ().withName ("host" ).withValue (getHostName ()),
259260 new Label ().withName ("thread" ).withValue (getThreadName ())
260261 );
262+ testResult .getLabels ().addAll (getLabels (description ));
263+ getDisplayName (description ).ifPresent (testResult ::setName );
264+ return testResult ;
261265 }
262266
263267}
0 commit comments