Skip to content

Commit ca3745f

Browse files
committed
Update some docs still referencing Sputnik and JUnit runner and clarify situation of Jupiter extensions
1 parent 9c6342c commit ca3745f

4 files changed

Lines changed: 54 additions & 15 deletions

File tree

docs/extensions.adoc

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,28 @@ tasks.named("test", Test) {
786786

787787
== Third-Party Extensions
788788

789-
You can find a list of third-party extensions in the https://github.com/spockframework/spock/wiki/Third-Party-Extensions[Spock Wiki].
789+
You can find a list with some third-party extensions in the https://github.com/spockframework/spock/wiki/Third-Party-Extensions[Spock Wiki].
790+
This list is neither maintained nor curated by the Spock maintainers. It is also not necessarily complete, so you might
791+
find further Spock extensions through web searches or other means. It is a community-driven page where
792+
anyone can list Spock extensions they wrote or found.
793+
794+
[NOTE]
795+
--
796+
JUnit Jupiter is a separate test engine also running on JUnit Platform and thus is a sibling of the Spock engine.
797+
Extensions written for JUnit Jupiter do _not_ work in Spock specifications out of the box. Often terms are mixed up and
798+
some extension says it is for JUnit 5+, actually meaning it is for JUnit Jupiter, as there are no generic JUnit Platform
799+
extensions. If you want to use an extension written for JUnit Jupiter, you can check whether the project also provides
800+
a Spock extension, if not ask them to also provide a Spock extension, search for an alternative extension that supports
801+
Spock, or port the Jupiter extension to being a Spock extension yourself.
802+
803+
There is also at least one 3rd party extension that as of this writing provides a partly functioning integration of
804+
JUnit Jupiter extensions within Spock specifications. This extension though is neither maintained, nor recommended,
805+
nor discouraged by the Spock maintainers. It can eventually make some JUnit Jupiter extensions work within Spock specifications,
806+
but it is always preferable to instead use a native Spock extension. Often porting a JUnit Jupiter extension to also support
807+
Spock is not a big effort, so you might strongly consider to request a port by the extension maintainer or contribute
808+
a port to its project.
809+
--
810+
790811

791812
== Writing Custom Extensions
792813

docs/introduction.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include::include.adoc[]
44
image::images/spock-main-logo.png[Spock Logo, align=center, width=20%]
55

66
Spock is a testing and specification framework for Java and Groovy applications. What makes it stand out from the crowd
7-
is its beautiful and highly expressive specification language. Thanks to its JUnit runner, Spock is compatible with most
8-
IDEs, build tools, and continuous integration servers. Spock is inspired from https://junit.org/[JUnit],
7+
is its beautiful and highly expressive specification language. Thanks to being a JUnit Platform engine, Spock is compatible
8+
with most IDEs, build tools, and continuous integration servers. Spock is inspired from https://junit.org/[JUnit],
99
https://www.jmock.org/[jMock], https://rspec.info/[RSpec], https://groovy-lang.org/[Groovy], https://scala-lang.org/[Scala],
1010
https://en.wikipedia.org/wiki/Vulcan_(Star_Trek)[Vulcans], and other fascinating life forms.

docs/parallel_execution.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ See <<extensions.adoc#spock-configuration-file, Spock Configuration File>> for g
2020
include::{sourcedir}/parallel/ParallelConfigDoc.groovy[tag=enable]
2121
----
2222

23-
NOTE: JUnit Jupiter also supports https://junit.org/junit5/docs/5.7.0/user-guide/#writing-tests-parallel-execution[parallel execution], both rely on the JUnit Platform implementation, but function independently of each other.
23+
NOTE: JUnit Jupiter also supports https://junit.org/junit5/docs/5.7.0/user-guide/#writing-tests-parallel-execution[parallel execution], both rely on the JUnit Platform implementation, but function independently of each other.
2424
If you enable parallel execution in Spock it won't affect Jupiter and vice versa.
2525
The JUnit Platform executes the test engines (Spock, Jupiter) sequentially, so there should not be any interference between engines.
2626

docs/spock_primer.adoc

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ To learn more about unit testing, go to https://en.wikipedia.org/wiki/Unit_testi
1717

1818
Let's start with a few definitions: Spock lets you write https://en.wikipedia.org/wiki/Specification_by_example[_specifications_]
1919
that describe expected _features_ (properties, aspects) exhibited by a system of interest. The system of interest could be
20-
anything between a single class and a whole application, and is also called the _system under specification or SUS_.
20+
anything between a single class and a whole application, and is also called the _system under specification_ or _SUS_.
2121
The description of a feature starts from a specific snapshot of the SUS and its collaborators; this snapshot is called the feature's _fixture_.
2222

2323
The following sections walk you through all building blocks of which a Spock specification may be composed. A typical
@@ -48,9 +48,9 @@ A specification is represented as a Groovy class that extends from `spock.lang.S
4848
usually relates to the system or system operation described by the specification. For example, `CustomerSpec`,
4949
`H264VideoPlayback`, and `ASpaceshipAttackedFromTwoSides` are all reasonable names for a specification.
5050

51-
Class `Specification` contains a number of useful methods for writing specifications. Furthermore it instructs JUnit to
52-
run specification with `Sputnik`, Spock's JUnit runner. Thanks to Sputnik, Spock specifications can be run by most modern
53-
Java IDEs and build tools.
51+
Class `Specification` contains a number of useful methods for writing specifications. Furthermore it marks the specification
52+
as `@Testable`, which instructs tools that only look at the source code - like typically IDEs and similar - that this
53+
class is something that executes tests via a JUnit Platform engine.
5454

5555
== Fields
5656

@@ -841,20 +841,38 @@ block descriptions are enhanced diagnostic messages, and textual reports that ar
841841

842842
As we have seen, Spock offers lots of functionality for writing specifications. However, there always comes a time
843843
when something else is needed. Therefore, Spock provides an interception-based extension mechanism. Extensions are
844-
activated by annotations called _directives_. Currently, Spock ships with the following directives:
844+
activated by annotations called _directives_. Currently, Spock ships - among others - with the following directives:
845845

846846
[horizontal]
847847
`@Timeout`:: Sets a timeout for execution of a feature or fixture method.
848848

849849
`@Ignore`:: Ignores any feature method carrying this annotation.
850850

851-
`@IgnoreRest`:: Any feature method carrying this annotation will be executed, all others will be ignored. Useful for quickly running just a single method.
851+
`@IgnoreRest`:: Any feature method carrying this annotation will be executed, all others will be ignored. Useful for quickly running just a few features.
852852

853853
`@FailsWith`:: Expects a feature method to complete abruptly. `@FailsWith` has two use cases: First, to document known bugs that cannot
854854
be resolved immediately. Second, to replace exception conditions in certain corner cases where the latter cannot be
855855
used (like specifying the behavior of exception conditions). In all other cases, exception conditions are preferable.
856856

857-
Go to the <<extensions.adoc#extensions,Extensions>> chapter to learn how to implement your own directives and extensions.
857+
Go to the <<extensions.adoc#extensions,Extensions>> chapter to learn how to implement your own directives and extensions,
858+
to learn where to find some of the 3rd party extensions, and to learn about all built-in extensions and directives.
859+
860+
[NOTE]
861+
--
862+
JUnit Jupiter is a separate test engine also running on JUnit Platform and thus is a sibling of the Spock engine.
863+
Extensions written for JUnit Jupiter do _not_ work in Spock specifications out of the box. Often terms are mixed up and
864+
some extension says it is for JUnit 5+, actually meaning it is for JUnit Jupiter, as there are no generic JUnit Platform
865+
extensions. If you want to use an extension written for JUnit Jupiter, you can check whether the project also provides
866+
a Spock extension, if not ask them to also provide a Spock extension, search for an alternative extension that supports
867+
Spock, or port the Jupiter extension to being a Spock extension yourself.
868+
869+
There is also at least one 3rd party extension that as of this writing provides a partly functioning integration of
870+
JUnit Jupiter extensions within Spock specifications. This extension though is neither maintained, nor recommended,
871+
nor discouraged by the Spock maintainers. It can eventually make some JUnit Jupiter extensions work within Spock specifications,
872+
but it is always preferable to instead use a native Spock extension. Often porting a JUnit Jupiter extension to also support
873+
Spock is not a big effort, so you might strongly consider to request a port by the extension maintainer or contribute
874+
a port to its project.
875+
--
858876

859877
== Comparison to JUnit
860878

@@ -864,10 +882,10 @@ Although Spock uses a different terminology, many of its concepts and features a
864882
|Spock |JUnit
865883

866884
|Specification |Test class
867-
|`setup()` |`@Before`
868-
|`cleanup()` |`@After`
869-
|`setupSpec()` |`@BeforeClass`
870-
|`cleanupSpec()` |`@AfterClass`
885+
|`setup()` |`@Before` / `@BeforeEach`
886+
|`cleanup()` |`@After` / `@AfterEach`
887+
|`setupSpec()` |`@BeforeClass` / `@BeforeAll`
888+
|`cleanupSpec()` |`@AfterClass` / `@AfterAll`
871889
|Feature |Test
872890
|Feature method |Test method
873891
|Data-driven feature |Theory

0 commit comments

Comments
 (0)