Skip to content

SoftwareCraftersMurcia/Rock-Paper-Scissors-2022

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rock Paper Scissors kata

We are creating a rock-paper-scissors game, to do so, we create the rules of the game

Rock Beats Scissors

Business needs / User story

As a player
I want the rock to beat scissors

Solution

Given I have chosen rock
When the opponent chooses scissors
Then I should win
Given I have chosen scissors
When the opponent chooses rock
Then the opponent win

Paper Beats Rock

Business needs / User story

As a player
I want the paper to beat rock

Solution

Given I have chosen paper
When the opponent chooses rock
Then I should win
Given I have chosen rock
When the opponent chooses paper
Then the opponent should win

Scissors Beats Paper

Business needs / User story

As a player
I want scissors to beat paper

Solution

Given I have chosen scissors
When the opponent chooses paper
Then I should win
Given I have chosen paper
When the opponent chooses scissors
Then the opponent should win

Same Moves Result in Draw

Business need / User story

As a player
I want the same moves to draw

Solution

Given I have chosen rock
When the opponent chooses rock
Then it should be a draw
Given I have chosen scissors
When the opponent chooses scissors
Then it should be a draw
Given I have chosen paper
When the opponent chooses paper
Then it should be a draw

Valid API

public class RockPaperScissors {
    public String rockPaperSissors(String movePlayer1, String movePlayer2) {}
}
public class RockPaperScissors {
    public GameStatus rockPaperSissors(Moves movePlayer1, Moves movePlayer2) {}
}

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
  • Typescript con Deno
  • 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

Typescript

  1. Instalar Deno
  2. deno test (Estando en la carpeta typescript)

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

Typescript

Deno

BDD module

Expect module

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

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published