[[junit-platform-suite-engine]]
=== JUnit Platform Suite Engine

The JUnit Platform supports the declarative definition and execution of suites of tests
from _any_ test engine using the JUnit Platform.

[[junit-platform-suite-engine-setup]]
==== Setup

In addition to the `junit-platform-suite-api` and `junit-platform-suite-engine` artifacts,
you need _at least one_ other test engine and its dependencies on the classpath. See
<<dependency-metadata>> for details regarding group IDs, artifact IDs, and versions.

[[junit-platform-suite-engine-setup-required-dependencies]]
===== Required Dependencies

* `junit-platform-suite-api` in _test_ scope: artifact containing annotations needed to
  configure a test suite
* `junit-platform-suite-engine` in _test runtime_ scope: implementation of the
  `TestEngine` API for declarative test suites

NOTE: Both of the required dependencies are aggregated in the `junit-platform-suite`
artifact which can be declared in _test_ scope instead of declaring explicit dependencies
on `junit-platform-suite-api` and `junit-platform-suite-engine`.

[[junit-platform-suite-engine-setup-transitive-dependencies]]
===== Transitive Dependencies

* `junit-platform-suite-commons` in _test_ scope
* `junit-platform-launcher` in _test_ scope
* `junit-platform-engine` in _test_ scope
* `junit-platform-commons` in _test_ scope
* `opentest4j` in _test_ scope

[[junit-platform-suite-engine-example]]
==== @Suite Example

By annotating a class with `@Suite` it is marked as a test suite on the JUnit Platform.
As seen in the following example, selector and filter annotations can then be used to
control the contents of the suite.

[source,java,indent=0]
----
include::{testDir}/example/SuiteDemo.java[tags=user_guide]
----

.Additional Configuration Options
NOTE: There are numerous configuration options for discovering and filtering tests in a
test suite. Please consult the Javadoc of the `{suite-api-package}` package for a full
list of supported annotations and further details.

==== @BeforeSuite and @AfterSuite

`@BeforeSuite` and `@AfterSuite` annotations can be used on methods inside a
`@Suite`-annotated class. They will be executed respectively before and after
all tests of the test suite.

[source,java,indent=0]
----
include::{testDir}/example/BeforeAndAfterSuiteDemo.java[tags=user_guide]
----
