SlideShare una empresa de Scribd logo
1 de 48
Descargar para leer sin conexión
Test-Oriented Languages: is
          it time for a new era?
          Ben Stopford : The Royal Bank of Scotland




Friday, 25 March 2011
Mocking is fundamental part
          of Test Driven Development



Friday, 25 March 2011
But how much further can
          we go in current imperative
          languages?



Friday, 25 March 2011
What might we improve if
            we were not inhibited by
            current mainstream
            compilers?


Friday, 25 March 2011
What might we do with a
          blank slate?




Friday, 25 March 2011
Quilt




Friday, 25 March 2011
How is Quilt Different


               Stub methods not classes
               Compiler significantly reduces the amount of test code
               that must be written to provide isolation




Friday, 25 March 2011
Taking step back...



Friday, 25 March 2011
What are the motivations for
           mock driven development?




Friday, 25 March 2011
State based tests inevitably
          overlap
                                     !"#$%&'($%




                        !"#$%&'($%




Friday, 25 March 2011
This makes it hard to
         diagnose the source of a
         break.            !"#$%&'($%




                        !"#$%&'($%




Friday, 25 March 2011
The solution is to use mock
         objects to provide substitute
         interactions that we can
         assert from our test    !"#$%&'($%




              !"#$%&'($%




Friday, 25 March 2011
Current Challenges




Friday, 25 March 2011
Coupling between test and
          source



Friday, 25 March 2011
“I've always been a old
          
 
 
 
 fashioned classic TDDer
          and thus far I don't see any
          reason to change. I don't see any
          compelling benefits for mockist
          TDD, and am concerned about
          the consequences of coupling
          tests to implementation.”
Friday, 25 March 2011
The JMock Era




Friday, 25 March 2011
Mock Interactions




Friday, 25 March 2011
All interactions must be
          explicitly coded in the test


              !"#$%&'($%



Friday, 25 March 2011
The Mockito Era




Friday, 25 March 2011
Only mock interactions you
          care about


         !"#$%&'($%



Friday, 25 March 2011
This reduces coupling
          between test and class




Friday, 25 March 2011
Quilt takes this concept
          further by only requiring
          methods to be stubbed not
          whole objects (but more on
          that later)



Friday, 25 March 2011
The Testing Barrier



               To do Mock-Driven development you need to test first




Friday, 25 March 2011
Should it be like this?




Friday, 25 March 2011
In quilt it’s as easy to test
          after as it is to test first


                        !"#$%&'($%




Friday, 25 March 2011
What Makes Quilt Different?




Friday, 25 March 2011
The complier isolates
          testable units for you.

          Where it needs your input it
          requires that you provide it.


Friday, 25 March 2011
So when you run a test the
          compiler will restrict the
          execution scope, say to a
          single class

                        !"#$%&'($%


Friday, 25 March 2011
If that class under test calls
          other classes the compiler
          will automatically isolate the
          interactions

                        !"#$%&'($%




Friday, 25 March 2011
If those interactions return
          state then the compiler
          requires that a active stub
          be declared in the test

                        !"#$%&'($%



Friday, 25 March 2011
So quilt creates seams
          around the testable unit
          isolating the functionality
          under test         !"#$%&




Friday, 25 March 2011
Methods are Stubbed not
          Objects


                        !"#$%&'($%




Friday, 25 March 2011
Testing units can be one or
          many classes: a Patch
             91,''#'%,2#%)2.60#5%   +,&-"#'%,2#%'#0,2,&#5%
             *$&.%,%:+,&-";%        78%:<#,/';%




   !"#$%&#'($)%&"*'%+,&-"%&"#%
   -./0*1#2%3*11%4.2-#%&"#%
   5#-1,2,(.$%.4%,%'&677#5%
   2#&62$%&80#%4.2%&"*'%/#&".5%
Friday, 25 March 2011
There is no need for
          dependency injection for the
          purpose of testing




Friday, 25 March 2011
The barrier for testing is
          lowered




Friday, 25 March 2011
Looking more closely




Friday, 25 March 2011
Compilation Ensures that
          Stubs are Required only if
          they Affect the Output of the
          Test.




Friday, 25 March 2011
class ConstructionSite{
          	 Digger digger = new Digger();
          	 Mixer mixer = new CementMixer();                           !"#$%&'(($
          	 Foreman foreman = new Foreman();
          	       ConstructionSite(){}

          	       ConstructionSite(Digger d, Mixer m, Foreman f){
          	       	 digger = d;
          	       	 mixer = m;
          	       	 foreman = f;
          	       }
          	       	
          	       boolean buildFoundation(Bricks bricks){
          	       	
          	       	 Cement cement = mixer.mix();
          	       	 Foundation foundation = digger.dig();
          	       	 BrickLayer layer = foreman.getLayer();
          	
          	       	     if(!cement.isSolid() && bricks.size()> 100){
          	       	     	 Posts posts = layer.lay(bricks, cement);
          	       	     	 foundation.fill(posts);
          	       	     	 return true;
          	       	     }
          	       	     return false;
          	       }
          }

Friday, 25 March 2011
!"#$!#%&$
                                                                          '()*)+$
          @Test
          shouldBuildFoundationsWithLotsOfBricksAndSlowDryingCement(){
          	 Digger digger = mock(Digger.class);
          	 CementMixer mixer = mock(CementMixer.class);
          	 Foreman foreman = mock(Foreman.class);
          	 Cement cement = mock(Cement.class);
          	 BrickLayer layer = mock(BrickLayer.class);
          	 Foundation foundation = mock(Foundation.class);
          	       when(mixer.mix()).thenReturn(cement);
          	       when(digger.dig()).thenReturn(foundation);
          	       when(cement.isSolid	 ()).thenReturn(Boolean.FALSE);
          	       when(foreman.getLayer()).thenReturn(layer);
          	
          	       ConstructionSite site = new ConstructionSite(digger, mixer, foreman);
          	       assertTrue(site.buildFoundation(new Bricks(101)))
          }




Friday, 25 March 2011
In all this mock/stub setup only two parts
          are actually pertinent to the test:

             @Test
             shouldBuildFoundationsWithLotsOfBricksAndSlowDryingCement(){
             	 Digger digger = mock(Digger.class);
             	 CementMixer mixer = mock(CementMixer.class);
             	 Foreman foreman = mock(Foreman.class);
             	 Cement cement = mock(Cement.class);
             	 BrickLayer layer = mock(BrickLayer.class);
             	 Foundation foundation = mock(Foundation.class);
             	          when(mixer.mix()).thenReturn(cement);
             	          when(digger.dig()).thenReturn(foundation);
             	          when(cement.isSolid	 ()).thenReturn(Boolean.FALSE);
             	          when(foreman.getLayer()).thenReturn(layer);
             	
             	          ConstructionSite site = new ConstructionSite(digger, mixer, foreman);
             	          assertTrue(site.buildFoundation(new Bricks(101)))
             }


Friday, 25 March 2011
!"#$!#%&$
                                                       '()*+&,$

          shouldBuildFoundationsWithLotsOfBricksAndSlowDryi
          ngCement(){
          	 Seam:
          	 	 cement.isSolid() returns false;
          	 	 bricks.size returns 100;
          	 AssertTrue:
          	 	 new ConstructionSite().buildFoundation(..);
          	
          }}



Friday, 25 March 2011
No need to set up stub objects
          shouldBuildFoundationsWithLotsOfBricksAndSlowDryi
          ngCement(){
          	 Seam:
          	 	 cement.isSolid() returns false;
          	 	 bricks.size returns 100;
          	 AssertTrue:
          	 	 new ConstructionSite().buildFoundation(..);
          	
          }}



Friday, 25 March 2011
Stub Methods not Objects
          shouldBuildFoundationsWithLotsOfBricksAndSlowDryi
          ngCement(){
          	 Seam:
          	 	 cement.isSolid() returns false;
          	 	 bricks.size returns 100;
          	 AssertTrue:
          	 	 new ConstructionSite().buildFoundation(..);
          	
          }}



Friday, 25 March 2011
Avoiding mock object chains


         input.do().do().do() returns “foo”;




Friday, 25 March 2011
Static analysis lies at the
          heart of the Quilt compiler

               The compiler tracks the state used in the class under
               test.
               A bottom up analysis technique allows the compiler to
               exclude cross seam calls that cannot affect the test
               output.




Friday, 25 March 2011
The unit under test should
          be more than one class
             91,''#'%,2#%)2.60#5%   +,&-"#'%,2#%'#0,2,&#5%
             *$&.%,%:+,&-";%        78%:<#,/';%




   !"#$%&#'($)%&"*'%+,&-"%&"#%
   -./0*1#2%3*11%4.2-#%&"#%
   5#-1,2,(.$%.4%,%'&677#5%
   2#&62$%&80#%4.2%&"*'%/#&".5%
Friday, 25 March 2011
Quilt Test: Running multiple
          patches together


            !"#$%&'()%&




Friday, 25 March 2011
Quilt: A new approach to
          testing
               Compiler stubs as much   There is no need to
               as possible              create mock or stub
                                        objects and inject them
               Compiler forces the
                                        into the test
               isolation of the code
               under test               Developer needs to write
                                        the absolute minimum
               Methods are mocked not
                                        amount of test code
               objects
                                        Can even test an existing
                                        class


Friday, 25 March 2011

Más contenido relacionado

Más de Ben Stopford

10 Principals for Effective Event-Driven Microservices with Apache Kafka
10 Principals for Effective Event-Driven Microservices with Apache Kafka10 Principals for Effective Event-Driven Microservices with Apache Kafka
10 Principals for Effective Event-Driven Microservices with Apache KafkaBen Stopford
 
10 Principals for Effective Event Driven Microservices
10 Principals for Effective Event Driven Microservices10 Principals for Effective Event Driven Microservices
10 Principals for Effective Event Driven MicroservicesBen Stopford
 
The Future of Streaming: Global Apps, Event Stores and Serverless
The Future of Streaming: Global Apps, Event Stores and ServerlessThe Future of Streaming: Global Apps, Event Stores and Serverless
The Future of Streaming: Global Apps, Event Stores and ServerlessBen Stopford
 
A Global Source of Truth for the Microservices Generation
A Global Source of Truth for the Microservices GenerationA Global Source of Truth for the Microservices Generation
A Global Source of Truth for the Microservices GenerationBen Stopford
 
Building Event Driven Services with Kafka Streams
Building Event Driven Services with Kafka StreamsBuilding Event Driven Services with Kafka Streams
Building Event Driven Services with Kafka StreamsBen Stopford
 
NDC London 2017 - The Data Dichotomy- Rethinking Data and Services with Streams
NDC London 2017  - The Data Dichotomy- Rethinking Data and Services with StreamsNDC London 2017  - The Data Dichotomy- Rethinking Data and Services with Streams
NDC London 2017 - The Data Dichotomy- Rethinking Data and Services with StreamsBen Stopford
 
Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...
Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...
Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...Ben Stopford
 
Building Event Driven Services with Stateful Streams
Building Event Driven Services with Stateful StreamsBuilding Event Driven Services with Stateful Streams
Building Event Driven Services with Stateful StreamsBen Stopford
 
Devoxx London 2017 - Rethinking Services With Stateful Streams
Devoxx London 2017 - Rethinking Services With Stateful StreamsDevoxx London 2017 - Rethinking Services With Stateful Streams
Devoxx London 2017 - Rethinking Services With Stateful StreamsBen Stopford
 
Event Driven Services Part 2: Building Event-Driven Services with Apache Kafka
Event Driven Services Part 2:  Building Event-Driven Services with Apache KafkaEvent Driven Services Part 2:  Building Event-Driven Services with Apache Kafka
Event Driven Services Part 2: Building Event-Driven Services with Apache KafkaBen Stopford
 
Event Driven Services Part 1: The Data Dichotomy
Event Driven Services Part 1: The Data Dichotomy Event Driven Services Part 1: The Data Dichotomy
Event Driven Services Part 1: The Data Dichotomy Ben Stopford
 
Event Driven Services Part 3: Putting the Micro into Microservices with State...
Event Driven Services Part 3: Putting the Micro into Microservices with State...Event Driven Services Part 3: Putting the Micro into Microservices with State...
Event Driven Services Part 3: Putting the Micro into Microservices with State...Ben Stopford
 
Strata Software Architecture NY: The Data Dichotomy
Strata Software Architecture NY: The Data DichotomyStrata Software Architecture NY: The Data Dichotomy
Strata Software Architecture NY: The Data DichotomyBen Stopford
 
A little bit of clojure
A little bit of clojureA little bit of clojure
A little bit of clojureBen Stopford
 
Big iron 2 (published)
Big iron 2 (published)Big iron 2 (published)
Big iron 2 (published)Ben Stopford
 
The return of big iron?
The return of big iron?The return of big iron?
The return of big iron?Ben Stopford
 
Big Data & the Enterprise
Big Data & the EnterpriseBig Data & the Enterprise
Big Data & the EnterpriseBen Stopford
 
Where Does Big Data Meet Big Database - QCon 2012
Where Does Big Data Meet Big Database - QCon 2012Where Does Big Data Meet Big Database - QCon 2012
Where Does Big Data Meet Big Database - QCon 2012Ben Stopford
 
Advanced databases ben stopford
Advanced databases   ben stopfordAdvanced databases   ben stopford
Advanced databases ben stopfordBen Stopford
 
A Paradigm Shift: The Increasing Dominance of Memory-Oriented Solutions for H...
A Paradigm Shift: The Increasing Dominance of Memory-Oriented Solutions for H...A Paradigm Shift: The Increasing Dominance of Memory-Oriented Solutions for H...
A Paradigm Shift: The Increasing Dominance of Memory-Oriented Solutions for H...Ben Stopford
 

Más de Ben Stopford (20)

10 Principals for Effective Event-Driven Microservices with Apache Kafka
10 Principals for Effective Event-Driven Microservices with Apache Kafka10 Principals for Effective Event-Driven Microservices with Apache Kafka
10 Principals for Effective Event-Driven Microservices with Apache Kafka
 
10 Principals for Effective Event Driven Microservices
10 Principals for Effective Event Driven Microservices10 Principals for Effective Event Driven Microservices
10 Principals for Effective Event Driven Microservices
 
The Future of Streaming: Global Apps, Event Stores and Serverless
The Future of Streaming: Global Apps, Event Stores and ServerlessThe Future of Streaming: Global Apps, Event Stores and Serverless
The Future of Streaming: Global Apps, Event Stores and Serverless
 
A Global Source of Truth for the Microservices Generation
A Global Source of Truth for the Microservices GenerationA Global Source of Truth for the Microservices Generation
A Global Source of Truth for the Microservices Generation
 
Building Event Driven Services with Kafka Streams
Building Event Driven Services with Kafka StreamsBuilding Event Driven Services with Kafka Streams
Building Event Driven Services with Kafka Streams
 
NDC London 2017 - The Data Dichotomy- Rethinking Data and Services with Streams
NDC London 2017  - The Data Dichotomy- Rethinking Data and Services with StreamsNDC London 2017  - The Data Dichotomy- Rethinking Data and Services with Streams
NDC London 2017 - The Data Dichotomy- Rethinking Data and Services with Streams
 
Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...
Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...
Building Event Driven Services with Apache Kafka and Kafka Streams - Devoxx B...
 
Building Event Driven Services with Stateful Streams
Building Event Driven Services with Stateful StreamsBuilding Event Driven Services with Stateful Streams
Building Event Driven Services with Stateful Streams
 
Devoxx London 2017 - Rethinking Services With Stateful Streams
Devoxx London 2017 - Rethinking Services With Stateful StreamsDevoxx London 2017 - Rethinking Services With Stateful Streams
Devoxx London 2017 - Rethinking Services With Stateful Streams
 
Event Driven Services Part 2: Building Event-Driven Services with Apache Kafka
Event Driven Services Part 2:  Building Event-Driven Services with Apache KafkaEvent Driven Services Part 2:  Building Event-Driven Services with Apache Kafka
Event Driven Services Part 2: Building Event-Driven Services with Apache Kafka
 
Event Driven Services Part 1: The Data Dichotomy
Event Driven Services Part 1: The Data Dichotomy Event Driven Services Part 1: The Data Dichotomy
Event Driven Services Part 1: The Data Dichotomy
 
Event Driven Services Part 3: Putting the Micro into Microservices with State...
Event Driven Services Part 3: Putting the Micro into Microservices with State...Event Driven Services Part 3: Putting the Micro into Microservices with State...
Event Driven Services Part 3: Putting the Micro into Microservices with State...
 
Strata Software Architecture NY: The Data Dichotomy
Strata Software Architecture NY: The Data DichotomyStrata Software Architecture NY: The Data Dichotomy
Strata Software Architecture NY: The Data Dichotomy
 
A little bit of clojure
A little bit of clojureA little bit of clojure
A little bit of clojure
 
Big iron 2 (published)
Big iron 2 (published)Big iron 2 (published)
Big iron 2 (published)
 
The return of big iron?
The return of big iron?The return of big iron?
The return of big iron?
 
Big Data & the Enterprise
Big Data & the EnterpriseBig Data & the Enterprise
Big Data & the Enterprise
 
Where Does Big Data Meet Big Database - QCon 2012
Where Does Big Data Meet Big Database - QCon 2012Where Does Big Data Meet Big Database - QCon 2012
Where Does Big Data Meet Big Database - QCon 2012
 
Advanced databases ben stopford
Advanced databases   ben stopfordAdvanced databases   ben stopford
Advanced databases ben stopford
 
A Paradigm Shift: The Increasing Dominance of Memory-Oriented Solutions for H...
A Paradigm Shift: The Increasing Dominance of Memory-Oriented Solutions for H...A Paradigm Shift: The Increasing Dominance of Memory-Oriented Solutions for H...
A Paradigm Shift: The Increasing Dominance of Memory-Oriented Solutions for H...
 

Test-Oriented Languages: Is it time for a new era?

  • 1. Test-Oriented Languages: is it time for a new era? Ben Stopford : The Royal Bank of Scotland Friday, 25 March 2011
  • 2. Mocking is fundamental part of Test Driven Development Friday, 25 March 2011
  • 3. But how much further can we go in current imperative languages? Friday, 25 March 2011
  • 4. What might we improve if we were not inhibited by current mainstream compilers? Friday, 25 March 2011
  • 5. What might we do with a blank slate? Friday, 25 March 2011
  • 7. How is Quilt Different Stub methods not classes Compiler significantly reduces the amount of test code that must be written to provide isolation Friday, 25 March 2011
  • 9. What are the motivations for mock driven development? Friday, 25 March 2011
  • 10. State based tests inevitably overlap !"#$%&'($% !"#$%&'($% Friday, 25 March 2011
  • 11. This makes it hard to diagnose the source of a break. !"#$%&'($% !"#$%&'($% Friday, 25 March 2011
  • 12. The solution is to use mock objects to provide substitute interactions that we can assert from our test !"#$%&'($% !"#$%&'($% Friday, 25 March 2011
  • 14. Coupling between test and source Friday, 25 March 2011
  • 15. “I've always been a old fashioned classic TDDer and thus far I don't see any reason to change. I don't see any compelling benefits for mockist TDD, and am concerned about the consequences of coupling tests to implementation.” Friday, 25 March 2011
  • 16. The JMock Era Friday, 25 March 2011
  • 18. All interactions must be explicitly coded in the test !"#$%&'($% Friday, 25 March 2011
  • 19. The Mockito Era Friday, 25 March 2011
  • 20. Only mock interactions you care about !"#$%&'($% Friday, 25 March 2011
  • 21. This reduces coupling between test and class Friday, 25 March 2011
  • 22. Quilt takes this concept further by only requiring methods to be stubbed not whole objects (but more on that later) Friday, 25 March 2011
  • 23. The Testing Barrier To do Mock-Driven development you need to test first Friday, 25 March 2011
  • 24. Should it be like this? Friday, 25 March 2011
  • 25. In quilt it’s as easy to test after as it is to test first !"#$%&'($% Friday, 25 March 2011
  • 26. What Makes Quilt Different? Friday, 25 March 2011
  • 27. The complier isolates testable units for you. Where it needs your input it requires that you provide it. Friday, 25 March 2011
  • 28. So when you run a test the compiler will restrict the execution scope, say to a single class !"#$%&'($% Friday, 25 March 2011
  • 29. If that class under test calls other classes the compiler will automatically isolate the interactions !"#$%&'($% Friday, 25 March 2011
  • 30. If those interactions return state then the compiler requires that a active stub be declared in the test !"#$%&'($% Friday, 25 March 2011
  • 31. So quilt creates seams around the testable unit isolating the functionality under test !"#$%& Friday, 25 March 2011
  • 32. Methods are Stubbed not Objects !"#$%&'($% Friday, 25 March 2011
  • 33. Testing units can be one or many classes: a Patch 91,''#'%,2#%)2.60#5% +,&-"#'%,2#%'#0,2,&#5% *$&.%,%:+,&-";% 78%:<#,/';% !"#$%&#'($)%&"*'%+,&-"%&"#% -./0*1#2%3*11%4.2-#%&"#% 5#-1,2,(.$%.4%,%'&677#5% 2#&62$%&80#%4.2%&"*'%/#&".5% Friday, 25 March 2011
  • 34. There is no need for dependency injection for the purpose of testing Friday, 25 March 2011
  • 35. The barrier for testing is lowered Friday, 25 March 2011
  • 37. Compilation Ensures that Stubs are Required only if they Affect the Output of the Test. Friday, 25 March 2011
  • 38. class ConstructionSite{ Digger digger = new Digger(); Mixer mixer = new CementMixer(); !"#$%&'(($ Foreman foreman = new Foreman(); ConstructionSite(){} ConstructionSite(Digger d, Mixer m, Foreman f){ digger = d; mixer = m; foreman = f; } boolean buildFoundation(Bricks bricks){ Cement cement = mixer.mix(); Foundation foundation = digger.dig(); BrickLayer layer = foreman.getLayer(); if(!cement.isSolid() && bricks.size()> 100){ Posts posts = layer.lay(bricks, cement); foundation.fill(posts); return true; } return false; } } Friday, 25 March 2011
  • 39. !"#$!#%&$ '()*)+$ @Test shouldBuildFoundationsWithLotsOfBricksAndSlowDryingCement(){ Digger digger = mock(Digger.class); CementMixer mixer = mock(CementMixer.class); Foreman foreman = mock(Foreman.class); Cement cement = mock(Cement.class); BrickLayer layer = mock(BrickLayer.class); Foundation foundation = mock(Foundation.class); when(mixer.mix()).thenReturn(cement); when(digger.dig()).thenReturn(foundation); when(cement.isSolid ()).thenReturn(Boolean.FALSE); when(foreman.getLayer()).thenReturn(layer); ConstructionSite site = new ConstructionSite(digger, mixer, foreman); assertTrue(site.buildFoundation(new Bricks(101))) } Friday, 25 March 2011
  • 40. In all this mock/stub setup only two parts are actually pertinent to the test: @Test shouldBuildFoundationsWithLotsOfBricksAndSlowDryingCement(){ Digger digger = mock(Digger.class); CementMixer mixer = mock(CementMixer.class); Foreman foreman = mock(Foreman.class); Cement cement = mock(Cement.class); BrickLayer layer = mock(BrickLayer.class); Foundation foundation = mock(Foundation.class); when(mixer.mix()).thenReturn(cement); when(digger.dig()).thenReturn(foundation); when(cement.isSolid ()).thenReturn(Boolean.FALSE); when(foreman.getLayer()).thenReturn(layer); ConstructionSite site = new ConstructionSite(digger, mixer, foreman); assertTrue(site.buildFoundation(new Bricks(101))) } Friday, 25 March 2011
  • 41. !"#$!#%&$ '()*+&,$ shouldBuildFoundationsWithLotsOfBricksAndSlowDryi ngCement(){ Seam: cement.isSolid() returns false; bricks.size returns 100; AssertTrue: new ConstructionSite().buildFoundation(..); }} Friday, 25 March 2011
  • 42. No need to set up stub objects shouldBuildFoundationsWithLotsOfBricksAndSlowDryi ngCement(){ Seam: cement.isSolid() returns false; bricks.size returns 100; AssertTrue: new ConstructionSite().buildFoundation(..); }} Friday, 25 March 2011
  • 43. Stub Methods not Objects shouldBuildFoundationsWithLotsOfBricksAndSlowDryi ngCement(){ Seam: cement.isSolid() returns false; bricks.size returns 100; AssertTrue: new ConstructionSite().buildFoundation(..); }} Friday, 25 March 2011
  • 44. Avoiding mock object chains input.do().do().do() returns “foo”; Friday, 25 March 2011
  • 45. Static analysis lies at the heart of the Quilt compiler The compiler tracks the state used in the class under test. A bottom up analysis technique allows the compiler to exclude cross seam calls that cannot affect the test output. Friday, 25 March 2011
  • 46. The unit under test should be more than one class 91,''#'%,2#%)2.60#5% +,&-"#'%,2#%'#0,2,&#5% *$&.%,%:+,&-";% 78%:<#,/';% !"#$%&#'($)%&"*'%+,&-"%&"#% -./0*1#2%3*11%4.2-#%&"#% 5#-1,2,(.$%.4%,%'&677#5% 2#&62$%&80#%4.2%&"*'%/#&".5% Friday, 25 March 2011
  • 47. Quilt Test: Running multiple patches together !"#$%&'()%& Friday, 25 March 2011
  • 48. Quilt: A new approach to testing Compiler stubs as much There is no need to as possible create mock or stub objects and inject them Compiler forces the into the test isolation of the code under test Developer needs to write the absolute minimum Methods are mocked not amount of test code objects Can even test an existing class Friday, 25 March 2011