Skip to content

Commit

Permalink
Se agrega imágenes y se modifica el README
Browse files Browse the repository at this point in the history
  • Loading branch information
Julio Sarango committed Nov 18, 2024
1 parent e489c4e commit 6243bc7
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,16 @@ test_deposit_negative_amount_increase_balance

# Mocking de APIs externas
![Mockin](images/mockin.png)
Un Mock es una herramienta que nos permite simular comportamientos de funciones o servicios externos. En lugar de ejecutar una llamada real a una API, podemos definir una respuesta predefinida, lo que permite:

- Evitar depender de servicios externos en pruebas.
- Acelerar la ejecución de las pruebas.
- Controlar los resultados esperados.

# Side Effects en Mocking
![Side Effect](images/side_effect.png)

El “side effect” en Mock nos permite modificar el comportamiento de un método en distintas llamadas. Se define como una lista de comportamientos, donde cada elemento de la lista corresponde al resultado de una llamada específica. Esto permite:

- Simular fallos de manera controlada, como lanzar excepciones específicas en las pruebas.
Expand All @@ -50,17 +53,19 @@ python -m unittest tests.test_api_client.ApiClientTest.test_get_location_return_
```

# SubTest
![Subtest](images/subtests.png)
Nos ayuda a realizar validaciones con varios valores sin la necesidad de crear varios métodos. SubTest también es útil para identificar errores específicos. Si una prueba falla con un conjunto particular de parámetros, SubTest permitirá identificar fácilmente qué valores causaron el fallo.

```
python -m unittest tests.test_bank_account.BankAccoutTest.test_deposit_multiple_amounts
```

# Doctest

![Doctest](images/doc_test.png)
Doctest es una librería que está incluida en Python y que permite crear pruebas en los comentarios del código.

# Faker
![Faker](images/faker.png)
```
pip install Faker
pip freeze | grep Kaker
Expand Down
Binary file added images/doc_test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/faker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/mockin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/side_effect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/subtests.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6243bc7

Please sign in to comment.