Manuelir / password-validator-sw-alicante

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

https://www.codurance.com/katalyst/password-validation

Iteration 1 - Basic password validation

Goal

Design and implement a software that validates a password applying TDD.

The password will be introduced by the user (as an argument of the method) and should return if the password is valid or not.

A valid password should meet the following requirements:

  • Have more than 8 characters
  • Contains a capital letter
  • Contains a lowercase
  • Contains a number
  • Contains an underscore

Technical requirements:

We want a method that answers if the password is valid or not. We don't want to know the reason when the password is invalid (the return value is a boolean)

#Iteration 2 - Rules abstraction

Goal

Design and implement software that can adapt to different password validation rules TDD and focus on the OOP principles.

Let's pretend that now we want to create another type of password validations because on our app we need different type of passwords, such as:

Validation 2:

  • Have more than 6 characters
  • Contains a capital letter
  • Contains a lowercase
  • Contains a number

Validation 3:

  • Have more than 16 characters
  • Contains a capital letter
  • Contains a lowercase
  • Contains an underscore

Things to practice

In this iteration, we should try to identify a good abstraction and try to work on OOP principles as well as on design patterns like Builder and Factory

Base para hacer tests

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
  • Java, Junit y Mockito
  • Scala, Munit y Scalacheck
  • Kotlin, JUnit5 y MockK
  • C#, xUnit (con FluentAsertion) y NSubstitute (para mock)

Configuración específica por lenguaje

PHP

  1. Instalar composer curl -sS https://getcomposer.org/installer | php
  2. composer install (estando en la carpeta php)
  3. ./vendor/bin/phpunit

Javascript

  1. Instalar Node
  2. npm install (Estando en la carpeta javascript)
  3. npm test

Java

  1. Instalar las dependencias y tests con Maven [mvn test]
  2. Ejecutar los tests con el IDE

Scala

  1. sbt (en la carpeta scala)
  2. ~test para ejecutar los test en hot reload

Linux/Mac

  1. Instalar SDKMan
  2. sdk install java 11.0.12-open instala OpenJDK
  3. sdk install sbt una vez instalado SDKMan

Windows

  1. Instalar OpenJDK
  2. Instalar SBT

Visual Studio Code

  1. Descargar Visual Studio Code
  2. Instalar para VS Code Metals

Kotlin

  1. Por consola: Puedes instalar dependencias y lanzar los tests con gradlew test
  2. Usando IDE: Simplemente abre el proyecto desde el raiz de la plantilla Kotlin

C#

  1. Instalar Microsoft Visual Studio Community 2022
  2. Abre el proyecto y se descargaran automáticamente los paquetes Nuguet necesarios

Python

  1. Instalar python 3.x
  2. Una vez descargado el código fuente dentro de la carpeta */python/ creamos un virtual enviroment:
  3. python3 -m venv env
  4. Activamos en virtual environment:
  • windows: .\env\Scripts\activate.bat
  • linux/mac: source env/bin/activate
  1. pytest para ejecutar los tests.

Documentación

Javascript

Jest

PHP

PHPUnit

Prophecy para dobles de prueba

Java

JUnit

Mockito

Scala

Munit

Scalacheck para testing basado en propiedades

Kotlin

JUnit5

MockK

C#

xUnit NSubstitute FluentAssertions

About


Languages

Language:C# 29.3%Language:Kotlin 26.2%Language:Scala 16.2%Language:PHP 10.9%Language:Python 7.3%Language:JavaScript 6.0%Language:Java 4.1%