Debian Codegraph @

docpages/advanced_reference/unit_tests.md

raw symbols SCIP
1 \page unit-tests Unit Tests
2
3 ## Running Unit Tests
4
5 If you are adding functionality to D++, make sure to run unit tests. This makes sure that the changes do not break anything. All pull requests must pass all unit tests before merging.
6
7 Before running test cases, create a test server for your test bot. You should:
8
9 * Make sure that the server only has you and your test bot, and no one else
10 * Give your bot the administrator permission
11 * Enable community for the server
12 * Make an event
13 * Create at least one voice channel
14 * Create at least one text channel
15
16 Then, set the following variables to the appropriate values. (Below is a fake token, don't bother trying to use it)
17
18 ```bash
19 export DPP_UNIT_TEST_TOKEN="ODI2ZSQ4CFYyMzgxUzkzzACy.HPL5PA.9qKR4uh8po63-pjYVrPAvQQO4ln"
20 export TEST_GUILD_ID="907951970017480704"
21 export TEST_TEXT_CHANNEL_ID="907951970017480707"
22 export TEST_VC_ID="907951970017480708"
23 export TEST_USER_ID="826535422381391913"
24 export TEST_EVENT_ID="909928577951203360"
25 ```
26
27 You may also optionally set:
28 ```bash
29 export TEST_DATA_DIR="/path/to/test/data"
30 ```
31 If you wish to have test data (Robot.pcm etc) in a different location than two directories above the unit test program. If you do not specify
32 this environment variable the default will be used.
33
34 Then, after cloning and building DPP, run `cd build && ctest -VV` for unit test cases.
35
36 If you do not specify the `DPP_UNIT_TEST_TOKEN` environment variable, a subset of the tests will run which do not require discord connectivity.