SlideShare a Scribd company logo
Unit Testing
이규원
gyuwon@tidcorp.com
gyuwon@live.com
www.facebook.com/gyuwon.yi
“Know the rules well, so you can break them effectively.”
- Dalai Lama XIV
Automated Testing
Software Regression
“A software bug which makes
a feature stop functioning as
intended after a certain event”
- Wikipedia
R1 R2 R3 R4
SOFTWARE
Features
Costs
Manual(Quality Assurance) Automated
>
Reliability
Manual(Quality Assurance) Automated
<
Arrange
Act
Assert
Cleanup
DEMO
Automated UI Testing
Continuous Integration
“Many, including me, consider that CI without testing is not CI at all.”
- The Architecture Journal, January 2008 by Munjal Budhabhatti
Continuous Build
Continuous Integration
Automated Testing
Unit Tests
Horizontal Separation
Layer D
Layer C
Layer B
Layer A
Functional Testing(Vertical Separation)
SystemUnderTest
Layer D
Layer C
Layer B
Layer A
SystemUnderTest
Layer D
Layer C
Layer B
Layer A
SystemUnderTest
Layer D
Layer C
Layer B
Layer A
Function 1 Function 2 Function 3
*Integration Testing
Layer D
Layer C
Layer B
Layer A
SystemUnderTest
System Under Test
System Under Test
Unit Testing
Layer D
Layer C
Layer B
Layer A System Under Test
System Under Test
System Under Test
System Under Test
Unit Testing
• Fast
• Reliable
• Isolate failures
Test Doubles
Layer D
Layer C
Test Double for Layer B
Layer A
System Under Test
Inversion of Control
“Don't call us, we'll call you.”
Dependency Inversion
A Layer C depends on a Layer B
A Layer C creates a Layer B A Layer C requests a Layer B
Constructor Injection
public class LayerC
{
private LayerB _layerB;
public LayerC()
{
_layerB = new LayerB();
}
}
public class LayerC
{
private LayerB _layerB;
public LayerC(LayerB layerB)
{
_layerB = layerB;
}
}
<< created >>
<< injected >>
*Interface
public interface ILayerB
{
}
public class LayerB : ILayerB
{
}
public class LayerC
{
private ILayerB _layerB;
public LayerC(ILayerB layerB)
{
_layerB = layerB;
}
}
Test Double
The replacement of a real depended-on component
for testing purposes
Test Doubles
Dummy
Stubs
Spies
Mocks
Fake
Passed but never used
Provide canned answers
Record information
Verify expectations
Have working implementations
but not suitable for production
DEMO
Stubs and Mocks
Myth Busting for
Test-Driven Development
Automated testing
TDD
Automated testing with high coverage
TDD
Writing the tests first
TDD
?
Test-Driven Development
Test-Driven Development
Test
Development
TESTS
MAKETH
CODE
Red
GreenRefactor
Write production code
If the test
fails
If all tests
succeed
Clean up code
Write a test
yes
yes
no
no
repeat
DEMO
Test-Driven Development

More Related Content

PDF
State Test 
of Applications and Domains
PPTX
MythBusters: Functional Testing Edition
PDF
Testing Web Apps
PPTX
Sftwre engg.testng
PDF
What is Integration Testing? | Edureka
PDF
Quality for developers
PPTX
Reactive Model-View-ViewModel Architecture
PDF
[Td 2015]너에게만 나는 반응해 반응형 응용프로그램(이규원)
State Test 
of Applications and Domains
MythBusters: Functional Testing Edition
Testing Web Apps
Sftwre engg.testng
What is Integration Testing? | Edureka
Quality for developers
Reactive Model-View-ViewModel Architecture
[Td 2015]너에게만 나는 반응해 반응형 응용프로그램(이규원)

Similar to Unit testing (20)

PPTX
Software testing
PPTX
Testing concepts
PPTX
Testing ppt
PPS
Software Development Life Cycle Testingtypes
PPTX
CTFL Module 02
PPTX
V and v model
PPTX
Software Testing
PPT
Basic Guide to Manual Testing
PDF
Mobile testing in the cloud
PPTX
Automated Generation, Evolution and Maintenance: a perspective for mobile GUI...
PPT
Software Testing
PDF
Fundamentals of software testing
PPTX
System Testing & Acceptance Testing
PPTX
CLIENT SERVER COMPUTING FINAL UNIT 5.pptx
PPTX
Software Testing Foundations Part 2 - Testing in Software Lifecycle
PDF
A Complete Guide to Functional Testing.pdf
PDF
Real Time software Training in Nagercoil
PDF
Android testing part i
PPTX
Slides1 - testing
PDF
IRJET - A Valuable and Speculative Approach to Manage the Item Testing by usi...
Software testing
Testing concepts
Testing ppt
Software Development Life Cycle Testingtypes
CTFL Module 02
V and v model
Software Testing
Basic Guide to Manual Testing
Mobile testing in the cloud
Automated Generation, Evolution and Maintenance: a perspective for mobile GUI...
Software Testing
Fundamentals of software testing
System Testing & Acceptance Testing
CLIENT SERVER COMPUTING FINAL UNIT 5.pptx
Software Testing Foundations Part 2 - Testing in Software Lifecycle
A Complete Guide to Functional Testing.pdf
Real Time software Training in Nagercoil
Android testing part i
Slides1 - testing
IRJET - A Valuable and Speculative Approach to Manage the Item Testing by usi...
Ad

More from Gyuwon Yi (10)

PPTX
Event sourcing spring camp 2017.public
PPTX
Why you always fail with tdd
PPTX
CQRS - Show me the code
PPTX
CQRS
PPTX
프로그래밍, 설계 그리고 패턴
PPTX
VSTS와 Azure를 이용한 팀 프로세스 관리
PPTX
Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기
PPTX
Xamarin Forms, MVVM and Testing
PPTX
Introduction to IoC Container
PPTX
Introduction to TPL
Event sourcing spring camp 2017.public
Why you always fail with tdd
CQRS - Show me the code
CQRS
프로그래밍, 설계 그리고 패턴
VSTS와 Azure를 이용한 팀 프로세스 관리
Azure를 이용한 Join 없는 글로벌 분산 시스템 설계하기
Xamarin Forms, MVVM and Testing
Introduction to IoC Container
Introduction to TPL
Ad

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Transform Your Business with a Software ERP System
PPTX
L1 - Introduction to python Backend.pptx
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
Essential Infomation Tech presentation.pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
System and Network Administration Chapter 2
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
System and Network Administraation Chapter 3
PPTX
ai tools demonstartion for schools and inter college
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Transform Your Business with a Software ERP System
L1 - Introduction to python Backend.pptx
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Reimagine Home Health with the Power of Agentic AI​
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Essential Infomation Tech presentation.pptx
top salesforce developer skills in 2025.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Navsoft: AI-Powered Business Solutions & Custom Software Development
How Creative Agencies Leverage Project Management Software.pdf
Wondershare Filmora 15 Crack With Activation Key [2025
System and Network Administration Chapter 2
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Upgrade and Innovation Strategies for SAP ERP Customers
System and Network Administraation Chapter 3
ai tools demonstartion for schools and inter college

Unit testing