From 6f65d82edfa9d7d4256cc850e46b844147d8ea0f Mon Sep 17 00:00:00 2001 From: Jannis R Date: Fri, 22 May 2020 17:08:52 +0200 Subject: [PATCH] document integration test workflow :memo: [ci skip] --- contributing.md | 14 ++++++++++++++ readme.md | 2 ++ 2 files changed, 16 insertions(+) create mode 100644 contributing.md diff --git a/contributing.md b/contributing.md new file mode 100644 index 00000000..f7740fcc --- /dev/null +++ b/contributing.md @@ -0,0 +1,14 @@ +# Contributing + +Thanks for helping! 🙏 + +## Adding integration/end-to-end tests + +The [end-to-end/system tests](https://en.wikipedia.org/wiki/System_testing) in [`test/e2e`](test/e2e), executing via `npm run test-e2e`, are querying real HAFAS endpoints, expecting valid & *reasonable* responses. + +The [integration tests](https://en.wikipedia.org/wiki/Integration_testing) (`npm run test-integration`) are the same `test/e2e` tests, running against *mocked* HAFAS responses from [`test/e2e/fixtures`](test/e2e/fixtures). + +1. Add a new end-to-end test that tests your feature/bugfix. +2. Make sure the test passes. You can run your test exclusively using `test.only`. +3. Record the HAFAS responses as [fixtures](https://en.wikipedia.org/wiki/Test_fixture) using `npm run test-integration:record`. +4. Make sure the passes against *only* mocked responses using `npm run test-integration`. diff --git a/readme.md b/readme.md index 3f487595..23445805 100644 --- a/readme.md +++ b/readme.md @@ -265,3 +265,5 @@ HAFAS endpoint | library If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/public-transport/hafas-client/issues). This project needs help! Check the [list of "help wanted" Issues](https://github.com/public-transport/hafas-client/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22). + +If you're contributing code, please read the [contribution guidelines](contributing.md).