|
1 | | -# Dev Tools |
| 1 | +# Testing |
| 2 | +Currently the Josh project mainly uses integration tests for it's verification, so make sure you will be able |
| 3 | +to run and check them. |
2 | 4 |
|
3 | | -## Nix-Shell |
4 | | -* [Nix Shell](https://nixos.org/manual/nix/stable/#chap-installation) |
| 5 | +The following sections will describe how to run the different kind's of tests used for the verification |
| 6 | +of the Josh project. |
5 | 7 |
|
| 8 | +## UnitTests & DocTests |
| 9 | +```shell |
| 10 | +cargo test --all |
| 11 | +``` |
6 | 12 |
|
7 | | -# Testing |
| 13 | +## Integration Tests |
| 14 | + |
| 15 | +### 1. Setup the test environment |
| 16 | +Due to the fact that the integration tests need additional tools and a more complex |
| 17 | +environment and due to the fact that the integration test are done using [cram](https://pypi.org/project/cram/). |
| 18 | +you will need to crate an extra environment to run these tests. To simplify the |
| 19 | +setup of the integration testing we have setup a [Nix Shell](https://nixos.org/manual/nix/stable/#chap-installation) environment which |
| 20 | +you can start by using the following command if you have installed the [Nix Shell](https://nixos.org/manual/nix/stable/#chap-installation). |
| 21 | + |
| 22 | +**Attention:** |
| 23 | +Currently it is still necessary to install the following tools in your host system. |
| 24 | +* curl |
| 25 | +* hyper_cgi |
| 26 | + ```shell |
| 27 | + cargo install hyper_cgi --features=test-server |
| 28 | + ``` |
| 29 | + |
| 30 | +#### Setup the Nix Shell |
| 31 | +**Attention:** |
| 32 | +When running this command the first time, this command will take quite a bit to |
| 33 | +finish. You also will need internet access while executing this command. |
| 34 | +Depending on performance of your connection the command will take more or less time. |
8 | 35 |
|
9 | | -1. Install Nix-Shell |
10 | | -2. Setup Nix-Shell for testing |
11 | 36 | ```shell |
12 | 37 | nix-shell shell.nix |
13 | 38 | ``` |
14 | | -3. build |
15 | | - * filter |
16 | | - * proxy |
17 | | - * trunk build in ui |
| 39 | +Once the command is finished you will be prompted with the nix-shell which will |
| 40 | +provide the needed shell environment to execute the integration tests. |
18 | 41 |
|
19 | 42 |
|
20 | | -## Unit Tests |
| 43 | +### 2. Verify you have built all necessary binaries |
21 | 44 | ```shell |
22 | | -cargo test --all |
| 45 | +cargo build |
| 46 | +cargo build --bin josh-filter |
| 47 | +cargo build --manifest-path josh-proxy/Cargo.toml |
| 48 | +cargo build --manifest-path josh-ui/Cargo.toml |
23 | 49 | ``` |
24 | 50 |
|
25 | | -## Integration Tests |
26 | | -* Build all targets |
27 | | -* run integration tests |
| 51 | +### 3. Setup static files for the josh-ui |
| 52 | +```shell |
| 53 | +cd josh-ui |
| 54 | +trunk build |
| 55 | +cd .. |
| 56 | +``` |
| 57 | + |
| 58 | +### 4. Run the integration tests |
| 59 | +**Attention:** Be aware that all tests except the once in experimental should be green. |
28 | 60 | ```shell |
29 | | -sh run-tests.sh tests/ |
| 61 | +sh run-tests.sh -v tests/ |
30 | 62 | ``` |
31 | 63 |
|
32 | 64 | ## UI Tests |
33 | | -TBD |
| 65 | +TBD: Currently disabled, stabilize, enable and document process. |
0 commit comments