You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+16-5Lines changed: 16 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,16 +10,27 @@ The main component of `mammoth` is utility functions for developing Gradle plugi
10
10
11
11
Mammoth provides test fixtures to enable functional testing of Gradle plugins. This architecture is designed for Java tests using JUnit 5, with the buildscripts for tested builds stored as classpath resources. This stands in contrast to Groovy functional tests, where the buildscript is written as a string directly in the test class.
`@GradleFunctionalTest` | Mark a test method as a functional test
18
+
`@GradleParameters` | Pass parameters to every Gradle invocation
19
+
`@TestVariant` | Declare a single variant of a tent, with a specific gradle version and extra parameters. Repeatable
20
+
`@TestVariantResource` | Declare a classpath resource to read additional variants from. Each line in the file is one variant, in the format `<version>[:<args...>]`
21
+
22
+
### Usage
23
+
13
24
<details>
14
25
<summary>Example</summary>
15
26
16
-
Assuming there are files at `src/test/resources/com/example/myplugin/simpleBuild/in/build.gradle.kts` and `src/test/resources/com/example/myplugin/simpleBuild/in/settings.gradle.kts`, the following sets up a simple test that will run on both Gradle 6.9 and 7.1:
27
+
Assuming there are files at `src/test/resources/com/example/myplugin/simpleBuild/in/build.gradle` and `src/test/resources/com/example/myplugin/simpleBuild/in/settings.gradle`, the following sets up a simple test that will run on both Gradle 6.9 and 7.1:
17
28
18
29
**com/example/myplugin/MyPluginTest.java**:
19
30
20
31
```java
21
32
/**
22
-
* A <em>meta-annotation containing our test configuration.</em>
33
+
* A <em>meta-annotation</em> containing our test configuration.
23
34
*/
24
35
@GradleFunctionalTest
25
36
@GradleParameters({"--warning-mode", "all", "--stacktrace"}) // parameters for all variants
@@ -37,10 +48,10 @@ public @interface MyPluginTest {
37
48
38
49
classMyPluginFunctionalTest {
39
50
40
-
@SpongeGradleFunctionalTest
51
+
@MyPluginTest
41
52
voidsimpleBuild(finalTestContextctx) {
42
-
ctx.copyInput("build.gradle.kts");
43
-
ctx.copyInput("settings.gradle.kts");
53
+
ctx.copyInput("build.gradle");
54
+
ctx.copyInput("settings.gradle");
44
55
45
56
finalBuildResult result = ctx.build("build"); // or anoher
0 commit comments