Submit Search
Upload
Realizando Pruebas con Spock
•
0 likes
•
625 views
Andres Almiray
Follow
Realizando Pruebas con Spock
Read less
Read more
Technology
Report
Share
Report
Share
1 of 29
Download now
Download to read offline
Recommended
Fonctions vocales sous Windows Phone : intégrez votre application à Cortana !
Fonctions vocales sous Windows Phone : intégrez votre application à Cortana !
Microsoft
Defensive programming in Javascript and Node.js
Defensive programming in Javascript and Node.js
Ruben Tan
Jersey framework
Jersey framework
knight1128
Testing Java Code Effectively
Testing Java Code Effectively
Andres Almiray
Spock's New Tricks
Spock's New Tricks
Andres Almiray
모던자바의 역습
모던자바의 역습
DoHyun Jung
Continuous integration with Git & CI Joe
Continuous integration with Git & CI Joe
Shawn Price
TDC São Paulo 2019 - Trilha DevTest - Karatê DSL - Automatizando testes de AP...
TDC São Paulo 2019 - Trilha DevTest - Karatê DSL - Automatizando testes de AP...
Samuel Lucas
Recommended
Fonctions vocales sous Windows Phone : intégrez votre application à Cortana !
Fonctions vocales sous Windows Phone : intégrez votre application à Cortana !
Microsoft
Defensive programming in Javascript and Node.js
Defensive programming in Javascript and Node.js
Ruben Tan
Jersey framework
Jersey framework
knight1128
Testing Java Code Effectively
Testing Java Code Effectively
Andres Almiray
Spock's New Tricks
Spock's New Tricks
Andres Almiray
모던자바의 역습
모던자바의 역습
DoHyun Jung
Continuous integration with Git & CI Joe
Continuous integration with Git & CI Joe
Shawn Price
TDC São Paulo 2019 - Trilha DevTest - Karatê DSL - Automatizando testes de AP...
TDC São Paulo 2019 - Trilha DevTest - Karatê DSL - Automatizando testes de AP...
Samuel Lucas
Generating characterization tests for legacy code
Generating characterization tests for legacy code
Jonas Follesø
CDI do básico ao avançado
CDI do básico ao avançado
Alberto Souza
Java Libraries You Can't Afford To Miss
Java Libraries You Can't Afford To Miss
Andres Almiray
Atlassian Groovy Plugins
Atlassian Groovy Plugins
Paul King
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
Guillaume Laforge
Java Libraries You Can't Afford to Miss
Java Libraries You Can't Afford to Miss
Andres Almiray
Spring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergration
Carlos Junior Caso Casimiro
Introducing PHP Latest Updates
Introducing PHP Latest Updates
Iftekhar Eather
Canjs
Canjs
bitovi
Testing Java Code Effectively - BaselOne17
Testing Java Code Effectively - BaselOne17
Andres Almiray
Spring Boot
Spring Boot
Jiayun Zhou
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
Martijn Verburg
Great Developers Steal
Great Developers Steal
Ben Scofield
Vulpes tribes backend
Vulpes tribes backend
Jiří Soušek
No SQL Unit - Devoxx 2012
No SQL Unit - Devoxx 2012
Alex Soto
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Guillaume Laforge
Jersey
Jersey
Yung-Lin Ho
Kotlin+MicroProfile: Ensinando 20 anos para uma linguagem nova
Kotlin+MicroProfile: Ensinando 20 anos para uma linguagem nova
Víctor Leonel Orozco López
Sequelize
Sequelize
Tarek Raihan
Introduzione al TDD
Introduzione al TDD
Andrea Francia
Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abierto
Andres Almiray
Liberando a produccion con confianza
Liberando a produccion con confianza
Andres Almiray
More Related Content
Similar to Realizando Pruebas con Spock
Generating characterization tests for legacy code
Generating characterization tests for legacy code
Jonas Follesø
CDI do básico ao avançado
CDI do básico ao avançado
Alberto Souza
Java Libraries You Can't Afford To Miss
Java Libraries You Can't Afford To Miss
Andres Almiray
Atlassian Groovy Plugins
Atlassian Groovy Plugins
Paul King
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
Guillaume Laforge
Java Libraries You Can't Afford to Miss
Java Libraries You Can't Afford to Miss
Andres Almiray
Spring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergration
Carlos Junior Caso Casimiro
Introducing PHP Latest Updates
Introducing PHP Latest Updates
Iftekhar Eather
Canjs
Canjs
bitovi
Testing Java Code Effectively - BaselOne17
Testing Java Code Effectively - BaselOne17
Andres Almiray
Spring Boot
Spring Boot
Jiayun Zhou
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
Martijn Verburg
Great Developers Steal
Great Developers Steal
Ben Scofield
Vulpes tribes backend
Vulpes tribes backend
Jiří Soušek
No SQL Unit - Devoxx 2012
No SQL Unit - Devoxx 2012
Alex Soto
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Guillaume Laforge
Jersey
Jersey
Yung-Lin Ho
Kotlin+MicroProfile: Ensinando 20 anos para uma linguagem nova
Kotlin+MicroProfile: Ensinando 20 anos para uma linguagem nova
Víctor Leonel Orozco López
Sequelize
Sequelize
Tarek Raihan
Introduzione al TDD
Introduzione al TDD
Andrea Francia
Similar to Realizando Pruebas con Spock
(20)
Generating characterization tests for legacy code
Generating characterization tests for legacy code
CDI do básico ao avançado
CDI do básico ao avançado
Java Libraries You Can't Afford To Miss
Java Libraries You Can't Afford To Miss
Atlassian Groovy Plugins
Atlassian Groovy Plugins
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
Java Libraries You Can't Afford to Miss
Java Libraries You Can't Afford to Miss
Spring hibernate jsf_primefaces_intergration
Spring hibernate jsf_primefaces_intergration
Introducing PHP Latest Updates
Introducing PHP Latest Updates
Canjs
Canjs
Testing Java Code Effectively - BaselOne17
Testing Java Code Effectively - BaselOne17
Spring Boot
Spring Boot
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
Great Developers Steal
Great Developers Steal
Vulpes tribes backend
Vulpes tribes backend
No SQL Unit - Devoxx 2012
No SQL Unit - Devoxx 2012
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Groovy DSLs, from Beginner to Expert - Guillaume Laforge and Paul King - Spri...
Jersey
Jersey
Kotlin+MicroProfile: Ensinando 20 anos para uma linguagem nova
Kotlin+MicroProfile: Ensinando 20 anos para uma linguagem nova
Sequelize
Sequelize
Introduzione al TDD
Introduzione al TDD
More from Andres Almiray
Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abierto
Andres Almiray
Liberando a produccion con confianza
Liberando a produccion con confianza
Andres Almiray
Liberando a produccion con confidencia
Liberando a produccion con confidencia
Andres Almiray
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java Developers
Andres Almiray
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven Puzzlers
Andres Almiray
Maven Puzzlers
Maven Puzzlers
Andres Almiray
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java Developers
Andres Almiray
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of light
Andres Almiray
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and Layrry
Andres Almiray
Going Reactive with g rpc
Going Reactive with g rpc
Andres Almiray
Building modular applications with JPMS and Layrry
Building modular applications with JPMS and Layrry
Andres Almiray
Taking Micronaut out for a spin
Taking Micronaut out for a spin
Andres Almiray
Apache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and You
Andres Almiray
What I wish I knew about Maven years ago
What I wish I knew about Maven years ago
Andres Almiray
What I wish I knew about maven years ago
What I wish I knew about maven years ago
Andres Almiray
The impact of sci fi in tech
The impact of sci fi in tech
Andres Almiray
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
Andres Almiray
Creating Better Builds with Gradle
Creating Better Builds with Gradle
Andres Almiray
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with Gradle
Andres Almiray
Gradle ex-machina
Gradle ex-machina
Andres Almiray
More from Andres Almiray
(20)
Creando, creciendo, y manteniendo una comunidad de codigo abierto
Creando, creciendo, y manteniendo una comunidad de codigo abierto
Liberando a produccion con confianza
Liberando a produccion con confianza
Liberando a produccion con confidencia
Liberando a produccion con confidencia
OracleDB Ecosystem for Java Developers
OracleDB Ecosystem for Java Developers
Softcon.ph - Maven Puzzlers
Softcon.ph - Maven Puzzlers
Maven Puzzlers
Maven Puzzlers
Oracle Database Ecosystem for Java Developers
Oracle Database Ecosystem for Java Developers
JReleaser - Releasing at the speed of light
JReleaser - Releasing at the speed of light
Building modular applications with the Java Platform Module System and Layrry
Building modular applications with the Java Platform Module System and Layrry
Going Reactive with g rpc
Going Reactive with g rpc
Building modular applications with JPMS and Layrry
Building modular applications with JPMS and Layrry
Taking Micronaut out for a spin
Taking Micronaut out for a spin
Apache Groovy's Metaprogramming Options and You
Apache Groovy's Metaprogramming Options and You
What I wish I knew about Maven years ago
What I wish I knew about Maven years ago
What I wish I knew about maven years ago
What I wish I knew about maven years ago
The impact of sci fi in tech
The impact of sci fi in tech
Gradle Ex Machina - Devoxx 2019
Gradle Ex Machina - Devoxx 2019
Creating Better Builds with Gradle
Creating Better Builds with Gradle
Interacting with the Oracle Cloud Java SDK with Gradle
Interacting with the Oracle Cloud Java SDK with Gradle
Gradle ex-machina
Gradle ex-machina
Recently uploaded
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Delhi Call girls
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
AndikSusilo4
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
Sinan KOZAK
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
Ridwan Fadjar
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
Scott Keck-Warren
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
naman860154
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
Scott Keck-Warren
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
soniya singh
Slack Application Development 101 Slides
Slack Application Development 101 Slides
praypatel2
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Enjoy Anytime
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
comworks
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
Memoori
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
OnBoard
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
null - The Open Security Community
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
Hyundai Motor Group
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
Padma Pradeep
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
BookNet Canada
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
carlostorres15106
Recently uploaded
(20)
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
Slack Application Development 101 Slides
Slack Application Development 101 Slides
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Realizando Pruebas con Spock
1.
REALIZANDO PRUEBAS CON SPOCK ANDRES ALMIRAY @AALMIRAY ANDRESALMIRAY.COM
2.
@aalmiray
3.
@aalmiray JCP Executive Committee
Associate Seat Committer Committer JSR377 Specification Lead
4.
@aalmiray HTTP://SPOCKFRAMEWORK.ORG/ HTTPS://GITHUB.COM/SPOCKFRAMEWORK
5.
@aalmiray AGENDA 1. Conceptos Básicos 2.
Parametrización 3. Mock/Stub/Spy 4. Extensiones
6.
@aalmiray CONCEPTOS BASICOS
7.
@aalmiray CONCEPTOS BASICOS -
JUNIT public class SampleTest { @Test public void simpleSpecificationExample() { // given: List<String> list = new ArrayList<>(); // when: list.add("Groovy"); // then: assertThat(list, contains("Groovy")); } }
8.
@aalmiray CONCEPTOS BASICOS -
SPOCK public class SampleSpec extends Specification { public void simpleSpecificationExample() { given: List<String> list = new ArrayList<>(); when: list.add("Groovy"); then: assert list.contains("Groovy"); assert list.size() == 1; } }
9.
@aalmiray CONCEPTOS BASICOS -
SPOCK class SampleSpec extends Specification { def "A simple Specification Example" () { given: List<String> list = [] when: list << 'Groovy' then: list == ['Groovy'] } }
10.
@aalmiray BLOQUES given / setup when then expect where and cleanup
11.
@aalmiray FIXTURE METHODS def setup() {…} def cleanup() {…} def setupSpec() {…} def cleanupSpec() {…} Spock ----------------------------------------------------- @Before public void setUp() {…} JUnit @After public void tearDown() {…} @BeforeClass public static void setUpTestCase() {…} @AfterClass public static void tearDownTestCase() {…}
12.
@aalmiray PARAMETRIZACION
13.
@aalmiray PARAMETRIZACION @Unroll class HelloServiceSpecification extends Specification { def "Invoking sayHello('#input') yields '#output'"() { given: HelloService service = new DefaultHelloService() when: String result = service.sayHello(input) then: result == output where: input << ['', 'Test'] output << ['Howdy stranger! ', 'Hello Test'] } }
14.
@aalmiray PARAMETRIZACION @Unroll class HelloServiceSpecification extends Specification { def "Invoking sayHello('#input') yields '#output'"() { given: HelloService service = new DefaultHelloService() when: String result = service.sayHello(input) then: result == output where: input | output '' | 'Howdy stranger!' 'Test' | 'Hello Test' } }
15.
@aalmiray MOCK/STUB/SPY
16.
@aalmiray MOCK + INTERACCIONES class SampleSpec extends Specification { def "A mocking example"() { given: Collaborator collaborator = Mock() 1 * collaborator.foo() >> 'Spock' Component component = new Component(collaborator) when: String output = component.doit('is Groovy!') then: output == 'Spock is Groovy!’ } }
17.
@aalmiray CARDINALIDAD 1 * subscriber.receive("hello") 0 * subscriber.receive("hello") (1..3) * subscriber.receive("hello") (1.._) * subscriber.receive("hello") (_..3) * subscriber.receive("hello") _ * subscriber.receive("hello")
18.
@aalmiray TARGET Y METODO 1 * subscriber.receive("hello") 1 * _.receive("hello") 1 * subscriber._("hello") 1 * subscriber./r.*e/("hello") ) 1 * _._("hello")
19.
@aalmiray ARGUMENTOS 1 * subscriber.receive("hello") 1 * subscriber.receive(!"hello") 1 * subscriber.receive() 1 * subscriber.receive(_) 1 * subscriber.receive(*_) 1 * subscriber.receive(!null) 1 * subscriber.receive(_ as String) 1 * subscriber.receive({ it.size() > 3 })
20.
@aalmiray ASCII ART? (_.._) * _._(*_) >> _
21.
@aalmiray ASCII ART? (_.._) * _._(*_) >> _ 1 2 3 4 5 1. Cardinalidad 0 a infinito 2.
Cualquier Mock/Stub/Spy 3. Cualquier método 4. 0 o más argumentos 5. Valor de retorno genérico
22.
@aalmiray EXTENSIONES
23.
@aalmiray IGNORAR METODOS • @Ignore •
Ignora un solo método • @IgnoreRest • Ignora los demás métodos • @IgnoreIf • Ignora un método de manera condicional
24.
@aalmiray @IGNOREIF class SampleSpec extends Specification { @IgnoreIf({System.getBoolean("fast")}) def "A expensive data driven test" () { given: . . . } }
25.
@aalmiray @STEPWISE @Stepwise class BakeACakeSpec extends Specification { def "Fetch ingredients" () { . . . } def "Mix ingredients" () { . . . } def "Decorate bake" () { . . . } def "Bake it!" () { . . . } def "Serve and enjoy" () { . . . } }
26.
@aalmiray HTTP://ANDRESALMIRAY.COM/NEWSLETTER HTTP://ANDRESALMIRAY.COM/EDITORIAL
27.
@aalmiray
28.
@aalmiray http://www.jespanol.org
29.
GRACIAS! ANDRES ALMIRAY @AALMIRAY ANDRESALMIRAY.COM
Download now