Update readme, add docs for standard tests

This commit is contained in:
boukeversteegh
2020-05-22 16:36:43 +02:00
parent 6969ff7ff6
commit 77c04414f5
5 changed files with 102 additions and 13 deletions

View File

@@ -311,10 +311,26 @@ $ pip install -e .
There are two types of tests:
1. Manually-written tests for some behavior of the library
2. Proto files and JSON inputs for automated tests
1. Standard tests
2. Custom tests
For #2, you can add a new `*.proto` file into the `betterproto/tests` directory along with a sample `*.json` input and it will get automatically picked up.
#### Standard tests
Adding a standard test case is easy.
- Create a new directory `betterproto/tests/inputs/<name>`
- add `<name>.proto` with a message called `Test`
- add `<name>.json` with some test data
It will be picked up automatically when you run `pipenv test`
- See also: [Standard Tests Development Guide](betterproto\tests\standard-tests.md)
#### Custom tests
Custom tests are found in `tests/test_*.py` and are run with pytest.
#### Running
Here's how to run the tests.
@@ -322,7 +338,7 @@ Here's how to run the tests.
# Generate assets from sample .proto files
$ pipenv run generate
# Run the tests
# Run all tests
$ pipenv run test
```