This kata is original from sandromancuso/Bank-kata
Which is based in How Object-Oriented Are You Feeling Today? - Krzysztof Jelski (Session on the Software Craftsmanship UK 2011 conference)
Based also in the video Outside In TDD
Create a simple bank application with the following features
- Deposit into Account
- Withdraw from an Account
- Print a bank statement to the console
Given a client makes a deposit of 1000 on 20/01/2022
And a deposit of 2000 on 23/01/2022
And a withdrawal of 500 on 24/01/2022
When she prints her bank statement
Then she would see at the terminal
DATE | AMOUNT | BALANCE
24/01/2012 | 500.00 | 2500.00
23/01/2012 | 2000.00 | 3000.00
20/01/2012 | 1000.00 | 1000.00
-
Start with a class using the following structure
public class Account { public void deposit(int amount); public void withdraw(int amount); public void printStatement(); }
-
You are not allowed to add any other public method to this class.
-
Use Strings and Integers for dates and amounts (keep it simple)
-
Don't worry about spacing in the statement printed on the console
Configuración básica para empezar a hacer una kata o aprender a hacer tests en los siguientes lenguajes:
- PHP y PHPUnit
- Javascript con Jest
- Typescript con Deno
- Java, Junit y Mockito
- Scala, Munit y Scalacheck
- Kotlin, JUnit5 y MockK
- C#, xUnit (con FluentAsertion) y NSubstitute (para mock)
- Instalar composer
curl -sS https://getcomposer.org/installer | php
composer install
(estando en la carpeta php)./vendor/bin/phpunit
- Instalar Node
npm install
(Estando en la carpeta javascript)npm test
- Instalar Deno
deno test
(Estando en la carpeta typescript)
- Instalar las dependencias y tests con Maven [mvn test]
- Ejecutar los tests con el IDE
sbt
(en la carpeta scala)~test
para ejecutar los test en hot reload
- Munit
- Scalacheck para testing basado en propiedades
- Instalar SDKMan
sdk install java 11.0.12-open
instala OpenJDKsdk install sbt
una vez instalado SDKMan
- Descargar Visual Studio Code
- Instalar para VS Code Metals
- Por consola: Puedes instalar dependencias y lanzar los tests con
gradlew test
- Usando IDE: Simplemente abre el proyecto desde el raiz de la plantilla Kotlin
- Instalar Microsoft Visual Studio Community 2022
- Abre el proyecto y se descargaran automáticamente los paquetes Nuguet necesarios
- Instalar python 3.x
- Una vez descargado el código fuente dentro de la carpeta */python/ creamos un virtual enviroment:
python3 -m venv env
- Activamos en virtual environment:
- windows:
.\env\Scripts\activate.bat
- linux/mac:
source env/bin/activate
pytest
para ejecutar los tests.