Update documentation
This commit is contained in:
parent
12983e395b
commit
2a86569618
2 changed files with 31 additions and 4 deletions
|
@ -5,6 +5,10 @@ This project is built using golang `1.23.1`.
|
||||||
#### Setup steps
|
#### Setup steps
|
||||||
|
|
||||||
1. Checkout this repository
|
1. Checkout this repository
|
||||||
2. Run `go build -o target`
|
2. Execute the script below
|
||||||
|
|
||||||
This will build a `pilgrim` binary in the `target` folder.
|
This will build a `pilgrim` binary in the `target` folder:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go build -o target/pilgrim main.go
|
||||||
|
```
|
|
@ -9,7 +9,7 @@ all interfaces in all packages of the project, and put them in the `mocks`
|
||||||
directory, under the `pilgrim_mock` package
|
directory, under the `pilgrim_mock` package
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mockery --all --outpkg pilgrim_mock --output ./internal/mocks
|
$ mockery --all --outpkg pilgrim_mock --output ./internal/mocks
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Run Tests
|
#### Run Tests
|
||||||
|
@ -17,5 +17,28 @@ mockery --all --outpkg pilgrim_mock --output ./internal/mocks
|
||||||
To run all tests, execute the following from the root directory
|
To run all tests, execute the following from the root directory
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go test ./...
|
$ go test ./...
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Coverage
|
||||||
|
|
||||||
|
To calculate test coverage, you have to build a special coverage binary and
|
||||||
|
execute it. To do this, run the following in the root directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ go build -cover -o target/pilgrim_coverage main.go
|
||||||
|
```
|
||||||
|
|
||||||
|
To calculate the coverage, execute the binary. You must setup the `GOCOVERDIR`
|
||||||
|
environment variable in order to instruct the go coverage tool where to place
|
||||||
|
the coverage data. The standard place for this in `pilgrim` is `coverage`:
|
||||||
|
```bash
|
||||||
|
$ chmod 777 ./target/pilgrim_coverage
|
||||||
|
$ GOCOVERDIR=coverage ./target/pilgrim
|
||||||
|
```
|
||||||
|
|
||||||
|
This will produce several files containing the coverage data. To turn this into
|
||||||
|
a human-readable format, use the go coverage tool:
|
||||||
|
```bash
|
||||||
|
$ go tool covdata percent -i=coverage
|
||||||
```
|
```
|
Loading…
Add table
Reference in a new issue