Evgeny SafronovãäžçŽéçºè ãDataArt
ããã¹ãã¯ãããã°ã©ã å ã®ãšã©ãŒã®ååšã蚌æããããã«äœ¿çšã§ããŸããããšã©ãŒããªãããšã蚌æããããã«äœ¿çšããããšã¯ã§ããŸããïŒã
ãšãã¬ãŒã»ãã€ã¯ã¹ãã©
ãã¹ãã¯ã人éã®ç掻ã®ã»ãšãã©ã®åéã§é©çšããããé©çšãããæšæºåããããšã³ãžãã¢ãªã³ã°ææ³ã§ãã å²åŠã枬å®åºæºããŸãã¯å®è·µã®ãããªãã¹ãã¯ãããã°ã©ãã³ã°ãããã¯ããã«é·ãååšããŸãã ããšãã°ãå£ãåœé ããŸããã ãããååã«ã·ã£ãŒãã«ãªã£ããã©ããããã¹ãããããã«ã圌ãã¯ããããã¹ãããŸãã ããã€ãã®æ代ã§ã¯ãããšãçããŠãã人ã§ãããããšãã°å¥Žé·ã§ãã
ãã¹ãã¯ãããã°ã©ã ããµããžã§ã¯ãããŸãã¯ããããç£æ¥éçºã®æäœæ§ã®ãã¹ãã§ãã ã©ã®ããžãã¹ã§ãããã§ãããç¬èªã®åŸ®åŠããšå²åŠãæã£ãŠããŸãã ããããç§ãã¡ãç Žå£çã«è¡ã£ãããšãèŠããã¹ã¿ãŒã«ââè¿ãã§ããã-éçºè ã«ãã£ãŠææ¡ããã補åãç Žå£ããæ¹æ³ãæåããèããŠããŸãã ããã¯ãäºæž¬å¯èœæ§ãé«ããéåžžããã°ã©ã ã§ç°åžžãªããšã誀ã£ãŠè©Šã¿ãŠãšã©ãŒãèŠã€ãããŠãŒã¶ãŒã«ãšã£ãŠãããŸãäžè¬çã§ã¯ãããŸããã éçºè ã¯ããã°ã©ã ã«å¯ŸããŠç°ãªãã¢ãããŒããæã£ãŠããŸãããèŠããŠããå¿ èŠããããŸãããã¹ã¿ãŒã¯ç§ãã¡ãäœæãããã®ãå£ããªããã°ãªããŸãã-ããã圌ãã®ãã³ã§ãã
ãã¹ããœãããŠã§ã¢ãéåžžã«éèŠãªã®ã¯ãªãã§ããïŒ
éçºè ã¯ãã¹ããéããŠèãããåµé çã«èããŸã-ããã¯åé¡ã®åå ã«ãªãå¯èœæ§ããããŸãã ããã°ã©ã ãæžãããã«é ŒãŸãããšããç§ãã¡ã¯äž»ã«æŠå¿µãããŒã¿æ§é ããããã®èšè¿°ãšçžäºäœçšã«ã€ããŠèããŸãã ãã®çµæã解決çãæ瀺ããŸã-ãã°ããããããããŸãããæ¢è£œã®ãã®ã§ãã éåžžããŠãŒã¶ãŒã倧éã®ç°åžžãªæäœãå®è¡ããå Žåãå ¥åããŒã¿ãå€æŽãããå Žåã«äœãèµ·ãããã¯ã»ãšãã©ããããŸããã
ãã ããå®éã«ã¯ãå°ããªå€æŽã®çµæãšããŠæãè²»çšã®ãããééããçºçããããšã瀺ãããŠããŸãã ã³ãŒãã®èšè¿°ãäžååãªå Žåã¯ãçµéšè±å¯ãªååããããããçŽãããã«æ±ããŠããããã§ãã çµéšãç©ããšãæçåã倱æããããšã«ããã«æ°ä»ãã§ãããã ãããããšã©ãŒãæå°éã§ããå Žå-åå¥ã®ã·ã³ãã«ãããããéèååŒã®ãµã€ã³ãäžžããšã©ãŒ-ãããã段éã§ãããããèŠã€ããããšã¯éåžžã«å°é£ã§ãã
å³ 1.èªèšŒãã©ãŒã ãšãããèšå ¥ããããã®ãªãã·ã§ã³ã®æ°ã
ãã¹ãã«ãã®ãããªå°é£ãããçç±ãèŠãŠã¿ãŸãããã ãã®å³ã§ã¯ã3ã€ã®ãã£ãŒã«ãã®åçŽãªãã©ãŒã ã衚瀺ãããŠããŸãã æåã®2ã€ã®ãã£ãŒã«ãã«ã¯1ã255æåã3çªç®ã®ãã£ãŒã«ãã«ã¯1ã20æåãå ¥åã§ããŸãã è¡ã空çœã®ãŸãŸã«ããããšãã§ããŸãã 以äžã«ãå¯èœãªçµã¿åããã®æ°ã瀺ããŸããããã¯ãå®å®ã®çŽ ç²åã®æ°ãå€§å¹ ã«è¶ ããŠããŸãã ããã¯ãèãããããã¹ãŠã®ã±ãŒã¹ããã§ãã¯ããããšãéçŸå®çã§ãããšãã説åŸåã®ãã蚌æ ã ãšæããŸãã ã¯ãããããè¡ãããšã¯ããããäžé©åã§ãã
ãããžã§ã¯ããšã©ãŒã®çš®é¡
å³ 2. Steve McConnellã®èæžãPerfect Codeãã®ããŒã¿ã«ãããšãã¿ã€ãããšã®ãšã©ãŒã®åé ã¹ããŒã ã
ç·éã®çŽ25ïŒ ãæ§é ç誀差ã«èµ·å ããŠããŸãã ããŒã¿æ§é ãäœæãããããã䜿çšããŠæäœã®å®è£ ãäœæããèšèšæ®µéã§ããã€ãŸãããããã®æ§é ãä¿æããäœããã®ãæ¥çå€ããäœæãããšãã«ãçºçããŸãã ããã¯æ ¹æ¬çãªãšã©ãŒã®å·šå€§ãªå±€ã§ãã
次ã«ãæ©èœã®å®è£ ãªã©ã«é¢é£ããããŒã¿ãšã©ãŒãçºçããŸããã¢ãŒããã¯ãã£ãæåŸã®å Žæã«ããããšã¯èå³æ·±ãããšã§ãã ããã¯ãééã£ãã¢ãŒããã¯ãã£ãäœæãããããååãšããŠæçµè£œåããªãªãŒã¹ããããšãéåžžã«é£ãããšããäºå®ã«ãã£ãŠèª¬æã§ããŸãã
å³ 3.éçºã®æ®µéããšã®ãšã©ãŒã®ååžã ã¹ãã£ãŒãããã³ãã«ã®æŠèŠã
æ§ç¯ãšèšèšã®æ®µéã§ããšã©ãŒãšæ¬ é¥ã®äž»èŠãªå±€ãèæ ®ãããŸãã ããç¥ãããŠãããã¬ãŒãã«ãŒã«ã¯ããã§æ©èœããŸããæ¬ é¥ã®80ïŒ ã¯ã³ãŒãã®20ïŒ ã®ã¿ã«ããŒã«ã©ã€ãºãããŠããŸãã ååãšããŠããããã¯ããçš®ã®ã³ãŒããŒã±ãŒã¹ã§ãã 財åããžãã¯ãªã©ã®æ°åŠçãªæäœãèšè¿°ããå Žåãæ°å€ãäžžãããšããªã©ãå€ãã®ãšã©ãŒãå¢çå€å ã«ããå¯èœæ§ããããŸããã»ãšãã©ã®å Žåã¯æ©èœããŸãããã»ãšãã©ã®æ¬ é¥ã¯ã³ãŒãã®å°ããªã»ã¯ã·ã§ã³ã«ããŒã«ã©ã€ãºãããŸãã
æåãã¹ãã䜿çšãããåäœãã¹ãã䜿çšãããã«é¢ä¿ãªãããã¹ããã³ãŒãã®50ïŒ ã§ã«ããŒããããšã«ãããæœåšçãªæ¬ é¥ã®50ïŒ ãé²ãããšãã§ãããšèšãããšã¯ã§ããŸããã ããšãã°ã100åã®åäœãã¹ããäœæããå Žåã補åã®æçµå質ã2åã«ãªã£ããšã¯èšããŸããã ãã¹ãã®ããªãºã ãèããªãéçºè ãæã軜ãã±ãŒã¹ããã§ãã¯ããããã§ãã å¿ èŠãªãã©ãŒã ã«ã¯ãæšæºåãå§ãããã³ãã°ã€ã³åãå ¥åãããŠããŸã-éçºè ã¯ããã«å ã«é²ã¿ãŸãã ãã£ãŒã«ãã®1ã€ã空ã®å ŽåããŸãã¯é·ãã255æåã®ååãå®éã«å ¥åãããå Žåã圌ã¯ã±ãŒã¹ããã§ãã¯ããªãå¯èœæ§ãéåžžã«é«ãã§ãã 圌ã¯ãéæšæºæåãå°æåãšå€§æåã®çµã¿åãããå®éšããŸããã
ãã¹ãã¯ãæãäžè¬çãªå質管çææ³ã§ãã å£ã䜿çšããŠäŸãæãåºããå Žåãå®éã®æŠéã§äœ¿çšããåã«ãééããªããããããé·ãäœéšããããã«äŸé ŒããŠãã ããã ããã«è¯ãããšã«ãçç£æ®µéã§éå¶å±ã«åæããã°ã圌ã¯æŠåšãéé ããéå±ããã¹ãããŸãã ãããã£ãŠãããã°ã©ã ã®å質ãåäžãããããã«ããã¹ãã®éãå¢ãããåæã«ãã¹ããã©ã¯ãã£ã¹ã䜿çšããããšããå§ãããŸãã åªåã«æ¯äŸããŠã補åã®å質ãåäžããŸãã
éçºè ããã¹ã¿ãŒããããŒãžã£ãŒã顧客ãªã©ã誰ã§ã補åããã¹ãã§ããŸãã å°èŠæš¡ãªãããžã§ã¯ãã§ã¯ããããŒãžã£ãŒãŸãã¯éçºè ããã¹ã¿ãŒã®åœ¹å²ãå®è¡ã§ããå ŽåããããŸãã ãã ããããã§ã4ã€ã®åœ¹å²ã¯ãã¹ãŠéåžžã«éèŠã§ããããã»ã¹ã®ååå è ã¯ãããããã®èŠ³ç¹ãããªããžã§ã¯ãã確èªããŸãã éçºè -ã³ãŒãã®ä»çµã¿ã®ããªãºã ãéããŠã 圌ã¯æåãããã€ã³ã¿ãŒãã§ãŒã¹ãç Žãæ¹æ³ã«é¢ããã»ãšãã©ã®æ å ±ãæã£ãŠããŸãã ãã¹ã¿ãŒã«ââãšã£ãŠããšã©ãŒãèŠã€ããŠè£œåãç Žå£ããããšã¯çŽæ¥çãªäœæ¥ã§ãã 顧客ã¯ãã¹ãããŸã£ããç°ãªãæ¹æ³ã§èŠãŸããã€ãŸããããå°ãªããã¹ããæžããŠãããå°ãªããéãæãã ãã§ãªããçµæãšããŠé«å質ã®è£œåãåŸãæ¹æ³ã«èå³ããããŸãã ãããããããŒãžã£ãŒã¯æãèå³æ·±ã圹å²ãæ ã£ãŠãããéåžžã圌ã¯èªåã®å®è·µããã®ã±ãŒã¹ã«é Œãããšãã§ããŸãã ãã ããååãšããŠãéçºè ããã¹ã¿ãŒãããã³é¡§å®¢ã®éã®æ©æž¡ããšããŠæ©èœãããã®äž»ãªã¿ã¹ã¯ã¯è£œåãæ瀺ããããšã§ãã ããããåºåã§è£œåã®å質ã管çããã®ã¯ãããŒãžã£ãŒã§ãã
çœé»ããã¯ã¹ã®ãã¹ã
éçºè ã¯èªåã®ã³ãŒãããã¯ã€ãããã¯ã¹ãšèŠãªããŠããããããã¯ã€ããã°ã¬ãŒããã©ãã¯ããã¯ã¹ã®åæãšãã圢ã§ã®ãã¹ãåé¡ã¯èå³æ·±ããã®ã§ãã ãããããã¹ã¿ãŒãšé¡§å®¢ã¯ããã°ã©ã ããã©ãã¯ããã¯ã¹ãšèŠãªããŸããããã°ã©ã ãã©ã®ããã«æ©èœããããå®å šã«ã¯ç解ããŠããããéèŠãªæ©èœãšåäœããå¿ èŠãããæ©èœã®ã¿ãç¥ã£ãŠããŸãã
äžéšã®è£œåããã¹ã±ããã«å ¥ããªãããã«ããªã³ã©ã€ã³ã¹ãã¢ã®Webãµã€ãã®ãã°ã¯ãéçºè ã«ãšã£ãŠå°ããªåé¡ã§ãã äœããã³ãããããã³ã³ããã解é€ãã1ãæã§å€æ°ãå€æŽããã ãã§ååã§ãããã¹ãŠæ£åžžã«æ©èœããŸãã ãã¹ã¿ãŒãç¹ã«é¡§å®¢ã«ãšã£ãŠããã®ãããªãã°ã¯é¡§å®¢ã«ãšã£ãŠé©åãªè£œåãè³Œå ¥ã§ããªããããéèŠã§ãã
ããããæãèå³æ·±ãããã¯ã¹ã¯ç°è²ã§ãã ç§ãã¹ããŒããã¹ã¿ãŒãšåŒãã§ããã®ã¯ãã³ãŒããšè£œåã®ããã¿ã«æ·±ãé¢ãã£ãŠãã人ãã¡ã§ãã 圌ãã¯ãå±éãšããŒã¿ããŒã¹ãšã®éä¿¡ãã©ã®ããã«è¡ããããã«é¢å¿ããããŸãã
éçºè ã¯ã©ã®ãã¹ããæžããŠããŸããïŒ
- åäœãã¹ãã ã»ãšãã©ã®éçºè ã¯æåãã¹ãã䜿çšããŸãã äœããããå ŽåããŸãããããå®éã«æ©èœããããšã確èªããå ¥åããŒã¿ãšå€æ°ã確èªããŠãäœããã®ãã£ãŒãããã¯ãåŸãå¿ èŠããããŸãã åäœãã¹ãã¯åäœãã¹ãã®äžçš®ã§ããã€ãŸããåã³ãŒããæ£ããæ©èœãããã©ããã確èªããå¿ èŠããããŸãã
- æ©èœãã¹ãã 圌ãã®å©ããåããŠãåã ã®æ©èœãã¢ãžã¥ãŒã«ã®ãã³ãã«ãªã©ããã§ãã¯ããŸãã
- çµ±åãã¹ãã ãããã䜿çšãããšã2ã€ã®ã¢ãžã¥ãŒã«ãé£æºããŠåäœãããã©ããã確èªã§ããŸãã
- ãšã³ãããŒãšã³ãã®ãã¹ãã ã¯ã©ã€ã¢ã³ãã®èŠ³ç¹ããããŸãæåããæåŸãŸã§ãã¹ãŠã®æ©èœã確èªããŸãã å® é 䟿ã®ä»äºã«è²¬ä»»ãè² ããªããšä»®å®ããŸãã ããããããªããæžãããªã³ã©ã€ã³ã¹ãã¢ã§é¡§å®¢ã補åãéžæããŠæ¯æãã§ããããšã確èªã§ããŸãã ãããŠãååã®åºè·æºåãã§ããŠãããšããäºå®ã
å³ 4.åäœãã¹ãã®ãã©ãããã
ãã©ãããã®åºç€-åäœãã¹ã-ãããžã§ã¯ãã«ã¯å€æ°ã®åäœãã¹ããããããšãæãŸããã§ãã 次ã«ãã¢ãžã¥ãŒã«ã®çµ±åãã¹ããåãå ¥ããã¹ããç¹å®ã®æ©èœã®çŽæ¥UIãã¹ããè¡ââãããŸãã
æå
FIRSTã¯ããã¹ããæºãããªããã°ãªããªãèŠä»¶ãèšè¿°ããããã®æ¹æ³è«ã§ãã ãŸã第äžã«ãã¢ãžã¥ãŒã«åŒã§ãããååãšããŠããããã®ç¹æ§ã¯èªåãã¹ãã«å€æ¿ã§ããŸãã ãã®äœæè ã¯æåãªåç¶ã®ããã§ãããå€ãã®ããã°ã©ãã³ã°ã®äœè ã§ãã
- ã¹ããŒãïŒé«éïŒã ãã¹ãã¯é«éã§ããå¿ èŠãããã誰ãäœéã®ãã¹ããå®è¡ããŸããã 30人ã®ãã¹ã¿ãŒã®ããŒã ã§ãããããããå®è¡ããã®ã«ååãªæéããããŸããã
- ç¬ç« ãã¹ãã¯ç¬ç«ããŠããå¿ èŠããããŸããåã®ãã¹ãã®å®è¡ã«äŸåããèŠçŽ ã¯ãããŸããã
- ç¹°ãè¿ãå¯èœ ãã¹ãã¯ãã€ã§ãå®è¡ã§ãããã®åäœã¯äºæž¬å¯èœã§ããå¿ èŠããããŸãã
- 蚌æ ïŒèªå·±æ€èšŒïŒã ãã¹ãã®åäœã¯ãç¹ã«ããã°ã©ã ãäœæãã人ã«ãšã£ãŠæçœã§ãªããã°ãªããŸããã
- é©ææ§ïŒã¿ã€ã ãªãŒïŒã ãã¹ãã¯ãæ¬åœã«å¿ èŠãªãšãã«äœæããå¿ èŠããããŸãã
å³ 5. TDDããã»ã¹ã®ã¹ããŒã ã
2ã€ã®åºæ¬çãªãŠããããã¹ãæ¹æ³ã¯ãTDDãšBDDã®æŠå¿µã«äŒŒãŠããŸãã BDDã¢ãããŒãã¯TDDã«åºã¥ããŠãããTDDã«ååšããå°ããªæ¬ é¥ãæé€ããããšãç®çãšããŠããŸãã BDDãã¹ãã®æ§æã¯ãããžãã¹æåã§ããã顧客ã«ãšã£ãŠç解ãããããäžè¬ã«æè¡è ãšããŠã¯ããã»ã©äžè¬çã§ã¯ãããŸããã TDDã¯ãç©äºãæ£ããè¡ãæ¹æ³ã«é¢ãããã®ã§ãã BDDã¯ãæ£ããããšãè¡ãæ¹æ³ã«é¢ãããã®ã§ãã
TDDããã»ã¹ã¯ã©ã®ãããªãã®ã§ããïŒ
æåã«è¡ãããšã¯ããŸã äœæãããŠããªãã³ãŒãã®ãã¹ããäœæããããšã§ãã ãããã£ãŠãæ©èœããªãããšãããããŸãã ãããæ©èœããããã«ã¯ãã³ãŒããèšè¿°ããå¿ èŠããããŸãã ãã®åŸãçµå±ã®ãšãããã³ãŒããèšè¿°ããŠãã¹ããå®è¡ãããã¹ããæ©èœããããšã確èªããŸãã 次ã«ããã¹ããå€æŽããŸãïŒèŠä»¶ã®æå®ãå¢çæ¡ä»¶ã®ãã§ãã¯ã®è¿œå ãªã©ïŒã ãã®åŸããã¹ãã¯æ©èœããªããªããåã³ã³ãŒããå€æŽããå¿ èŠãçããŸãã ãã®ããã»ã¹ã¯ããã¹ããæçµçãªåºæºãæ確ã«æºãããçŽé¢ãã課é¡ãæºãããŸã§ãã«ãŒãã¢ãããããŸãã äºæ¬¡æ¹çšåŒã解ãå Žåãã¿ã¹ã¯ã¯äºæ¬¡æ¹çšåŒã®æ ¹ãèŠã€ããé¢æ°ãæžãããšã ãšä»®å®ããŸãã ãã¹ããäœæããå®æ°ã«åºã¥ããŠããŸãæ©èœãããšä»®å®ããŸãã ãããããŠãŒã¶ãŒãå æ¬çãªãœãªã¥ãŒã·ã§ã³ãèŠã€ãããå ŽåãäœãããŸããããããã¹ãã¯å€±æããä¿®æ£ãå¿ èŠã«ãªããŸãã ãããã£ãŠããã®ã¹ããŒã ã¯éçºè ã®è¡äžã«ããå¿ èŠããããŸããæ©èœããã¹ãŠã®èŠä»¶ãæºãããŸã§ãããã«åãçµãå¿ èŠããããŸãã
TDDã¯ã©ã®ããã«èŠããŸããïŒ
suite('#factorial()', function() { test('equals 1 for sets of zero length', function() { assert.equal(1, factorial(0)); }); test('equals 1 for sets of length one', function() { assert.equal(1, factorial(1)); }); test('equals 2 for sets of length two', function() { assert.equal(2, factorial(2)); }); test('equals 6 for sets of length three', function() { assert.equal(6, factorial(3)); }); });
ãã®äŸã¯JavaScriptã§èšè¿°ãããŠããŸãããæ§æçã«ã¯PHPãŸãã¯Javaã®ããã«èŠãããšæããŸãã ãã¹ãŠãããªãæçœã§ãã ãã¹ããéããšãã©ã®ãã€ã³ãããã¹ããããŠããªãããç°¡åã«èšãããšãã§ããŸãã ãã°ããç°¡åã«äœããè¿œå ã§ããŸãã ãããã£ãŠãé¢æ°ãæ£ããæ©èœããŠãããã©ããã確èªããŠãã ããã
BDDã¯TDDã«éåžžã«äŒŒãŠããŸããã説æã®æèšãéçºãšããŸãé¢ä¿ã®ãªã人ïŒãããŒãžã£ãŒãŸãã¯ããžãã¹ã¢ããªã¹ãïŒã«å°ãé©ããŠããç¹ãç°ãªããŸãã
describe('#factorial()', function() { it('should return 1 when given 0', function() { factorial(0).should.equal(1); }); it('should return 1 when given 1', function() { factorial(1).should.equal(1); }); it('should return 2 when given 2', function() { factorial(2).should.equal(2); }); it('should return 6 when given 3', function() { factorial(3).should.equal(6); }); });
åäœãã¹ãæ©èœ
- ååæ§ãšåçŽãã®ããã«ããŠããããã¹ãã䜿çšãããšãéçºè ã¯å€ãã®ãã¹ããååè¿ éã«äœæã§ããŸãã
- ã³ãŒãã®äžéšïŒã¢ãã¯ãã¹ã¿ããã¹ãã€ïŒãåé¢ããå¿ èŠããããŸãã ã¢ãžã¥ãŒã«æ¹åŒã§ã¯ãåã ã®å°ããªã»ã¯ã·ã§ã³ããããããã¹ãããŸãããããã®ã»ã¯ã·ã§ã³ãä»ã®ã»ã¯ã·ã§ã³ãšæ¥ç¶ãããŠããå Žåã¯ãåå¥ã«ãã¹ãããå¿ èŠããããŸãã
- éèŠãªç¹ã¯ãã³ãŒãã®åäœæ¹æ³ãç解ããŠããå Žåã«ã®ã¿ãã¹ããèšè¿°ã§ããããšã§ãïŒãã¯ã€ãããã¯ã¹ãã¹ãïŒã å€ãã®èšèªã«ã¯åäœãã¹ãããŒã«ããããŸãããJavaScriptã«ã¯èšå€§ãªæ°ã®èšèªãããããŸããã äž»ã«ãBDDã¹ã¿ã€ã«ã®èšè¿°ã®ãã¹ãã«çŠç¹ãåœãŠãŠããŸãã ããšãã°ãJSãšjQueryã®éçºã®åæ段éã§äœæãããQUnitãªã©ã®ãµãŒãã¹ããããTDDã¢ãããŒãã«åŒãå¯ããããŠããŸãã 誰ã§ã奜ããªãã®ãéžã¶ããšãã§ããŸããã«ã«ããšãžã£ã¹ãã³ã¯è±èªåã®ã³ãã¥ããã£ã§ã¯äžè¬çã§ãã ç§ã¯ãéçºæ®µéã§çŽæ¥å¹æçãªãéåžžã«çç£çãªãã®ã§ããã¢ã«ã奜ãã§ãã
å³ 6.åäœãã¹ãããŒã«ã
QUnitã¯jQueryéçºè ã®ã©ã€ãã©ãªã§ãããã¢ãµãŒãã¡ã«ããºã ã䜿çšããŠãTDDã¹ã¿ã€ã«ã§åäœãã¹ããèšè¿°ã§ããŸãã qunit.testããã¹ãã®ååãããã³ãã¹ãããå 容ãèšè¿°ããã³ãŒãã衚瀺ãããã¯ãã®å¥ã®ãã¡ã€ã«ã§å®è¡ãããšãã³ãŒããæ©èœããããšã確èªã§ããŸãã
Mochaã¯ãTDDããã³BDD圢åŒã§ãã¹ããäœæã§ãããã¹ããã¬ãŒã ã¯ãŒã¯ã§ãã ååãšããŠãäœæ¥ã§TDDã¢ãããŒããå®å šã«å®è£ ããããã«ãä»ã®ããŒã«ãšçµã¿åãããŠäœ¿çšââãããŸãã ã€ãŸããç®çã®åœ¢åŒã§ãã¹ããå®è¡ããã³èšè¿°ã§ããŸããããšãã°ãå¥ã®ã©ã€ãã©ãªïŒã»ãšãã©ã®å ŽåãChaiïŒãã¢ãµãŒããã§ãã¯ã®åŠçãæ åœããŸãã
Sinonã¯ãã¢ãã¯ãã¹ã¿ããã¹ãã€ãäœæããããã®ããŒã«ã§ãããçŸä»£ã®æåãããããžã§ã¯ãã§éåžžã«ãã䜿çšãããŸãã éçºè ãåäœãã¹ãã®äœæäžã«ééããå€ãã®å žåçãªåé¡ãå€ãå©ãã解決ããé¢æ°ãšã¢ãžã¥ãŒã«ã®ã»ãããå«ãŸããŠããŸãã
Jasmineã¯ãæãäžè¬çãªAngular Javascriptãã¬ãŒã ã¯ãŒã¯ã®ãšã³ã·ã¹ãã ã§å®éã«æšæºã«ãªã£ã人æ°ã®ããBDDã©ã€ãã©ãªã§ãã
ç¥è©±
- ãã¹ãã¯é·ããŠè²»çšãããããŸãã å®éããã©ã³ã¹ãèŠã€ããŠããªããããå¿ èŠãªã®ãã顧客ã«èª¬æããå¿ èŠããããŸãã ã©ã€ãã©ãªããã¹ãä»ãã®è²¡åããŒã¿ã§ã«ããŒããªãå Žåããã¡ãã3æ¥åã«ãµãŒãã¹ããªãªãŒã¹ããŸãã ãããã顧客ã¯ãã¹ãã®å€±æã®çµæãšããŠçããå¯èœæ§ã®ãããªã¹ã¯ãç解ããåãå ¥ããªããã°ãªããŸããã ååãšããŠãã¢ãžã¥ãŒã«ã®ã¹ã ãŒãºãªæäœãã©ãã»ã©éèŠã§ãããã¯ã顧客ãéåžžã«ããç解ããŠããŸãã
- ãã¹ãã®äœæã¯éå±ã§éå±ã§ãã ããããããªãã®æ¯ã磚ãããšãããŸããšããµã€ãã£ã³ã°ã§ã¯ãããŸããããããŠç§ãã¡ã¯æ¯æ¥ãããããŸãã ããªãããã®ååŒã«æ £ããŠããããã§ãã éçºè ã®ç掻ã®äžã§ããŸã£ããåãç«å Žã§ãã¹ããåããå¿ èŠããããŸãã ãã¶ããããªãã¯æèãå°ãåæ§ç¯ããŠããã¹ãã®ããªãºã ãéããŠãå«ããŠãããªãã®ããã°ã©ã ãèŠãŠãã ããã
- ãã¹ãã¯100ïŒ ã³ãŒãã§ã«ããŒã§ããŸãã ãšã©ãŒãèŠã€ãããªãã£ããšããŠããããã¯æçµçã«ããã€ãã®ãã°ããããã¢ããããªãããšãæå³ããŸããã ãã ãããã¹ããäœæãããšãæçµè£œåãæ©èœããå¯èœæ§ãå€§å¹ ã«é«ãŸããŸãã ããªããæ¯ã磚ããå Žåãããã¯åœŒãã決ããŠè±èœããªããšããæå³ã§ã¯ãããŸããã ãããããã®è¡çæé ã®å©ç¹ãçã人ã¯ããŸããã
ãããžã§ã¯ãã®ç¶æ³
- 顧客ã¯ããããžã§ã¯ãã§åäœãã¹ããäœæãããšããèãããµããŒãããŠããŸããã ãã®ãããªç¶æ³ã§ã¯ãäœæããã補åãå¿ èŠãªå質ã¬ãã«ãæºããããã«ããã©ã³ã¹ãæ¢ããŠäº€æžãã䟡å€ããããŸãã ãã¹ããæžãããšãèŠæ±ãããæèçãªã¯ã©ã€ã¢ã³ããããŸãã
- 2çªç®ã®ãã€ã³ã-ãã¹ãã¯ã¡ããªãã¯ã®ååšã«ã€ããŠã®ã¿èšè¿°ããããã¹ãã®ãçŽåºŠãã«ã¯ååãªæ³šæãæãããŸããã ãäœãããããšããªããšã-ããã¯ãŸãã§ããããããèµ·ãããŸã-ãã¹ããæžããŸãããšãããŒãžã£ãŒã¯èšããŸãã éçºè ã¯åæããŸãããã±ãŒã¹ã¹ã¿ãã£ãèæ ®ããã«ãã¹ããäœæããŸããã以åã®ãã¹ããåã«è€è£œããŸãã 誰ããããã®ãã¹ããå¿ èŠãšããŸããããã«ãã¬ããžã¯æ¡å€§ããŠããããéã¯èœã¡ãŠããŸãã æåŸã«ã®ã¿ãæ éãã補åãå ¥æããå¯èœæ§ããã¹ãŠãããŸãã
- ã³ãŒããæžãããããã£ãšåŸã«ãã¹ããæžã-å®éããããæªãã ããšãã°ã3幎åã«ãç¬èªã®ã³ãŒãã®ãã¹ããæžãããšã¯æ¬åœã«å¯èœã ãšã¯æããŸããã ã³ãŒããã©ã®ããã«æ©èœããããåã ã®ã¢ãžã¥ãŒã«ã®åäœã®åºæ¬æ¡ä»¶ãç解ããããšã¯ã決ããŠç°¡åã§ã¯ãããŸããã