SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
DUBLERZY TESTOWI
1.Prezentacja kodu
2.Dublerzy - kiedy i po co?
3.Dummy
4.Stub
5.Mock
6.Spy
Prezentacja kodu
MOCKI
KLASYCZNE TESTOWANIE


                    FIXTURE
         Setup
         Exercise
  TEST              SUT
         Verify
TEST Z ZALEŻNOŚCIĄ


                    FIXTURE


TEST          SUT             DOC
POŚREDNIE WEJŚCIA


                    FIXTURE


TEST          SUT               DOC

                     Indirect
                     Input
POŚREDNIE WYJŚCIA


                    FIXTURE


TEST          SUT               DOC

                     Indirect
                     Output
RODZAJE DUBLERÓW
DUMMY OBJECT
●   wypełnia listę parametrów
●   kiedy nie można przekazać
    nulla
●   nie używany
@Test
public void shouldAddLineItem() {
    Product product = new Product("Dummy Name", getUniqueNumber());
    Invoice invoice = new Invoice(new DummyCustomer());

    invoice.addItemQuantity(product, QUANTITY);

    LineItem expectedLineItem = new LineItem(invoice, product, QUANTITY);
    assertLineItemsEqual("", expectedLineItem, invoice.getFirstLineItem());
}
TEST STUB
 ●   Responder
 ●   Saboteur
TEST STUB
@Test
public void productNotFound() {
  mockery.checking(new Expectations() {{
    allowing(catalog).findItem(BARCODE);
    will(throwException(new ProductNotFoundException(BARCODE)));
    oneOf(display).displayProductNotFoundMessage(BARCODE);
  }});

    pointOfSale.onBarcode(BARCODE);
}




@Test
public void addAMovie() {
  MovieListPresenter movieListPresenter = presenterWithNoMovies();
  when(movieView.getNewTitle()).thenReturn(STAR_WARS);
    movieListPresenter.add();

    verify(movieView).showMovies(list(movieTitled(STAR_WARS)));
}
MOCK OBJECT

                   WER
                      Y      FIKA
                                  C   JA Z
                                           ACH
                                               OWA
                                                   NIA
@Test
public void emptyBarcode() throws Exception {
  mockery.checking(new Expectations() {{
    oneOf(display).displayEmptyBarcodeMessage();
  }});

    pointOfSale.onBarcode("");
}
TEST SPY

                              STUB+MOCK

predefiniowane odpowiedzi



                            weryfikacja zachowania
TEST SPY




@Test
public void addAMovie() {
  MovieListPresenter movieListPresenter = presenterWithNoMovies();
  when(movieView.getNewTitle()).thenReturn(STAR_WARS);
    movieListPresenter.add();

    verify(movieView).showMovies(list(movieTitled(STAR_WARS)));
}
FAKE


   DZIAŁAJĄCA,
ALE UPROSZCZONA
 IMPLEMENTACJA
Bibliografia
●   Gerard Meszaros, xUnit Test Patterns, Addison-
    Wesley 2007
●   http://xunitpatterns.com/
●   http://martinfowler.com/articles/mocksArentStub
    s.html
DZIĘKUJĘ




                        Zdjęcia:
[8] http://xunitpatterns.com/Types%20Of%20Test%20Doubles.gif
[9] http://www.flickr.com/photos/lincolnblues/1413187481
[10,11]http://www.flickr.com/photos/21123209@N06/2460486552/
[14] http://www.flickr.com/photos/dunechaser/2630433944

Contenu connexe

Tendances

Sumsem2014 15 cp0399-13-jun-2015_rm01_programs
Sumsem2014 15 cp0399-13-jun-2015_rm01_programsSumsem2014 15 cp0399-13-jun-2015_rm01_programs
Sumsem2014 15 cp0399-13-jun-2015_rm01_programs
Abhijit Borah
 
Unit testing with Easymock
Unit testing with EasymockUnit testing with Easymock
Unit testing with Easymock
Ürgo Ringo
 
Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)
Oliver Klee
 

Tendances (20)

Introduction to Unit Testing (Part 2 of 2)
Introduction to Unit Testing (Part 2 of 2)Introduction to Unit Testing (Part 2 of 2)
Introduction to Unit Testing (Part 2 of 2)
 
Core java
Core javaCore java
Core java
 
10 Typical Problems in Enterprise Java Applications
10 Typical Problems in Enterprise Java Applications10 Typical Problems in Enterprise Java Applications
10 Typical Problems in Enterprise Java Applications
 
TDD per Webapps
TDD per WebappsTDD per Webapps
TDD per Webapps
 
Sumsem2014 15 cp0399-13-jun-2015_rm01_programs
Sumsem2014 15 cp0399-13-jun-2015_rm01_programsSumsem2014 15 cp0399-13-jun-2015_rm01_programs
Sumsem2014 15 cp0399-13-jun-2015_rm01_programs
 
Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)Developer Tests - Things to Know (Vilnius JUG)
Developer Tests - Things to Know (Vilnius JUG)
 
2013-06-24 - Software Craftsmanship with JavaScript
2013-06-24 - Software Craftsmanship with JavaScript2013-06-24 - Software Craftsmanship with JavaScript
2013-06-24 - Software Craftsmanship with JavaScript
 
2013-06-15 - Software Craftsmanship mit JavaScript
2013-06-15 - Software Craftsmanship mit JavaScript2013-06-15 - Software Craftsmanship mit JavaScript
2013-06-15 - Software Craftsmanship mit JavaScript
 
Mockito intro
Mockito introMockito intro
Mockito intro
 
Programação de Jogos - Design Patterns
Programação de Jogos - Design PatternsProgramação de Jogos - Design Patterns
Programação de Jogos - Design Patterns
 
GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good TestsGeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good Tests
 
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good TestsConfitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good Tests
 
Basic Unit Testing with Mockito
Basic Unit Testing with MockitoBasic Unit Testing with Mockito
Basic Unit Testing with Mockito
 
Unit testing with Easymock
Unit testing with EasymockUnit testing with Easymock
Unit testing with Easymock
 
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
 
Rethrowing exception- JAVA
Rethrowing exception- JAVARethrowing exception- JAVA
Rethrowing exception- JAVA
 
2013 DevFest Vienna - Bad Tests, Good Tests
2013 DevFest Vienna - Bad Tests, Good Tests2013 DevFest Vienna - Bad Tests, Good Tests
2013 DevFest Vienna - Bad Tests, Good Tests
 
Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)Test-driven development for TYPO3 (T3DD11)
Test-driven development for TYPO3 (T3DD11)
 
One definition rule - что это такое, и как с этим жить
One definition rule - что это такое, и как с этим житьOne definition rule - что это такое, и как с этим жить
One definition rule - что это такое, и как с этим жить
 
Unit Testing: Special Cases
Unit Testing: Special CasesUnit Testing: Special Cases
Unit Testing: Special Cases
 

Similaire à 04 - Dublerzy testowi

J unit스터디슬라이드
J unit스터디슬라이드J unit스터디슬라이드
J unit스터디슬라이드
ksain
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Robot Media
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
Tomek Kaczanowski
 

Similaire à 04 - Dublerzy testowi (20)

Android testing
Android testingAndroid testing
Android testing
 
Tests unitaires mock_kesako_20130516
Tests unitaires mock_kesako_20130516Tests unitaires mock_kesako_20130516
Tests unitaires mock_kesako_20130516
 
03 - Testowanie GUI
03 - Testowanie GUI03 - Testowanie GUI
03 - Testowanie GUI
 
Junit 5 - Maior e melhor
Junit 5 - Maior e melhorJunit 5 - Maior e melhor
Junit 5 - Maior e melhor
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113Conf soat tests_unitaires_Mockito_jUnit_170113
Conf soat tests_unitaires_Mockito_jUnit_170113
 
Test Time Bombs
Test Time BombsTest Time Bombs
Test Time Bombs
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
 
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)"Unit Testing for Mobile App" by Fandy Gotama  (OLX Indonesia)
"Unit Testing for Mobile App" by Fandy Gotama (OLX Indonesia)
 
Tech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile appsTech In Asia PDC 2017 - Best practice unit testing in mobile apps
Tech In Asia PDC 2017 - Best practice unit testing in mobile apps
 
Agile Android
Agile AndroidAgile Android
Agile Android
 
Developer Test - Things to Know
Developer Test - Things to KnowDeveloper Test - Things to Know
Developer Test - Things to Know
 
Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4Testing, Performance Analysis, and jQuery 1.4
Testing, Performance Analysis, and jQuery 1.4
 
J unit스터디슬라이드
J unit스터디슬라이드J unit스터디슬라이드
J unit스터디슬라이드
 
Unit testing 101
Unit testing 101Unit testing 101
Unit testing 101
 
Junit mockito and PowerMock in Java
Junit mockito and  PowerMock in JavaJunit mockito and  PowerMock in Java
Junit mockito and PowerMock in Java
 
Dat testing - An introduction to Java and Android Testing
Dat testing - An introduction to Java and Android TestingDat testing - An introduction to Java and Android Testing
Dat testing - An introduction to Java and Android Testing
 
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMockUnit testing in iOS featuring OCUnit, GHUnit & OCMock
Unit testing in iOS featuring OCUnit, GHUnit & OCMock
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 
31b - JUnit and Mockito.pdf
31b - JUnit and Mockito.pdf31b - JUnit and Mockito.pdf
31b - JUnit and Mockito.pdf
 

Dernier

CHEAP Call Girls in Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in  Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in  Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Navsari Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girl...
Navsari Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girl...Navsari Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girl...
Navsari Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girl...
mriyagarg453
 
Call Girls Agency In Goa 💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
Call Girls  Agency In Goa  💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...Call Girls  Agency In Goa  💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
Call Girls Agency In Goa 💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
russian goa call girl and escorts service
 
Zirakpur Call Girls👧 Book Now📱8146719683 📞👉Mohali Call Girl Service No Advanc...
Zirakpur Call Girls👧 Book Now📱8146719683 📞👉Mohali Call Girl Service No Advanc...Zirakpur Call Girls👧 Book Now📱8146719683 📞👉Mohali Call Girl Service No Advanc...
Zirakpur Call Girls👧 Book Now📱8146719683 📞👉Mohali Call Girl Service No Advanc...
rajveermohali2022
 

Dernier (20)

CHEAP Call Girls in Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in  Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in  Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Malviya Nagar, (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Call Girls Manjri Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Manjri Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Manjri Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Manjri Call Me 7737669865 Budget Friendly No Advance Booking
 
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
VIP Model Call Girls Budhwar Peth ( Pune ) Call ON 8005736733 Starting From 5...
 
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Pazhavanthangal WhatsApp Booking 7427069034 call girl ser...
 
Navsari Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girl...
Navsari Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girl...Navsari Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girl...
Navsari Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girl...
 
Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...Top Rated  Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
Top Rated Pune Call Girls Pimpri Chinchwad ⟟ 6297143586 ⟟ Call Me For Genuin...
 
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
Model Call Girls In Velappanchavadi WhatsApp Booking 7427069034 call girl ser...
 
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
Science City Kolkata ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sex...
 
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Koregaon Park ( Pune ) Call ON 8005736733 Starting From ...
 
Top Rated Pune Call Girls Dhayari ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated  Pune Call Girls Dhayari ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Top Rated  Pune Call Girls Dhayari ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated Pune Call Girls Dhayari ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
 
Tikiapara Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex A...
Tikiapara Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex A...Tikiapara Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex A...
Tikiapara Call Girls ✔ 8005736733 ✔ Hot Model With Sexy Bhabi Ready For Sex A...
 
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
𓀤Call On 6297143586 𓀤 Sonagachi Call Girls In All Kolkata 24/7 Provide Call W...
 
Call Girls Agency In Goa 💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
Call Girls  Agency In Goa  💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...Call Girls  Agency In Goa  💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
Call Girls Agency In Goa 💚 9316020077 💚 Call Girl Goa By Russian Call Girl ...
 
Hotel And Home Service Available Kolkata Call Girls Howrah ✔ 6297143586 ✔Call...
Hotel And Home Service Available Kolkata Call Girls Howrah ✔ 6297143586 ✔Call...Hotel And Home Service Available Kolkata Call Girls Howrah ✔ 6297143586 ✔Call...
Hotel And Home Service Available Kolkata Call Girls Howrah ✔ 6297143586 ✔Call...
 
Independent Hatiara Escorts ✔ 9332606886✔ Full Night With Room Online Booking...
Independent Hatiara Escorts ✔ 9332606886✔ Full Night With Room Online Booking...Independent Hatiara Escorts ✔ 9332606886✔ Full Night With Room Online Booking...
Independent Hatiara Escorts ✔ 9332606886✔ Full Night With Room Online Booking...
 
Hotel And Home Service Available Kolkata Call Girls Sonagachi ✔ 6297143586 ✔C...
Hotel And Home Service Available Kolkata Call Girls Sonagachi ✔ 6297143586 ✔C...Hotel And Home Service Available Kolkata Call Girls Sonagachi ✔ 6297143586 ✔C...
Hotel And Home Service Available Kolkata Call Girls Sonagachi ✔ 6297143586 ✔C...
 
❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.
❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.
❤Personal Whatsapp Number Keylong Call Girls 8617697112 💦✅.
 
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
Behala ( Call Girls ) Kolkata ✔ 6297143586 ✔ Hot Model With Sexy Bhabi Ready ...
 
Zirakpur Call Girls👧 Book Now📱8146719683 📞👉Mohali Call Girl Service No Advanc...
Zirakpur Call Girls👧 Book Now📱8146719683 📞👉Mohali Call Girl Service No Advanc...Zirakpur Call Girls👧 Book Now📱8146719683 📞👉Mohali Call Girl Service No Advanc...
Zirakpur Call Girls👧 Book Now📱8146719683 📞👉Mohali Call Girl Service No Advanc...
 
Kanpur call girls 📞 8617697112 At Low Cost Cash Payment Booking
Kanpur call girls 📞 8617697112 At Low Cost Cash Payment BookingKanpur call girls 📞 8617697112 At Low Cost Cash Payment Booking
Kanpur call girls 📞 8617697112 At Low Cost Cash Payment Booking
 

04 - Dublerzy testowi

  • 1. DUBLERZY TESTOWI 1.Prezentacja kodu 2.Dublerzy - kiedy i po co? 3.Dummy 4.Stub 5.Mock 6.Spy
  • 4. KLASYCZNE TESTOWANIE FIXTURE Setup Exercise TEST SUT Verify
  • 5. TEST Z ZALEŻNOŚCIĄ FIXTURE TEST SUT DOC
  • 6. POŚREDNIE WEJŚCIA FIXTURE TEST SUT DOC Indirect Input
  • 7. POŚREDNIE WYJŚCIA FIXTURE TEST SUT DOC Indirect Output
  • 9. DUMMY OBJECT ● wypełnia listę parametrów ● kiedy nie można przekazać nulla ● nie używany @Test public void shouldAddLineItem() { Product product = new Product("Dummy Name", getUniqueNumber()); Invoice invoice = new Invoice(new DummyCustomer()); invoice.addItemQuantity(product, QUANTITY); LineItem expectedLineItem = new LineItem(invoice, product, QUANTITY); assertLineItemsEqual("", expectedLineItem, invoice.getFirstLineItem()); }
  • 10. TEST STUB ● Responder ● Saboteur
  • 11. TEST STUB @Test public void productNotFound() { mockery.checking(new Expectations() {{ allowing(catalog).findItem(BARCODE); will(throwException(new ProductNotFoundException(BARCODE))); oneOf(display).displayProductNotFoundMessage(BARCODE); }}); pointOfSale.onBarcode(BARCODE); } @Test public void addAMovie() { MovieListPresenter movieListPresenter = presenterWithNoMovies(); when(movieView.getNewTitle()).thenReturn(STAR_WARS); movieListPresenter.add(); verify(movieView).showMovies(list(movieTitled(STAR_WARS))); }
  • 12. MOCK OBJECT WER Y FIKA C JA Z ACH OWA NIA @Test public void emptyBarcode() throws Exception { mockery.checking(new Expectations() {{ oneOf(display).displayEmptyBarcodeMessage(); }}); pointOfSale.onBarcode(""); }
  • 13. TEST SPY STUB+MOCK predefiniowane odpowiedzi weryfikacja zachowania
  • 14. TEST SPY @Test public void addAMovie() { MovieListPresenter movieListPresenter = presenterWithNoMovies(); when(movieView.getNewTitle()).thenReturn(STAR_WARS); movieListPresenter.add(); verify(movieView).showMovies(list(movieTitled(STAR_WARS))); }
  • 15. FAKE DZIAŁAJĄCA, ALE UPROSZCZONA IMPLEMENTACJA
  • 16. Bibliografia ● Gerard Meszaros, xUnit Test Patterns, Addison- Wesley 2007 ● http://xunitpatterns.com/ ● http://martinfowler.com/articles/mocksArentStub s.html
  • 17. DZIĘKUJĘ Zdjęcia: [8] http://xunitpatterns.com/Types%20Of%20Test%20Doubles.gif [9] http://www.flickr.com/photos/lincolnblues/1413187481 [10,11]http://www.flickr.com/photos/21123209@N06/2460486552/ [14] http://www.flickr.com/photos/dunechaser/2630433944