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

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

by 최원재, 강전희, 안재덕, 남윤화, 피트 구들리프
May 2016
Beginner to intermediate
438 pages
8h 46m
Korean
Hanbit Media, Inc.
Content preview from 훌륭한 프로그래머 되는 법: 프로젝트와 팀을 성공으로 이끄는 선배 개발자의 노하우
139
11
장
테스트하기
때로 나쁜 테스트란 테스트 자체뿐만 아니라 테스트 대상 코드(
SUT
)가 나쁘다는 점을 의미하
기도 한다. 이러한 점을 잘 살펴보고 코드의 설계를 개선해야 한다.
11.7
테스트는 어떠해야 하는가
테스트 프레임워크에 따라 테스트 코드의 형태가 결정된다. 구조화된 테스트 상황 설정
set
-
up
기
능과 테스트 상황 해제
tear
-
down
기능
6
, 그리고 커다란 결합체로서 개별 테스트를 그룹화하는 방
법을 제공할 수 있다.
일반적으로 각 테스트에는 몇 가지 준비 과정이 필요하고, 준비가 되면 실제 실행하게 되며, 마
지막으로 실행 결과를 검증한다. 이것이 바로 배치-실행-확인(
arrange
-
act
-
assert
) 패턴이
다. 유닛 테스트에서는 일반적으로 확인 단계에서 한 가지만 확인한다. 만약 여러 가지를 확인
해야 한다면, 하나의 테스트 케이스만으로 다룰 수 없다.
다음은 앞에서 설명한 패턴을 따르는
Java
유닛 테스트 예제이다. 이 패턴을 유지하면 테스트
에 집중하고 읽기 쉽게 만들 수 있다.
@
Test
public void stringsCanBeCapitalised
()
{
String input
=
"
This string should be uppercase
.";
➊
String expected
=
"
THIS STRING SHOULD BE UPPERCASE ...
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