Tagging and Filtering

This version is still in development and not considered stable yet.
For the latest stable release, please see JUnit 6.1.3!

Test classes and methods can be tagged via the @Tag annotation. Those tags can later be used to filter test discovery and execution. Please refer to the Tags section for more information about tag support in the JUnit Platform.

  • Java

  • Kotlin

import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Tag("fast")
@Tag("model")
class TaggingDemo {

	@Test
	@Tag("taxes")
	void testingTaxCalculation() {
	}

}
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test

@Tag("fast")
@Tag("model")
class TaggingDemo {
    @Test
    @Tag("taxes")
    fun testingTaxCalculation() {
    }
}
See Meta-Annotations and Composed Annotations for examples demonstrating how to create custom annotations for tags.