Enviar pesquisa
Carregar
Spock's New Tricks
•
6 gostaram
•
1,323 visualizações
Andres Almiray
Seguir
Spock's New Tricks
Leia menos
Leia mais
Tecnologia
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 43
Baixar agora
Baixar para ler offline
Recomendados
Spock's New Tricks
Spock's New Tricks
Andres Almiray
Testing Java Code Effectively - BaselOne17
Testing Java Code Effectively - BaselOne17
Andres Almiray
Realizando Pruebas con Spock
Realizando Pruebas con Spock
Andres Almiray
Get Back in Control of your SQL
Get Back in Control of your SQL
Java Usergroup Berlin-Brandenburg
Get Back in Control of Your SQL with jOOQ at #Java2Days
Get Back in Control of Your SQL with jOOQ at #Java2Days
Lukas Eder
The vJUG talk about jOOQ: Get Back in Control of Your SQL
The vJUG talk about jOOQ: Get Back in Control of Your SQL
Lukas Eder
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
DataGeekery
Scalable web application architecture
Scalable web application architecture
postrational
Recomendados
Spock's New Tricks
Spock's New Tricks
Andres Almiray
Testing Java Code Effectively - BaselOne17
Testing Java Code Effectively - BaselOne17
Andres Almiray
Realizando Pruebas con Spock
Realizando Pruebas con Spock
Andres Almiray
Get Back in Control of your SQL
Get Back in Control of your SQL
Java Usergroup Berlin-Brandenburg
Get Back in Control of Your SQL with jOOQ at #Java2Days
Get Back in Control of Your SQL with jOOQ at #Java2Days
Lukas Eder
The vJUG talk about jOOQ: Get Back in Control of Your SQL
The vJUG talk about jOOQ: Get Back in Control of Your SQL
Lukas Eder
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
Get Back in Control of your SQL with jOOQ - GeekOut by ZeroTurnaround
DataGeekery
Scalable web application architecture
Scalable web application architecture
postrational
Essential Test-Driven Development
Essential Test-Driven Development
TechWell
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture
Erdem YILDIRIM
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
drewz lin
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
Mikel Torres Ugarte
Sequelize
Sequelize
Tarek Raihan
Angular.js is super cool
Angular.js is super cool
Maksym Hopei
Spock
Spock
nklmish
Practical HTML5: Using It Today
Practical HTML5: Using It Today
Doris Chen
おっぴろげJavaEE DevOps
おっぴろげJavaEE DevOps
Taiichilow Nagase
Alien driven-development
Alien driven-development
Markus Eisele
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
scalaconfjp
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
Ngoc Dao
Introduction to AngularJS
Introduction to AngularJS
Marco Vito Moscaritolo
Scaladays 2014 introduction to scalatest selenium dsl
Scaladays 2014 introduction to scalatest selenium dsl
Matthew Farwell
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
guest785f78
L04 Software Design Examples
L04 Software Design Examples
Ólafur Andri Ragnarsson
How Testability Inspires AngularJS Design / Ran Mizrahi
How Testability Inspires AngularJS Design / Ran Mizrahi
Ran Mizrahi
Selenium with py test by Alexandr Vasyliev for Lohika Odessa Python TechTalks
Selenium with py test by Alexandr Vasyliev for Lohika Odessa Python TechTalks
Lohika_Odessa_TechTalks
The JavaFX Ecosystem
The JavaFX Ecosystem
Andres Almiray
SQLAlchemy Core: An Introduction
SQLAlchemy Core: An Introduction
Jason Myers
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
Mais conteúdo relacionado
Semelhante a Spock's New Tricks
Essential Test-Driven Development
Essential Test-Driven Development
TechWell
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture
Erdem YILDIRIM
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
drewz lin
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
Mikel Torres Ugarte
Sequelize
Sequelize
Tarek Raihan
Angular.js is super cool
Angular.js is super cool
Maksym Hopei
Spock
Spock
nklmish
Practical HTML5: Using It Today
Practical HTML5: Using It Today
Doris Chen
おっぴろげJavaEE DevOps
おっぴろげJavaEE DevOps
Taiichilow Nagase
Alien driven-development
Alien driven-development
Markus Eisele
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
scalaconfjp
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
Ngoc Dao
Introduction to AngularJS
Introduction to AngularJS
Marco Vito Moscaritolo
Scaladays 2014 introduction to scalatest selenium dsl
Scaladays 2014 introduction to scalatest selenium dsl
Matthew Farwell
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
guest785f78
L04 Software Design Examples
L04 Software Design Examples
Ólafur Andri Ragnarsson
How Testability Inspires AngularJS Design / Ran Mizrahi
How Testability Inspires AngularJS Design / Ran Mizrahi
Ran Mizrahi
Selenium with py test by Alexandr Vasyliev for Lohika Odessa Python TechTalks
Selenium with py test by Alexandr Vasyliev for Lohika Odessa Python TechTalks
Lohika_Odessa_TechTalks
The JavaFX Ecosystem
The JavaFX Ecosystem
Andres Almiray
SQLAlchemy Core: An Introduction
SQLAlchemy Core: An Introduction
Jason Myers
Semelhante a Spock's New Tricks
(20)
Essential Test-Driven Development
Essential Test-Driven Development
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
Charla EHU Noviembre 2014 - Desarrollo Web
Charla EHU Noviembre 2014 - Desarrollo Web
Sequelize
Sequelize
Angular.js is super cool
Angular.js is super cool
Spock
Spock
Practical HTML5: Using It Today
Practical HTML5: Using It Today
おっぴろげJavaEE DevOps
おっぴろげJavaEE DevOps
Alien driven-development
Alien driven-development
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum Web Framework Live Coding Demos / Xitrum Web Framework ライブコーディング
Xitrum @ Scala Matsuri Tokyo 2014
Xitrum @ Scala Matsuri Tokyo 2014
Introduction to AngularJS
Introduction to AngularJS
Scaladays 2014 introduction to scalatest selenium dsl
Scaladays 2014 introduction to scalatest selenium dsl
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
Defcon_Oracle_The_Making_of_the_2nd_sql_injection_worm
L04 Software Design Examples
L04 Software Design Examples
How Testability Inspires AngularJS Design / Ran Mizrahi
How Testability Inspires AngularJS Design / Ran Mizrahi
Selenium with py test by Alexandr Vasyliev for Lohika Odessa Python TechTalks
Selenium with py test by Alexandr Vasyliev for Lohika Odessa Python TechTalks
The JavaFX Ecosystem
The JavaFX Ecosystem
SQLAlchemy Core: An Introduction
SQLAlchemy Core: An Introduction
Mais de 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
Mais de 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
Último
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
CzechDreamin
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
FIDO Alliance
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
Jennifer Lim
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
CzechDreamin
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
confluent
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
CzechDreamin
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FIDO Alliance
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
ScyllaDB
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
UXDXConf
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
Stefano
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
FIDO Alliance
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
GDSC PJATK
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
FIDO Alliance
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
John Staveley
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
FIDO Alliance
ECS 2024 Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
Femke de Vroome
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
FIDO Alliance
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
Samy Fodil
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
shyamraj55
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Julian Hyde
Último
(20)
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
ECS 2024 Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Measures in SQL (a talk at SF Distributed Systems meetup, 2024-05-22)
Spock's New Tricks
1.
SPOCK’S NEW TRICKS ANDRES ALMIRAY @AALMIRAY ANDRESALMIRAY.COM
2.
@aalmiray
3.
@aalmiray JCP Executive Committee
Associate Seat Committer Committer JSR377 Specification Lead
4.
@aalmiray 2.15.0
5.
@aalmiray SPOCK 1.0 (2015-03-02)
6.
@aalmiray FEATURES - Data Tables -
Integration with Guice, Spring, Tapestry, Unitils, Grails - Compatible with JUnit4 extensions - Custom mocking framework (Java/ Groovy) - Extensible
7.
@aalmiray PARAMETERIZATION @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' } }
8.
@aalmiray MOCK + INTERACTIONS 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!’ } }
9.
@aalmiray CARDINALITY 1 * subscriber.receive("hello") 0 * subscriber.receive("hello") (1..3) * subscriber.receive("hello") (1.._) * subscriber.receive("hello") (_..3) * subscriber.receive("hello") _ * subscriber.receive("hello")
10.
@aalmiray TARGET & METHOD 1 * subscriber.receive("hello") 1 * _.receive("hello") 1 * subscriber._("hello") 1 * subscriber./r.*e/("hello") ) 1 * _._("hello")
11.
@aalmiray ARGUMENTS 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 })
12.
@aalmiray ASCII ART? (_.._) * _._(*_) >> _
13.
@aalmiray SPOCK 1.1 (2017-05-01)
14.
@aalmiray MULTIPLE ASSERTIONS - Known
in AssertJ as “Soft Assertions” then: verifyAll { a == something b == anotherValue }
15.
@aalmiray @PENDINGFEATURE @spock.lang.Unroll class Pending extends spock.lang.Specification { @spock.lang.PendingFeature def "Should implement this later"() { expect: num1 + num2 == result where: num1 | num2 || result 2 | 2 || 4 // passes! 2 | 2 || 3 // fails! } }
16.
@aalmiray DATA TABLES @spock.lang.Unroll class CalculatorSpec extends spock.lang.Specification { def "Sum of two numbers"() { expect: num1 + num2 == result where: num1 | num2 || result 2 | 2 || 4 2 | num1 || 4 2 | 2 || num1 + num2 } }
17.
@aalmiray DETACHED MOCKS (SPRING) -
There are two choices for creating mocks - DetachedMockFactory - SpockMockFactoryBean
18.
@aalmiray DETACHED MOCKS (SPRING) class DetachedJavaConfig { def mockFactory = new DetachedMockFactory() @Bean GreeterService serviceMock() { return mockFactory.Mock(GreeterService) } @Bean GreeterService serviceStub() { return mockFactory.Stub(GreeterService) } @Bean GreeterService serviceSpy() { return mockFactory.Spy(GreeterServiceImpl) } }
19.
@aalmiray DETACHED MOCKS (SPRING) class DetachedJavaConfig { @Bean FactoryBean<GreeterService> alternativeMock() { return new SpockMockFactoryBean(GreeterService) } }
20.
@aalmiray SPOCK 1.2 (SOON)
21.
@aalmiray DETACHED MOCKS (SPRING) -
Two additional choices inspired in Spring Boot’s @MockBean - @SpringBean - @SpringSpy
22.
@aalmiray DETACHED MOCKS (SPRING) @org.springframework.test.context.ContextConfiguration class SpringExample extends spock.lang.Specification { @org.spockframework.spring.SpringBean Service1 service1 = Mock() @org.spockframework.spring.SpringBean Service2 service2 = Stub() { generateQuickBrownFox() >> "blubb" } // continued in next slide
23.
@aalmiray DETACHED MOCKS (SPRING) def "injection with stubbing works"() { expect: service2.generateQuickBrownFox() == "blubb" } def "mocking works was well"() { when: def result = service1.generateString() then: result == "Foo" 1 * service1.generateString() >> "Foo" } }
24.
@aalmiray DETACHED MOCKS (GUICE) -
Similar to Spring’s support, you may use DetachedMockFactory with Guice’s Injector
25.
@aalmiray JUKITO @RunWith(JukitoRunner.class) public class AppControllerTest { @Inject private AppController controller; @Inject private AppModel model; @Test public void happyPath(HelloService service) { // given: String input = "Test"; String output = "Hello Test"; when(service.sayHello(input)).thenReturn(output); // when: model.setInput(input); controller.sayHello(); // then: assertThat(model.getOutput(), equalTo(output)); verify(service, only()).sayHello(input); } }
26.
@aalmiray SPOCK @UseModules(TestModule) class AppControllerSpec extends Specification { @Inject private AppController controller @Inject private AppModel model @Inject private HelloService service def happyPath() { given: "The HelloService mock is configured to return 'Hello $input'" 1 * service.sayHello('Test') >> 'Hello Test' when: "The input is set to 'Test'" model.input = 'Test' and: "The sayHello action is invoked on the controller" controller.sayHello() then: "The output should be 'Hello Test'" model.output == 'Hello Test' } // continued in next slide
27.
@aalmiray SPOCK // continued from last slide static class TestModule extends AppModule { private final MockFactory mockFactory = new DetachedMockFactory() @Override protected void bindHelloService() { bind(HelloService).toInstance(mockFactory.Mock(HelloService)) } } }
28.
@aalmiray @AUTOATTACH - Use this
feature if you need to attach mocks without leveraging Spring or Guice
29.
@aalmiray @AUTOATTACH class AutoAttachSpec extends spock.lang.Specification { def mockFactory = new spock.mock.DetachedMockFactory() @spock.mock.AutoAttach List<String> mock = mockFactory.Mock(List) def "Auto attaches mock to spec"() { when: mock.add("foo") then: 1 * mock.add(_) } }
30.
@aalmiray
31.
@aalmiray @RETRY @spock.lang.Unroll class RetryExample extends spock.lang.Specification { @spock.lang.Retry def bar() { expect: test where: test << [false, true, true] } }
32.
@aalmiray ADDITIONAL INTERFACES class AdditionalInterfaces extends spock.lang.Specification { def "java stubs"() { given: def stub = Stub(List, additionalInterfaces: [Closeable]) expect: stub instanceof List stub instanceof Closeable } }
33.
@aalmiray ADDITIONAL INTERFACES class AdditionalInterfaces extends spock.lang.Specification { def "java mocks"() { given: def mock = Mock(List, additionalInterfaces: [Closeable]) expect: mock instanceof List mock instanceof Closeable } }
34.
@aalmiray REPORTS
35.
@aalmiray SPOCK-REPORTS - https://github.com/renatoathaydes/ spock-reports - Generates
developer friendly reports. - Generates customer friendly reports, following BDD conventions
36.
@aalmiray
37.
@aalmiray SPOCK-REPORTS def happyPath() { given: "The HelloService mock is configured to return 'Hello $input'" 1 * service.sayHello('Test') >> 'Hello Test' when: "The input is set to 'Test'" model.input = 'Test' and: "The sayHello action is invoked on the controller" controller.sayHello() then: "The output should be 'Hello Test'" model.output == 'Hello Test' }
38.
@aalmiray
39.
@aalmiray MIGRATION
40.
@aalmiray JUNIT2SPOCK - Lukasz Opaluch
wrote Junit2Spock - https://github.com/opaluchlukasz/ junit2spock
41.
@aalmiray
42.
@aalmiray HTTP://ANDRESALMIRAY.COM/NEWSLETTER HTTP://ANDRESALMIRAY.COM/EDITORIAL
43.
THANK YOU! ANDRES ALMIRAY @AALMIRAY ANDRESALMIRAY.COM
Baixar agora