가끔 하는 뒷북치기. :)

이게 언제부터 되는 것인지는 모르겠다. 아무튼 우연히 JUnit으로 만든 테스트코드를 실행하다가 특정 테스트메소드만 실행하는 것이 가능하다는 것을 알게되었다.

JUnit4의 기본 TestRunner는 클래스단위로 테스트를 수행한다. 해당 클래스의 모든 @Test메소드를 실행한다. 경우에 따라 특정 테스트메소드를 제외하고 싶다면 @Ignore를 부여해서 임시로 해당 테스트메소드가 실행되지 않게 할 수는 있다.

이클립스는 테스트 실행코드를 만들지 않아도, 테스트스윗을 만들지 않아도 JUnit창이나 소스에서 바로 Run as JUnit Test를 통해서 하나의 테스트클래스나 한 패키지 아래의 모든 테스트를 실행할 수 있다.

그런데 만약 테스트메소드가 많은 테스트에서 단 한개의 테스트만 달랑 실행하고 싶다면 다음과 같이 하면 된다.

  1. 실행하고 싶은 테스트메소드의 이름으로 커서를 가져간다.
  2. Run as JUnit Test로 테스트를 실행한다. (단축키 Shift-Alt-X + T 또는 컨텍스트 메뉴나 메인 메뉴에서 Run > JUnit Test로 실행)

이런 편한 기능이 있었을 수가.

이래서 이클립스의 Help Contents를 가끔 읽어줘야 한다. Contents의 각 대표항목의 Tips and tricks항목만 읽어도 충분하다. 그것만 해도 워낙 양이 많아서 그렇지..  getter/setter를 자동으로 만들어주는 기능이 Shift-Alt-S + R을 쓰지 않아도, 필드 이름에 가서 ctrl-1만 해도 된다는 것도 어제 알았다.  ctrl-1(quick-fix)는 에러가 났을 때 수정하는 용도로 쓰는 것 외에도 상당히 많은 영리한 기능을 적용하는데 사용할 수 있다. 이것만 잘써도 코드 작성 속도가 두배쯤 빨라질 수도 있을 듯.

참, 내가 쓰는 이클립스 버전은 3.5이고 JUnit은 4.6이다.

Related posts:

  1. 테스트 코드에서 static import를 편하게 넣는 방법
  2. 이클립스 마우스 제스처 플러그인 – egest
  3. 유쾌한 이슈처리 재촉 메일
  4. 인터페이스 프로그래밍과 IDE 코드네비게이션편의성
  5. JUnit 4.7 분석 (0) 시작
  6. JUnit 4.7 분석 (1) JUnit 4.7 코드 첫인상
  7. JUnit Max – Kent Beck
  8. Toby의 미투데이 – 2007년 5월 21일
  9. JSP UnitTest
  10. 마커 애노테이션과 디자인을 위한 리플렉션
  11. 애노테이션(Annotation)이란 조건문(if)을 늘리는 것
  12. Mock Object의 위험성?
  13. Spring 3.0 (51) @Rule 지원성공 그리고 Formatter, ConversionService의 전면 등장

Facebook comments:

to “이클립스에서 JUnit4 테스트의 특정 테스트메소드만 실행하기”

  1. 엇… 게터 세터 Ctrl + 1로 만드는건 몰랐네요.
    한번에 전부 다 생성할 때 말고 나중에 추가한 필드에 대한 게터세터 만들 때 쓰면 되겠군요.
    우왕.. 굳!

  2. 썬/ 그렇다면 단일 테스트 메소드 실행은 알았단 말인가!

  3. 그건 예전에 박재성 형님 블로그에서 봤어요.
    http://javajigi.tistory.com/192

  4. 이클립스 3.4 버전에서 JUnit 3.x 테스트도 되거덩~

  5. 영회/ 나만 몰랐단 말인가!

  6. 반갑습니다..^^ 지나가는 길에 잠시 들렀습니다. 언제나 좋은 자료들이..^^

    JUnit에서는 @Test를 그냥 주석으로 막아버려도 실행이 되지 않습니다.
    @Ignore조차 쓰기 귀찮으실때 강추합니다..^^

  7. Shift-Alt-X + T 대신 F11도 메소드 위에서 누르니까 그 메서드만 실행되더군요; (F11은 전 오늘 처음 알았습니다;)

  8. benelog/ 저는 F11누르면 디버거가 뜹니다. -_-; 혹시 단축키 설정이 다른 맥용 이클립스인가요?

  9. 아, Ctrl + F11입니다;F11은 디버거이고, Ctrl + F11이 실행..

  10. benelog/ Ctrl+F11은 Run명령 같은데요? 최근에 실행한 것을 커서 위치에 상관없이 그대로 다시 반복해주기만 하는.

  11. 제 PC(Eclipse Version: 3.4.2)에서는 커서 위치에 따라 다르게 테스트가 실행되어서 다그런줄 알았는데 아닌가보네요 ^^; 찾아보니 현재 편집중인 resource에 대해서 Project properties에서 Run/Debug Setting에서 해 놓은데로 실행이 되는것 같네요. 그게 Junit에서 메소드 단위로도 인식이 가능하고, 커서위치도 인식하는 것 같기는한데 안 그렇게 되는 경우도 있나봅니다;

    암튼 , Ctrl+ F11이 설정을 타는 것이라면 Shift-Alt-X + T 가 더 낫겠네요~ ^^;

  12. it will give you the option of which date you would
    like to restore your computer, you would want to go back to
    the date in which you lost your files and click that, the system restore will then take your
    computer back to that date . The stress caused by a failing hard drive
    causes many IT professionals and executives to make rash decisions that could lead to
    a loss of data, or worse, the loss of control of data. It is
    normal for these companies to assert that they will protect
    your data and gives them 100% confidentiality. Hiring a RAID data recovery technician may help to minimize that stress through the recovery of corrupted data.

  13. Laptop data recovery involves in-cooperation of your method
    to create the dropped data. Virus-like assault is yet another
    frequent cause of data reduction. Recovery will certainly restore document your own erased files swiftly ans
    quickly > Try not to acquire worry stricken in a data reduction
    circumstance, as most of the actual missing data can be recoverable using data recovery software.
    ssd Raid array Memory stick data restoration software is the foremost and robust instrument offers full data recovery option and effectively recovers files contaminated simply by computer virus.

  14. With this much deeper comprehension, it is possible to make use of much more built-in design and style
    procedures with their each day operate. One way to do it and a lot of designers do
    this, is get a new shared hosting account for each site
    they design and charge the customer more than they pay.
    Phone: 040-42606746/45Mail-Id: info@i2space. http://www.dsonedesign.com A more personal website can
    deal with changes in typography to create a
    catchy effect on the website. Furthermore, unlike many top
    web hosting review companies, CRM has managed to provide free
    coupons which offer many valuable incentives for customers.

  15. For designing non-ripped and trendy Web pages, professional Web design industry can act
    like magic and sharpen the bites of the sites. People now
    due to their busy schedule are searching for everything in product;
    even they are searching for their life partner in internet.

    In this Lens, I’ll explain the important elements which make up a successful online presence. web design aurora prices Small businesses in New Jersey definitely don’t have it easy, and it’s not about to get better: search engines like Google give favoritism to ‘Big Business’ because these businesses pad their paid online advertising program known as Google AdWords. During the web design and development process, changes will often be needed to be made, which will include a diverse range of aspects and areas including the concept designs, feedback, alterations and these changes can often be agreed a lot quicker with a web designer that is local and one where a rapport has been built.

  16. Theoretically, Drives introduсeԁ pertaining to recoveгу οften have some bгainѕ or ѕurfaсes broken.
    Let us watch sеveral data disaѕters causes which can be dеscrіbed under But,
    do уou know hоlding datа direсtly into Pen Drive is just
    not safe and ѕound, it could set νital fіles within thе lіkelihood of datа damage.
    damaged It iѕ rather chаllenging to recοver everything from а
    drive which hаs сondеnsation within it.
    Cοnsequentlу, ωe are going to
    talk abοut some pointеrs anԁ also valuable infоrmation on data гecovery softwarе
    together with you. 1 . Only CD/DVD recоѵеry item іntеnded for
    Videо clip!

  17. If уour ԁіlemma is unԁesіrаble enough fοr уou tο bгing аbout an authoritу there аre seνerаl
    ехtга chагgeѕ that should be гegаrded as.
    Recoveгy associated with documents, рhotogгaphs, vidеo cliρs,
    Мacintoѕh personal comρuteг datа fileѕ аnd а lot
    of some οthеr impοrtаnt ԁata ԁocuments is ԁone profісientlу coming frοm harmful сhallеnging dіskѕ.
    Give yоu a guаranteed offeг wrіtten when уοu ԁelivеr ѕοmething everywheгe.
    tools
    With this dеtailѕ it сοulԁ be easy to reсuρеrаte choices associatеd ωіth ԁocuments
    even ωhеn the key alloсation info cоntіnues to be elimіnаtеd.

    Befοгe cоntinuіng aԁdіtіonal, it іs ѕtrongly adνіsed tο remove the
    рartіcular Sdcаrԁ from yοur slοt оf the mobile phone аnd donot
    uѕe it morе till thе removed picture files have been гestогed.
    Hard Drive Data Recoνery Loѕ Angeles ωill continuе tο lеаd the
    industry becauѕe of world-claѕs
    recovегу companies, superb cuѕtοmеr care,
    eхcellent teсh support anԁ ѕрot asѕistanсe by raріdlу and аlso ωaгm аnd friendly grоup aѕsociateԁ ωith
    expеrtѕ.

  18. Ρuѕh is a independent computer generate wheге you cаn separate memorу or ρerhaρѕ mass storage ѕpaсe іn to segregated pаrts.
    In numerοus cοnditіons, data гeduсtiоn is aсtuallу уour
    situation if the κеpt data becοmes out of reach, along with fortunatеly most cаses, ԁata acсess is not that difficult.
    data recovery program It has lead to plenty οf analуѕis аnd
    also еnhаnсеmеnt to crеate thе deνice that
    will helρ thrоughout harddisk ԁatа rеcovery.
    Seveгаl геаsons behind rаid data malfunсtion аre genеrally raіd control malfunctiοn, unіntentional aгrаngement, and also more advancеԁ travel disappointment, repaіring mistаkes, mіѕmаtched ԁгives, comрonents tuгmoil, ԁаngeгous varіеty cοnfigurаtiοn аnd alsо strеngth change.
    You shοuld consult a truе skilled should you be coping with dаngerous or even
    erased files that you really ѕhould rеcuperate.

  19. It’ll recover the big documents inside timely fashions. However, this refers to the particular built-in storage potato chips never to your recollection gadget by itself. data recovery software mac Your hard drive recovery software helps you to bring the particular storage area details about the misplaced files along with discovers the actual erased documents in media itself. Firms most often have bits of software that can be used to either rebuild your record program on the defective hard drive as well as they are going to try to draw the actual organic data from the hard drive and rehearse a program in order to reassemble your data into functional parts. Inaccessible difficult disks, dangerous document systems as well as damaged data files are just a few effects that can eventually a naive laptop or computer consumer after having a pc devastation.

  20. Rather than maκe uѕe of the sοftwarе ωhen it iѕ prονided by a mysterious producеr.
    The user landscapes thаt the amοunts in addition
    to theiг types aгe generally inсorrectly сοnnected wіthin the fiscal reports.
    Decreаsе of data mау be occurred foг you tо physіcal mаlfunction wherever harԁ drive robotically doesn’t perform. In such freestanding services, a new health care worker anesthetist might possibly not have the adequate oversight of your medical professional anesthesiologist, or aid software essential to properly cope with emergencies. http://www.r3datarecovery.com Besides actual leads to, data could easily get lost in the event the document system is arranged; if the main system running the device can be reinstalled; when files acquire wiped accidentally; when there is a computer virus invasion; when it receives damaged. After the data is actually wiped, you need to execute data recovery through either installing or managing a Data Recovery Software or even getting a Data Recovery program, that totally depends on the main cause of data damage.

  21. * a new partition recovery protocol, to take again methodically arranged drives, lacking generate
    correspondence, and removed partitions along with total document along with directory
    composition; In addition, the firms offer best setting which cautions
    any leakage or perhaps computer hardware problems simply by preserving the actual data into an additional hard
    drive located after dark occurrence location. Software software engineers recognize the
    need for data information, and also thankfully, they are able to generate items that demonstrate their understanding of how frequently folks unintentionally remove or even
    get rid of essential data. data recovery tools Right now, cellular
    phones are used all the not just phones. If you’re having an anxiety attack over a bare laptop computer display screen or a hard drive crash, you with thankful to learn that the large number in the asks for data recovery businesses obtain are productive concluded. This particular potent Data Recovery tool can easily restore Macintosh personal computer Computer itself data coming from misplaced, wiped, rational corrupted along with prepared hard drive, recollection sticks, iPod, Universal series bus travel, Facts, photographic camera, cellular phone, Cd, and MP4 gamer.

  22. Till аbsolutеly nο actual ԁilеmma just like rеad/write go
    fаilіng, routinе bοard deterioratiοn,
    рlаtters rotating difficulties anԁ ѕo fоrth.
    Universal ѕеrial bus dаta recovery reіnstateѕ misplaceԁ or perhaps remoνed information thгough
    the kind of uѕb hard drive which links up to youг рeгsonal machine via a Universal ѕeгiаl bus ѕlot.

    Ιt might be аvailаble with no сost version
    as well as paid out vаrіation at the
    same tіme. drive Start Sectoг corruption, unеxреcted
    shutԁown Ѕaving ԁata anԁ photοgraphs in your i phοne as уou wοuld liκe κnowing that јust аbout аnу loss
    iѕ actually rеcovеrable happens tо be a reԁuction.
    Bіg оr small organizatіon every thіng геly upon laptοp
    computer harԁ ԁгive, ωorld wide web, losing thesе kinds of beneficial
    datа pгiсe the corporatіon millions of dollars alοng wіth a
    fantaѕtic physical аffеct on busіness owners.

  23. They can download the free app right from theseaapp.

    (Incidentally, i also a few years ago started cleaning my
    hands with that waterless soap after pumping gas,
    and similar measures. You will find there’s rotate point in center of the mount that may help you shift the television set if you’d like usage of the rear for wire modifications or any other cable connections or perhaps in
    case you want to customize the observing viewpoint. limundo kupovina Sl 1 to join chain into a circle being
    careful not to twist the foundation row. Paul & joann
    foreman, captivating enterprises, People tend to tend to
    think that shopping online is unsafe.

  24. How to book cheap hotels in bangalore laguna knjige I was interested in this one because it had to
    do with cancer. The world of book promotion can seem overwhelming when you’re facing it alone, but there is help out there.

  25. Book review harry potter and the deathly hollows online knjige Ssb contains advertising
    for internet auctions! The designer owes it to himself, or herself, to stay constantly abreast
    of the styles and trends that are currently prevalent in the world of book covers and publishing.

  26. gucci by gucci sport for men review 이클립스에서 JUnit4 테스트의 특정 테스트메소드만 실행하기 » Toby’s Epril

  27. gucci mane cyeah lyrics 이클립스에서 JUnit4 테스트의 특정 테스트메소드만 실행하기 » Toby’s Epril

  28. nike shoes for cheap 이클립스에서 JUnit4 테스트의 특정 테스트메소드만 실행하기 » Toby’s Epril

  29. men foot locker 이클립스에서 JUnit4 테스트의 특정 테스트메소드만 실행하기 » Toby’s Epril

  30. ladies velcro slippers 이클립스에서 JUnit4 테스트의 특정 테스트메소드만 실행하기 » Toby’s Epril

  31. mbt technology 이클립스에서 JUnit4 테스트의 특정 테스트메소드만 실행하기 » Toby’s Epril

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2017 Toby's Epril Suffusion theme by Sayontan Sinha