Skip to content

Commit 7c9cca5

Browse files
Nicorettichristian-schilling
authored andcommitted
Add documentation about how to run integration tests localy
1 parent e20280f commit 7c9cca5

File tree

4 files changed

+55
-23
lines changed

4 files changed

+55
-23
lines changed

docs/src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
- [The josh UI]()
1919
# Contributing
2020
- [Testing](./contributing/testing.md)
21-
- [Development tools]()
21+
- [Development tools](./contributing/dev-tools.md)
2222
- [Tracing]()

docs/src/contributing/dev-tools.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Dev-Tools
22

3-
* Nix-Shell
4-
- curl
5-
- brew trunk
6-
* Cram
7-
* Cargo/Rustup
3+
* [Nix Shell](https://nixos.org/manual/nix/unstable/command-ref/nix-shell.html)
4+
* [Rust](https://rustup.rs/)
5+
* [Cargo](https://rustup.rs/)

docs/src/contributing/testing.md

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,65 @@
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.
24

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.
57

8+
## UnitTests & DocTests
9+
```shell
10+
cargo test --all
11+
```
612

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.
835

9-
1. Install Nix-Shell
10-
2. Setup Nix-Shell for testing
1136
```shell
1237
nix-shell shell.nix
1338
```
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.
1841

1942

20-
## Unit Tests
43+
### 2. Verify you have built all necessary binaries
2144
```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
2349
```
2450

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.
2860
```shell
29-
sh run-tests.sh tests/
61+
sh run-tests.sh -v tests/
3062
```
3163

3264
## UI Tests
33-
TBD
65+
TBD: Currently disabled, stabilize, enable and document process.

shell.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ in
1818
pkgs.tree
1919
pkgs.cargo
2020
pkgs.rustc
21+
pkgs.trunk
2122
pkgs.rustfmt
2223
pkgs.libiconv
2324
pkgs.openssl.dev
@@ -26,3 +27,4 @@ in
2627
] ++ extra_deps;
2728
RUST_BACKTRACE = 1;
2829
}
30+

0 commit comments

Comments
 (0)