dotnet / dotnet/dev-proxy

Enhancement: define failure rate for each mocked response

Ouverte
#103 13 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
needs spec
Langage dominant
C#
Étoiles
832
Forks
89
Merge moyen
12 h 1 min
PR mergées (30 j)
23

Description

### Background

Currently, I am researching if we may use the ms-dev-proxy as a tool to support us in integration/manual/QA tests for our apps, and mocking responses is just the perfect functionality we could use 😉.

### Idea

1. Currently the ms-dev-proxy will look for `responses.json` file in the working directory which is just perfect to keep mock related to the app in the projects folder. What I was thinking is maybe ms-dev-proxy could have a new option that would allow specifying the relative path to the `response.json` with mocks to be used. Maybe something like `-r --responses-file-path` (optional). The aim for this would be to have different test scenarios with different mocks for the same app and then use them as part of integration tests. That way I could keep something like
```
.
├── MyApp
├── TestScenarios
│ ├── groups-fail-timeout-responses.json
│ └── throttle-responses.json
```

In this case, each integration test could start the ms-dev-proxy giving different `responses.json` mocks as param.

TBH this is very low 😉 (and probably stupid) idea as the current workaround I have for it is:
- keep `responses.json` in subfolders and run the ms-dev-proxy in the subfolder with correct mocks as working directory
- the test may just copy/paste the needed `responses.json` file to be used for this test.

2. Second idea I had (sorry for adding 2 ideas in one issue, I am a bit lazy and running out of time 😝), is to give possibility to define the failure rate for each mocked response in case we are mocking error response.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par localiser la gestion de la ligne de commande pour responses.json dans ms-dev-proxy ainsi que le code qui applique les réponses simulées. Déterminez si le travail demandé inclut le chemin alternatif vers le fichier de réponses, des taux d’échec par réponse, ou les deux, puis définissez la configuration des réponses et le comportement observable avant l’implémentation. La définition de terminé doit inclure des options documentées et des tests couvrant les scénarios sélectionnés.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp
Domaine
cli, devtools, testing
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.