Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce @UseTechnicalNames for the JUnitPlatform runner
Due to recent changes, technical names were previously used for test methods and their test classes instead of display names. This commit introduces a new @UseTechnicalNames annotation that allows one to opt-in for the usage of technical names instead of display names. If @UseTechnicalNames not directly present on the test class run via the JUnitPlatform runner, display names will be used by default. Closes #379
- Loading branch information
Showing
5 changed files
with
131 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
junit-platform-runner/src/main/java/org/junit/platform/runner/UseTechnicalNames.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2015-2016 the original author or authors. | ||
* | ||
* All rights reserved. This program and the accompanying materials are | ||
* made available under the terms of the Eclipse Public License v1.0 which | ||
* accompanies this distribution and is available at | ||
* | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
|
||
package org.junit.platform.runner; | ||
|
||
import static org.junit.platform.commons.meta.API.Usage.Maintained; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
import org.junit.platform.commons.meta.API; | ||
|
||
/** | ||
* {@code @UseTechnicalNames} specifies that <em>technical names</em> should be | ||
* used instead of <em>display names</em> when running a test suite via | ||
* {@code @RunWith(JUnitPlatform.class)}. | ||
* | ||
* <p>By default, <em>display names</em> will be used for test artifacts; however, | ||
* when the {@link JUnitPlatform} runner is used to execute tests with a build | ||
* tool such as Gradle or Maven, the generated test report often needs to include | ||
* the <em>technical names</em> of test artifacts — for example, fully | ||
* qualified class names — instead of shorter <em>display names</em> like | ||
* the simple name of a test class or a custom display name containing special | ||
* characters. To enable <em>technical names</em>, simply declare the | ||
* {@code @UseTechnicalNames} annotation alongside {@code @RunWith(JUnitPlatform.class)}. | ||
* | ||
* @since 1.0 | ||
* @see JUnitPlatform | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.TYPE) | ||
@Inherited | ||
@Documented | ||
@API(Maintained) | ||
public @interface UseTechnicalNames { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters