Enviar pesquisa
Carregar
Struggling to Create Maintainable Unit Tests?
•
Transferir como PPT, PDF
•
2 gostaram
•
3,762 visualizações
Alistair McKinnell
Seguir
Learn how to create maintainable unit tests by using jMock with Test Data Builders.
Leia menos
Leia mais
Tecnologia
Negócios
Denunciar
Compartilhar
Denunciar
Compartilhar
1 de 37
Baixar agora
Recomendados
Introduction to CrossRef for Publishers
Introduction to CrossRef for Publishers
Crossref
Wang Webinar Nov 2015 - LinkedIn
Wang Webinar Nov 2015 - LinkedIn
jwppz
2 6 open_ehr archetypes instructions_actions
2 6 open_ehr archetypes instructions_actions
freshEHR Clinical Informatics Ltd.
Bad test, good test
Bad test, good test
Seb Rose
Junit With Eclipse
Junit With Eclipse
Sunil kumar Mohanty
Pragmatic unittestingwithj unit
Pragmatic unittestingwithj unit
liminescence
10 Principles of Apex Testing
10 Principles of Apex Testing
Salesforce Developers
Junit_.pptx
Junit_.pptx
Suman Sourav
Recomendados
Introduction to CrossRef for Publishers
Introduction to CrossRef for Publishers
Crossref
Wang Webinar Nov 2015 - LinkedIn
Wang Webinar Nov 2015 - LinkedIn
jwppz
2 6 open_ehr archetypes instructions_actions
2 6 open_ehr archetypes instructions_actions
freshEHR Clinical Informatics Ltd.
Bad test, good test
Bad test, good test
Seb Rose
Junit With Eclipse
Junit With Eclipse
Sunil kumar Mohanty
Pragmatic unittestingwithj unit
Pragmatic unittestingwithj unit
liminescence
10 Principles of Apex Testing
10 Principles of Apex Testing
Salesforce Developers
Junit_.pptx
Junit_.pptx
Suman Sourav
Junit4&testng presentation
Junit4&testng presentation
Sanjib Dhar
Security Testing
Security Testing
Kiran Kumar
Writing Test Cases with PHPUnit
Writing Test Cases with PHPUnit
Shouvik Chatterjee
Selenium Webdriver with data driven framework
Selenium Webdriver with data driven framework
David Rajah Selvaraj
Unit testing with JUnit
Unit testing with JUnit
Thomas Zimmermann
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
Tomek Kaczanowski
The secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you about
Dror Helper
Unit testing with mock libs
Unit testing with mock libs
Valentin Kolesnikov
Introduction to Software Testing
Introduction to Software Testing
Sergio Arroyo
Asp netmvc e03
Asp netmvc e03
Yu GUAN
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good Tests
Tomek Kaczanowski
HRServicesPOX.classpathHRServicesPOX.project HRSer.docx
HRServicesPOX.classpathHRServicesPOX.project HRSer.docx
adampcarr67227
3 j unit
3 j unit
kishoregali
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Peter Gfader
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
solit
1 aleksandr gritsevski - attd example using
1 aleksandr gritsevski - attd example using
Ievgenii Katsan
Ive already completed the Java assignment below, but it doesnt wor.pdf
Ive already completed the Java assignment below, but it doesnt wor.pdf
fantasiatheoutofthef
Define a class named Doctor whose objects are records for clinic’s d.pdf
Define a class named Doctor whose objects are records for clinic’s d.pdf
MALASADHNANI
GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good Tests
Tomek Kaczanowski
Hello. Im creating a class called Bill. I need to design the class.pdf
Hello. Im creating a class called Bill. I need to design the class.pdf
barristeressaseren71
Succeeding with Specification by Example
Succeeding with Specification by Example
Alistair McKinnell
Don't Settle for Poor Names (Or Poor Design)
Don't Settle for Poor Names (Or Poor Design)
Alistair McKinnell
Mais conteúdo relacionado
Semelhante a Struggling to Create Maintainable Unit Tests?
Junit4&testng presentation
Junit4&testng presentation
Sanjib Dhar
Security Testing
Security Testing
Kiran Kumar
Writing Test Cases with PHPUnit
Writing Test Cases with PHPUnit
Shouvik Chatterjee
Selenium Webdriver with data driven framework
Selenium Webdriver with data driven framework
David Rajah Selvaraj
Unit testing with JUnit
Unit testing with JUnit
Thomas Zimmermann
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
Tomek Kaczanowski
The secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you about
Dror Helper
Unit testing with mock libs
Unit testing with mock libs
Valentin Kolesnikov
Introduction to Software Testing
Introduction to Software Testing
Sergio Arroyo
Asp netmvc e03
Asp netmvc e03
Yu GUAN
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good Tests
Tomek Kaczanowski
HRServicesPOX.classpathHRServicesPOX.project HRSer.docx
HRServicesPOX.classpathHRServicesPOX.project HRSer.docx
adampcarr67227
3 j unit
3 j unit
kishoregali
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Peter Gfader
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
solit
1 aleksandr gritsevski - attd example using
1 aleksandr gritsevski - attd example using
Ievgenii Katsan
Ive already completed the Java assignment below, but it doesnt wor.pdf
Ive already completed the Java assignment below, but it doesnt wor.pdf
fantasiatheoutofthef
Define a class named Doctor whose objects are records for clinic’s d.pdf
Define a class named Doctor whose objects are records for clinic’s d.pdf
MALASADHNANI
GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good Tests
Tomek Kaczanowski
Hello. Im creating a class called Bill. I need to design the class.pdf
Hello. Im creating a class called Bill. I need to design the class.pdf
barristeressaseren71
Semelhante a Struggling to Create Maintainable Unit Tests?
(20)
Junit4&testng presentation
Junit4&testng presentation
Security Testing
Security Testing
Writing Test Cases with PHPUnit
Writing Test Cases with PHPUnit
Selenium Webdriver with data driven framework
Selenium Webdriver with data driven framework
Unit testing with JUnit
Unit testing with JUnit
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
The secret unit testing tools no one ever told you about
The secret unit testing tools no one ever told you about
Unit testing with mock libs
Unit testing with mock libs
Introduction to Software Testing
Introduction to Software Testing
Asp netmvc e03
Asp netmvc e03
Confitura 2012 Bad Tests, Good Tests
Confitura 2012 Bad Tests, Good Tests
HRServicesPOX.classpathHRServicesPOX.project HRSer.docx
HRServicesPOX.classpathHRServicesPOX.project HRSer.docx
3 j unit
3 j unit
Testing with VS2010 - A Bugs Life
Testing with VS2010 - A Bugs Life
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
Solit 2013, Автоматизация тестирования сложных систем: mixed mode automated t...
1 aleksandr gritsevski - attd example using
1 aleksandr gritsevski - attd example using
Ive already completed the Java assignment below, but it doesnt wor.pdf
Ive already completed the Java assignment below, but it doesnt wor.pdf
Define a class named Doctor whose objects are records for clinic’s d.pdf
Define a class named Doctor whose objects are records for clinic’s d.pdf
GeeCON 2012 Bad Tests, Good Tests
GeeCON 2012 Bad Tests, Good Tests
Hello. Im creating a class called Bill. I need to design the class.pdf
Hello. Im creating a class called Bill. I need to design the class.pdf
Mais de Alistair McKinnell
Succeeding with Specification by Example
Succeeding with Specification by Example
Alistair McKinnell
Don't Settle for Poor Names (Or Poor Design)
Don't Settle for Poor Names (Or Poor Design)
Alistair McKinnell
Don't Settle for Poor Names
Don't Settle for Poor Names
Alistair McKinnell
The Boy Scout Rule
The Boy Scout Rule
Alistair McKinnell
Advanced Developer Testing
Advanced Developer Testing
Alistair McKinnell
What Can Journalists Teach Developers About Writing Source Code?
What Can Journalists Teach Developers About Writing Source Code?
Alistair McKinnell
Ubiquitous Testing
Ubiquitous Testing
Alistair McKinnell
Commonality and Variability Analysis: Avoiding Duplicate Code
Commonality and Variability Analysis: Avoiding Duplicate Code
Alistair McKinnell
Simple Design
Simple Design
Alistair McKinnell
Agile Tour Shanghai December 2011
Agile Tour Shanghai December 2011
Alistair McKinnell
Pair Programming
Pair Programming
Alistair McKinnell
Agile Transition in Trouble? Using the Kotter Change Model as a Diagnostic Tool
Agile Transition in Trouble? Using the Kotter Change Model as a Diagnostic Tool
Alistair McKinnell
The Story of a Story
The Story of a Story
Alistair McKinnell
The Testing Landscape
The Testing Landscape
Alistair McKinnell
Mais de Alistair McKinnell
(14)
Succeeding with Specification by Example
Succeeding with Specification by Example
Don't Settle for Poor Names (Or Poor Design)
Don't Settle for Poor Names (Or Poor Design)
Don't Settle for Poor Names
Don't Settle for Poor Names
The Boy Scout Rule
The Boy Scout Rule
Advanced Developer Testing
Advanced Developer Testing
What Can Journalists Teach Developers About Writing Source Code?
What Can Journalists Teach Developers About Writing Source Code?
Ubiquitous Testing
Ubiquitous Testing
Commonality and Variability Analysis: Avoiding Duplicate Code
Commonality and Variability Analysis: Avoiding Duplicate Code
Simple Design
Simple Design
Agile Tour Shanghai December 2011
Agile Tour Shanghai December 2011
Pair Programming
Pair Programming
Agile Transition in Trouble? Using the Kotter Change Model as a Diagnostic Tool
Agile Transition in Trouble? Using the Kotter Change Model as a Diagnostic Tool
The Story of a Story
The Story of a Story
The Testing Landscape
The Testing Landscape
Último
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
RTylerCroy
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Katpro Technologies
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
The Digital Insurer
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Igalia
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
apidays
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Igalia
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
Delhi Call girls
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
Results
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Enterprise Knowledge
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
HampshireHUG
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
Enterprise Knowledge
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
Slack Application Development 101 Slides
Slack Application Development 101 Slides
praypatel2
Último
(20)
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
🐬 The future of MySQL is Postgres 🐘
🐬 The future of MySQL is Postgres 🐘
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Slack Application Development 101 Slides
Slack Application Development 101 Slides
Struggling to Create Maintainable Unit Tests?
1.
2.
3.
Protocol => Mocks
Data => Builders
4.
5.
Define Maintainable Unit
Test
6.
7.
8.
Shared Vocabulary
9.
Mocks Builders
10.
11.
xUnit Test Patterns
12.
Mocks Builders
13.
14.
15.
16.
Examples
17.
18.
Domain Model
19.
public
void should_recognize_pediatric_patient() { // setup Patient sut = aPatient ().age(17).build(); // exercise and verify assertTrue (sut.isPediatric()); assertTrue (!sut.isAdult()); }
20.
public
void should_recognize_pediatric_patient() { // setup Patient sut = aPatient ().age(17).build(); // exercise and verify assertTrue (sut.isPediatric()); assertTrue (!sut.isAdult()); }
21.
public
void should_recognize_pediatric_patient() { // setup Patient sut = aPatient ().age(17).build(); // exercise and verify assertTrue (sut.isPediatric()); assertTrue (!sut.isAdult()); } aPatient ().dob(april(1, 1992)).build();
22.
23.
public
class CareTeamMembershipService implements ICareTeamMembershipService { private CareTeamMembershipDao careTeamMembershipDao ; public void addMember(Patient patient, CareTeam careTeam) { if (!patient.isRegisteredAt(careTeam.getFacility())) { throw new CareTeamAdminException(); } if (!patient.meets(careTeam.getMembershipCriteria())) { throw new CareTeamAdminException(); } careTeamMembershipDao .create( patient.getId(), careTeam.getId()); } }
24.
private
final CareTeamMembershipDao careTeamMembershipDao = context .mock(CareTeamMembershipDao. class ); private final ICareTeamMembershipService sut = createCareTeamMembershipService(); public void should_permit_add_for_appropriate_care_team() { // setup final Facility jacobi = aFacility ().build(); final Patient patient = aPatient ().at(jacobi).age(18) .with(Diagnosis. DIABETES ).build(); final CareTeam careTeam = anAdultCareTeam ().at(jacobi) .with(Diagnosis. DIABETES ).build(); // verify context .checking( new Expectations() {{ one( careTeamMembershipDao ).create( patient.getId(), careTeam.getId()); }}); // exercise sut .addMember(patient, careTeam); }
25.
private
final CareTeamMembershipDao careTeamMembershipDao = context .mock(CareTeamMembershipDao. class ); private final ICareTeamMembershipService sut = createCareTeamMembershipService(); // verify @Test (expected=CareTeamAdminException. class ) public void should_disallow_add_adult_to_pediatric_care_team() { // setup final Facility jacobi = aFacility ().build(); final Patient patient = aPatient ().at(jacobi).age(18) . with (Diagnosis. DIABETES ).build(); final CareTeam careTeam = aPediatricCareTeam ().at(jacobi) .with(Diagnosis. DIABETES ).build(); // exercise sut .addMember(patient, careTeam); }
26.
27.
When to Use
Mocks
28.
Mocks Builders
29.
Protocol Data
30.
Protocol => Mocks
Data => Builders
31.
32.
33.
34.
35.
36.
Credits Obstacle Race
http://www.flickr.com/photos/foxypar4/1004464889/ Einstein Blackboard Writing Generator http://generator.kitt.net/2006/12/ einstein-blackboard-writing-generator.html Holy Grail http://www.flickr.com/photos/ spiritual_marketplace/2207966935/
37.
Baixar agora