Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JUnitで学ぶTest smells撃退法 / How to resolve Test sm...

aki.m
July 06, 2023
600

JUnitで学ぶTest smells撃退法 / How to resolve Test smells using JUnit5

スクラムフェス新潟2023で発表した際に使用した資料です!
https://confengine.com/conferences/scrum-fest-niigata-2023/proposal/18389/junittest-smells

aki.m

July 06, 2023
Tweet

More Decks by aki.m

Transcript

  1. 5FTU4NFMMT w $PEF4NFMMT w 0CTDVSF5FTU w $POEJUJPOBM5FTU-PHJD w )BSEUP5FTU$PEF w

    5FTU$PEF%VQMJDBUJPO w 5FTU-PHJDJO1SPEVDUJPO w #FIBWJPS4NFMMT w "TTFSUJPO3PVMFUUF w &SSBUJD5FTU w 'SBHJMF5FTU w 'SFRVFOU%FCVHHJOH w .BOVBM*OUFSWFOUJPO w 4MPX5FTUT w 1SPKFDU4NFMMT w #VHHZ5FTUT w %FWFMPQFST/PU8SJUJOH5FTUT w )JHI5FTU.BJOUFOBODF$PTU w 1SPEVDUJPO#VHT IUUQYVOJUQBUUFSOTDPN5FTU4NFMMTIUNM
  2. 5FTU4NFMMTʹ·ͭΘΔ4VSWFZ w 5FTU4NFMMTͷ਺͕ଟ͍ίʔυ͸ίʔυͷมߋ༰қੑ͕௿ܽؕ͘཰͕ߴ͍ )BJUBP8V 3VJEJ:JO +JBOIVB(BP ;JKJF)VBOH )VBKVO)VBOHl5P8IBU&YUFOU$BO$PEF2VBMJUZCF*NQSPWFECZ&MJNJOBUJOH5FTU4NFMMT z w

    5FTU4NFMMTͷൃੜ཰͸ΞϓϦέʔγϣϯͷυϝΠϯ΍छผʹґଘ͠ͳ͍ "1FSVNB ,"MNBMLJ $%/FXNBO .8.LBPVFS "0VOJ BOE'1BMPNCB l0OUIFEJTUSJCVUJPOPGUFTUTNFMMTJOPQFOTPVSDF"OESPJEBQQMJDBUJPOT"OFYQMPSBUPSZTUVEZ z /4+VOJPS -34PBSFT -".BSUJOT BOE*.BDIBEP l"TVSWFZPOUFTUQ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+6OJU ͱ5FTU4NFMMT w +BWBͷࣗಈςετϑϨʔϜϫʔΫͷσϑΝΫτελϯμʔυ w ʹ+6OJU͕ϦϦʔε IUUQTHJUIVCDPNKVOJUUFBNKVOJUSFMFBTFTUBHS w ܧଓతϦϦʔε͕͞Ε͓ͯΓɺݱࡏͷ࠷৽൛͸

    IUUQTKVOJUPSHKVOJUEPDTDVSSFOUVTFSHVJEF w +6OJU΍+6OJUͰ͸ϑϨʔϜϫʔΫ౎߹Ͱ5FTU4NFMMT͕ൃੜ͢Δέʔε΋͋ ͕ͬͨɺ+6OJUͰͦΕ͕ղফ͞Ε͍ͯΔ৔߹͕ଟ͍
  6. 5FTUJOH'SBNFXPSL +6OJU ͱ5FTU4NFMMT w +6OJUͰ௥Ճ͞Εͨ৽ػೳͷग़ݱ཰ʹ͸ภΓ͕͋Δ &MWZT4PBSFT .BSDJP3JCFJSP 3PIJU(IFZJ (VJMIFSNF"NBSBM BOE"OESF4BOUPT

    3FGBDUPSJOH5FTU4NFMMT8JUI+6OJU8IZ4IPVME%FWFMPQFST,FFQ6QUP%BUF      $VTUPN&YUFOTJPOT &YDFQUJPO5FTUJOH 1BSBNFUFSJ[FEUFTUT 0UIFS
  7. ͦͷଞ ࣌ؒͷ౎߹্ৄࡉͳ঺հΛল͍ͨ΋ͷ w 0CTDVSF5FTU &YDFQUJPO)BOEMJOH  w +6OJUͰ͸KVQJUFSBQJ"TTFSUJPOTBTTFSU5ISPXT ͰղফՄೳ +6OJU͸

    FYQFDUFEͰղফՄೳ  w +6OJU·Ͱ͸ςετதʹҙਤతʹ'BJMͤ͞Δඞཁ͕͋ͬͨͨΊɺ&YDFQUJPO )BOEMJOHΛຒΊࠐΜͰ͠·͍ͬͯͨ w 'SBHJMF5FTU 5FTU$PEF%VQMJDBUJPO  w !1BSBNFUFSJ[FE5FTU !7BMVF4PVSDFͰՄಡੑߴ͘5FTU$PEF%VQMJDBUJPO ΛഉআՄೳ w ͨͩ͠ɺύϥϝʔλ͕JOU JOU JOU JOUͱ͔ͩͱޡೝ஌ͷԹচʹͳΔͷͰ஫ҙ