Skip to Content
훌륭한 프로그래머 되는 법: 프로젝트와 팀을 성공으로 이끄는 선배 개발자의 노하우
book

훌륭한 프로그래머 되는 법: 프로젝트와 팀을 성공으로 이끄는 선배 개발자의 노하우

by 최원재, 강전희, 안재덕, 남윤화, 피트 구들리프
May 2016
Beginner to intermediate
438 pages
8h 46m
Korean
Hanbit Media, Inc.
Content preview from 훌륭한 프로그래머 되는 법: 프로젝트와 팀을 성공으로 이끄는 선배 개발자의 노하우
143
11
장
테스트하기
11.9
어떤 코드도 혼자가 아니다
유닛 테스트 코드를 작성할 때는 독립화된 유닛의 코드를 테스트 대상 시스템(
SUT
)에 넣는
것을 목표로 한다. 이 유닛은 나머지 시스템 없이도 존재할 수 있어야 한다. 하나의 유닛이 외
부 세계와 연계되는 방식은 두 가지 형태의 계약 조건으로 표현할 수 있다. 하나는 제공하는 인
터페이스이고 다른 하나는 제공받는 인터페이스이다. 유닛은 다른 것에 의존적이어서는 안 된
다. 특히 공유된 글로벌 상태나 싱글턴
Singleton
객체들은 의존적인 면이 강하다.
TIP
글로벌 변수나 싱글턴 객체는 신뢰할 만한 테스트에 대한 저주와 같다. 숨겨진 의존성이 있다면 하나의 유닛
을 쉽게 테스트할 수 없다.
하나의 코드 유닛이 제공하는 인터페이스는 단순히 어떤 메서드이거나 멤버 함수, 이벤트, 속
성일 수 있다. 또는 콜백 형태의 인터페이스일 수도 있다. 이러한 인터페이스는
API
를 통해 상
호 작동하는 객체들에 의해 결정된다. 공개(
public
) 메서드에 쓰이는 매개 변수의 자료형일
수도 있고, 구독하고 있는 메시지일 수도 있다. 예를 들어
Date
매개 변수를 요구하는
Invoice
클래스의 경우
Date
자료형의 인터페이스에 의존적이다.
하나의 클래스와 상호 작동하는 객체들은 생성자의 매개 변수로서 전달되어야 한
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

클라우드 네이티브: 클라우드 네이티브 애플리케이션을 설계, 개발, 운영하는 핵심 가이드

클라우드 네이티브: 클라우드 네이티브 애플리케이션을 설계, 개발, 운영하는 핵심 가이드

정원천, 보리스 숄, 트렌트 스완슨, 피터 야우쇼베츠

Publisher Resources

ISBN: 9788968482304