# About lifen-postman

<!-- vscode-markdown-toc -->
* [Installation and execution via CLI](#InstallationandexecutionviaCLI)
	* [An example of NewMan's test report](#AnexampleofNewManstestreport)
* [Installation and execution in the PostMan GUI](#InstallationandexecutioninthePostManGUI)
	* [an Example of Test Report in PostMan](#anExampleofTestReportinPostMan)

<!-- vscode-markdown-toc-config
	numbering=true
	autoSave=true
	/vscode-markdown-toc-config -->
<!-- /vscode-markdown-toc -->

This repository holds some PostMan files that performs tests against Lifen's Fhir API. They represent my handout regardinf the technical test. There is also a Node programm that run `NewMan`.

##  1. <a id='InstallationandexecutionviaCLI'></a>Installation and execution via CLI

NodeJs 16+ is required.

1. Clone this repository on your local computer
2. Open your favorite IDE, VSC or a terminal
2. Purge the `node_modules` folder (`rm -rf ./node_module/*`)
3. Install `NewMan` via npm with the command `npm install`. It will lookup eveything based on the `package.json` file.
4. Run newman via the npx command `npx newman run .\lifen-api.postman_collection.json -e '.\fhir-api public post-prod.postman_environment.json'`

###  a. <a id='AnexampleofNewManstestreport'></a>An example of NewMan's test report

![An example of NewMan's test report](./public/newman-testresult-example.jpg)

##  2. <a id='InstallationandexecutioninthePostManGUI'></a>Installation and execution in the PostMan GUI

PostMan is required to run them.

1. Download the 3 jsons files
2. Create or select a Workspace that will get them
3. `File` > `Import...` and drag-and-drop them on the lightbox.
    ![Import modale with some files ready to be imported](./public/import-screen-with-files.jpg)
4. Open the collection properties
    ![a Collection Properties panel in PostMan](./public/lifen-api-collection-properties.jpg)
5. Run the files with the following settings
    ![a runner in PostMan](./public/lifen-api-runner.jpg)
    * Run the `POST a Json Web Token` is optional, the collection handle the JWT generation and use for each requests
    * The servers don't like to be rushed, you will get better results by addind a **Delay** of **500**ms
    * You can save the responses to diagnose them after run.
    * The request `GET CommunicationRequest` wait 10 sec before being launched, because Irène may not have processed the CommunicationRequest that early.
    * There is no need to save the cookies, as there will be no cookies baked here 🚫🍪😔

###  a. <a id='anExampleofTestReportinPostMan'></a>An Example of Test Report in PostMan

![an Example of Test Report](./public/run-result-example.jpg)

