Skip to content

Commit 6227fd6

Browse files
committed
Add docs on client tests
1 parent bc4d3e4 commit 6227fd6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/CREATING_TESTS.MD

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ To write a test, you need to have a test world. But this needs to be done in the
99
To run the testing environment, run the gradle task `runTestClient`. This will start a new instance of Minecraft with the testing environment.
1010
That includes the ability to run tests, import and export tests using the `/cctest` and the `/test` command.
1111

12-
After the tests are created, you can use the gradle task `runTestServer` to start the game test server which then runs all the test.
12+
After the tests are created, you can use the gradle task `runGameTestServer` to start the game test server which then runs all the test.
1313
To test a single test, you can also use `/test run <test_name>` in the testing environment.
1414

1515
### Building your test structure
@@ -120,4 +120,14 @@ Here is an example with our note block test
120120
}
121121
```
122122

123+
### Client Tests
124+
125+
Similar to the common game tests described above, you can also write tests that will be executed on the client.
126+
To define a client test, use the annotation `@ClientGameTest` instead of `@GameTest`. The rest of the process is the same.
127+
In the test function, you can then use `thenOnClient { ... }` to run code on the client.
128+
129+
To run the client tests automatically, use the gradle task `runGameTestClient`.
130+
131+
---
132+
123133
For more examples, you can also check how the tests from CC work [here](https://github.com/cc-tweaked/CC-Tweaked/tree/mc-1.19.2/src/testMod/kotlin/dan200/computercraft/gametest).

0 commit comments

Comments
 (0)