ãã®ããŒã«ã«ã€ããŠç¥ããªã人ãããŸãã ãããã£ãŠãã¢ãªã¥ãŒã«ã¬ããŒãã®ç°¡åãªçŽ¹ä»ããå§ããŸãã
ãã®è³æã®åºç€ã¯ãHeisenbag 2017 Piterã«ã³ãã¡ã¬ã³ã¹ã§ã®Artem Eroshenko ã«ãããã¬ãŒã³ããŒã·ã§ã³ã§ããã 12æ8ã9æ¥ã«éå¬ãããã¢ã¹ã¯ã¯äŒè°ã§ãArtyomã¯æ°ããã¬ããŒããé ä¿¡ããŸãã
ã¢ãªã¥ãŒã«ãã¬ãŒã ã¯ãŒã¯ãšã¯äœã§ããïŒ
ãŸããAllureãã¬ãŒã ã¯ãŒã¯ã¯ãããããããèªåãã¹ãã¬ããŒããäœæããããã®ããŒã«ã§ãã
ã¢ãªã¥ãŒã«ã¯ã©ã®ãããªåé¡ã解決ããŸããïŒ ãŸãããã¹ãã§äœãèµ·ãããã瀺ããŸãã
ãã®åé¡ã解決ããããã«ãã¢ãªã¥ãŒã«ã¯æ·»ä»ãã¡ã€ã«ãã¹ããããªã©ãå«ãåãã¹ãã«è©³çŽ°ãªå®è¡ã¹ã¯ãªãããé©çšããŸãã
第äºã«ãããŒã ã®ããŸããŸãªåœ¹å²ã¯ãäžè¬ã«ãã¹ãçµæã衚瀺ããããã®ããŸããŸãªèŠä»¶ãæ瀺ããŸãã ããšãã°ãéçºè ããã¹ãã¯ã©ã¹ããšã«ãã¹ãã®ã°ã«ãŒãã衚瀺ããæ¹ãã¯ããã«äŸ¿å©ã§ãã 圌ã¯ãã©ã®ãã¹ãã¯ã©ã¹ãšã¡ãœããã§ãšã©ãŒãçºçããã®ãçåã«æããŸãã äžæ¹ããããŒãžã£ãŒã¯æ©èœã®è¡šç€ºã«ãã£ãšèå³ãæã£ãŠããŸãã æ©èœã«è¿ãã§ãã 圌ã¯ãã©ã®æ©èœãæ©èœãããã©ã®ãããªçç±ã§æ©èœããããç¥ããããšèããŠããŸãã ã¢ãªã¥ãŒã«ã¯ãã®åé¡ã解決ããŸãã
ããŠãã¢ãªã¥ãŒã«ã解決ãã3çªç®ã®åé¡ã¯ãã©ãŠã¶ãŒåç©åã§ãã ã©ã®ãã¬ãŒã ã¯ãŒã¯ã䜿çšããŠããŠãããã€ã§ãåäžã®ã¬ããŒããäœæã§ããŸãã
ãããé åã¬ããŒãã§ãã
å šäœçã«é åã¯ããªãã¯ãŒã«ãªããã§ãã å¶éããã圌ã¯åžžã«1ã€ã®ããŒã¿ãœãŒã¹ãããããã¢ããã¿ãŒãæã£ãŠããããšãããããŸãã ãã®ç¥è©±äžã®ã¢ããã¿ãŒã®ä»çµã¿ã次ã«ç€ºããŸãã
jUnitã§ãã¹ããæžããŠãããšæ³åããŠãã ããã Allure jUnitã¢ããã¿ãããã«æ¥ç¶ããŸãã ãã¹ãã®å®è¡äžã«ãã¢ããã¿ãŒã¯ãã¹ãŠã®å¿ èŠãªæ å ±ãåéããŸãã 圌ã¯ããã¹ããéå§ããããšãããã¹ããçµäºãããšããã©ã®ãšã©ãŒãçºçããããç解ããŠããŸãã ãŸãããã¹ãã¹ã¯ãªããã«é¢ãã詳现æ å ±ãåéããŸãã
ãã¹ãã®å®è¡åŸãã¢ããã¿ãŒã¯ããŒã¿ãxmlã«ä¿åããŸãã ããã圌ã®ä»äºã§ãã
ãã®ãããªããã€ãã®xmlãã¡ã€ã«ã«åºã¥ããŠãã¢ãªã¥ãŒã«ã¬ããŒããäœæãããŸãã
ãã¹ããã¬ãŒã ã¯ãŒã¯ããšã«åå¥ã®ã¢ããã¿ãŒãäœæãããŸãã
ãã ãããã¹ãŠã®æ å ±ãã¢ããã¿ãŒã«ããããã§ã¯ãããŸããã ããªãã¡ ç¹å®ã®ãã¬ãŒã ã¯ãŒã¯ã«éåžžã«è¿ããããã¢ããã¿ãŒãããã¹ãŠã®æ å ±ãæœåºããããšã¯äžå¯èœã§ãã
ããšãã°ãã¢ããã¿ãŒã«ã¯æ§æã«é¢ããæ å ±ããããŸãããæ£ç¢ºã«äœããã¹ãããŠããŸããã å±¥æŽããŒã¿ãªã-ãã¹ãã®éå§æãåéæãªã© ãŸããã¢ããã¿ãŒã«ã¯æªè§£æ±ºããã³è§£æ±ºæžã¿ã®åé¡ã«é¢ããæ å ±ã¯ãããŸããã ããããã¢ãªã¥ãŒã«ã®æ°ããããŒãžã§ã³ãå€ãã®ããŒã¿ãœãŒã¹ãæäŸããçç±ã§ãã
ããšãã°ãã¢ããã¿ãããã¹ãã«é¢ããæ å ±ãåŒãç¶ãååŸããŸãã ããã¯éåžžã®æ å ±ã§ãããã¹ã¯ãªãããªã©ããããŸãã ãã¹ãã®å±¥æŽã«é¢ããæ å ±ïŒæåŸã«å®è¡ãããæ¥æããšã©ãŒã®çš®é¡ãªã©ïŒã¯ãCIãµãŒããŒããååŸããŸãã JiraãããªãŒãã³ãã±ãããã¹ããŒã¿ã¹ã補åãšã©ãŒã«é¢ããæ å ±ãååŸã§ããŸãã ãŸããå¿ èŠã«å¿ããŠãæ¢ã«äžéšã®ã¢ããã¿ãŒããµããŒãããå¿ èŠãªæ å ±ãAllureã«è¿œå ããæ¡åŒµæ©èœãå®è£ ã§ããŸãã ããªãã¡ Allureã®æ°ããããŒãžã§ã³ã¯ãäž»ã«è€æ°ã®ããŒã¿ãœãŒã¹ãæã€ããã«æ§æãããŠããŸãã ãœãŒã¹ã®æ°ãå¢ãããŠã¬ããŒããè£è¶³ããå¿ èŠãªãã¹ãŠã®æ å ±ãå«ãŸããããã«ããŸãã補åãŸãã¯ãã¹ãã®åé¡ãããã«ç解ã§ããŸãã
ã¢ãªã¥ãŒã«2
次ã«æããŸãïŒ
- ïŒç¹å®ã®ãã¬ãŒã ã¯ãŒã¯ã«åºæã§ã¯ãªãïŒå
šäœãšããŠã®Allureã®äž»èŠãªå€§ããªæ©èœãšæããããã®ã
- ã¢ãªã¥ãŒã«ãèªåçšã«ã«ã¹ã¿ãã€ãºããæ¹æ³ãããã«ã¯çŽ æŽãããæ¡åŒµã¡ã«ããºã ããããŸãã
- ã¢ãªã¥ãŒã«ãžã®ç§»è¡æ¹æ³ã
æ°æ©èœ
ãã¹ãå®è¡ã¹ã¯ãªãã
ã¢ããã°ã¬ãŒãããããã¹ãå®è¡ã¹ã¯ãªããã«éåžžã«æºè¶³ããŠããŸãã
ããã«äœãçŸããŸãããïŒ
- ãã¹ããã£ã¯ã¹ãã£ã®ãµããŒãã ããã§ããã¹ãã®åïŒã¯ã©ã¹ã®åãã¯ã©ã¹åïŒããã³ãã¹ãã®åŸïŒã¯ã©ã¹ã®åŸãåŸïŒã«å®è¡ãããã³ãŒãã確èªã§ããŸãã æ§æã®æºåãšã¯ãªã¢ã«é¢ããæ
å ±ã¯ãã»ããã¢ãããšãã£ã¢ããŠã³ã®ãããã¯ã«ãããŸãã
- ã¹ãããã«ãã©ã¡ãŒã¿ãŒãè¿œå ããŸããã ããã§ããã¹ãŠã®ãã©ã¡ãŒã¿ãŒãã¿ã€ãã«ã§å°å·ããå¿
èŠã¯ãªããªããŸããããŠãŒã¶ãŒåãªã©ã®å¿
èŠãªãã©ã¡ãŒã¿ãŒã®ã¿ãå°å·ã§ããŸãã ãããŠãä»ã®ãã¹ãŠã®ãã©ã¡ãŒã¿ãŒã¯äŸ¿å©ãªã©ãã«ã«ãªããŸãã
- ããã§ããã¹ãå®è¡ã¹ã¯ãªããã«ã«ã¹ã¿ã ãããã¯ãè¿œå ã§ããŸãã ããšãã°ãã¹ã¯ãªãŒã³ã·ã§ããæ¯èŒã¡ã«ããºã ã䜿çšããå ŽåãDiffããã¹ãã¹ã¯ãªããã«çŽæ¥è¿œå ã§ããŸããã¹ã¯ãªãŒã³ã·ã§ãããç°ãªãããããã®ãããªåé¡ãçºçããããšãããã«ããããŸãã
ãã¹ãã®åèµ·å
ãã¹ãã¯å¿ ãããå®ç§ã§ã¯ãããŸããã ãã¹ãã€ã³ãã©ã¹ãã©ã¯ãã£ã®ç°å¢ã¯ç¹ã«äžå®å šã§ãã ãŸããå€ãã®å Žåããã¹ããåéããå¿ èŠãããç¶æ³ããããŸãã ã€ãŸãããã¹ãã1åå®è¡ãããããå£ããŠåèµ·åããŸãããããäžåºŠå£ããŠã3åç®ã®èµ·åã§ãã¹ãŠãåé¡ãããŸããã ãŸããåèµ·åã¯äœããã®ã€ã³ãã©ã¹ãã©ã¯ãã£ã®åé¡ã«ãããã®ã§ããã 以åã¯ãAllureã¯ãããã®ãã¹ããçµã³ä»ããããšãã§ããŸããã§ããã 圌ã¯ããã3ã€ã®ç°ãªããã¹ãã ãšæã£ãã
çµ±èšãæãªããªãããã«ããã¹ã¿ãŒã¯éåžžãã«ã¹ã¿ã ã¢ããã¿ãŒã®å©ããåããŠãç Žæãããã¹ãã®ã¹ããŒã¿ã¹ãã¹ãããã«å€æŽããŸãããã€ãŸãããããããã¹ãã¯äžèŠã§ãã ãã ããããã§ãçµ±èšãæãªãããŸãã 100ïŒ ã®ã°ãªãŒã³ãã¹ãã§ã¯ãªãã90ïŒ ã®ã°ãªãŒã³ãã¹ããš10ïŒ ã®ã¹ãããã§ãã ããã«ãããªãŒå ã®ãããã®ãã¹ãã¯å¯èŠã§ãã-å€èŠ³ã«å¹²æžããŸããã
æ°ããAllureã¯ãåè©Šè¡ïŒåèµ·åïŒãèªåçã«èªèãã1ã€ã®ãã¹ãã«æ¥çããŸãã
ããã¯ã©ãã§ããïŒ ã¯ã©ã¹ãã¡ãœããããã¹ããã©ã¡ãŒã¿ãŒãåæã§ããŸãã ããã«åºã¥ããŠãããããå±¥æŽIDãçæãããŸããããã¯ãæ¥çãå®è¡ã§ããäžæã®ãã¹ãããŒã§ãã ãã®ããŒã§ã¯ããã¹ãã¯æéé ã«åéãããŸãã æåŸã®ã¹ããŒã¿ã¹ã¯ãæåŸã®ãã¹ãããïŒæéã«ãã£ãŠïŒæ±ºå®ãããŸãã
次ã®ããã«ãªããŸãã
ãã¹ãã®äžéšã«ãåè©Šè¡ãšåŒã°ããç¹å¥ãªãããã¯ã衚瀺ãããŸãã ãã¹ãã®åéã«é¢ããæ å ±ãå«ãŸããŠããŸãã ãããã®ãã¹ãã¯ããã®ãããã¯ãé€ããä»ã®ã©ãã«ã衚瀺ãããªãããšã«æ³šæããŠãã ããã ãããã¯çµ±èšãæãªããŸãããããªãŒã«çŸããŸããã
ãã¹ããžã®ãªã³ã¯ã¯ã¯ãªãã¯å¯èœã§ãããªã³ã¯ãã¯ãªãã¯ãããšãååãã¹ãã倱æããçç±ã確èªã§ããŸãã
ç§ã®æèŠã§ã¯ããã®ãããªãã¹ãã¯äžå®å®ã§ãããããããŸãè¯ããããŸããã æåã¯ãã¹ãã§ãšã©ãŒãçºçãããããããã§ãšã©ãŒãçºçãããã¹ãã«åæ ŒããããšãããããŸããã ç§ãã¡ã¯ãã®ãããªãã¹ããã圌ãä¿¡é Œãããã¹ãã§ã¯ãªãããšã瀺ãç匟ã§èã«çœ®ããŸããã åæ§ã®ã¢ã€ã³ã³ãããªãŒã«è¡šç€ºãããŸãã ããªãã¡ ãã®ãããªãã¹ãã¯å€±ãããŸãããããªãŒãéããŠãã¯ã©ãã·ã¥ã®åå ãåæããå¿ èŠããããã¹ãŠã®ãã¹ããããã«ç¢ºèªããŠãã ããã
ãã ãããã®ãããªãã¹ãã¯å šäœçãªããã©ãŒãã³ã¹çµ±èšã«ã¯åœ±é¿ããŸããã
ã¹ã¿ãŒãã¢ããã®çµã¿åãã
ãã®æ©èœã¯ãäžèšã®æ©èœã®çµæã§ãã è€æ°ã®èµ·åã1ã€ã«ãŸãšããããšãã§ããŸãã
ããªãããã¹ããå®è¡ãããããã®ããã€ããã€ã³ãã©ã¹ãã©ã¯ãã£ã®åé¡ã®ããã«èœã¡ããšæ³åããŠãã ããã ãã®åŸããã¹ããåéãããšãåã³äžéšãèœã¡ãŸããã æçµçã«ããã¹ãã修埩ããå®éã«åæ Œãããã¹ãã瀺ãã¬ããŒãã衚瀺ããŸãã ã¯ããåååãããšããããã€ãã®ãã¹ããå£ãããšãããèµ€ãã®æ å ±ããããŸãã
ããã¯1ã€ã®ã³ãã³ãã§å®è¡ã§ããŸãã
$ allure generate \ #1 first-launch \ #2 second-launch \ #3 third-launch \
ã¢ãªã¥ãŒã«çæãè¡ãã3ã€ã®ãã£ã¬ã¯ããªïŒ1åç®ã2åç®ã3åç®ã®å®è¡ïŒãæå®ãããšãåè©Šè¡ããããã¹ãŠã®ãã¹ããã€ãŸã 圌ã¯å®è¡ããããã¹ãŠã®ãã¹ããæ¥çããæåŸã®çµæïŒç·ã§ã¯ãªãèµ€ã§ããå¯èœæ§ããããŸãïŒãååŸããä»ã®ãã¹ãŠã®ãã¹ããåè©Šè¡ããŸãã
ãã®ã¡ã«ããºã ã«ãããè€æ°ã®èµ·åãŸãã¯åèµ·åã«åºã¥ããŠæŠèŠã¬ããŒããçæã§ããŸãã
ãšã©ãŒã«ããŽãª
ãã®æ©èœã¯ãã¬ããŒããããéã解æããã³åæã§ãããããéåžžã«æ°ã«å ¥ã£ãŠããŸãã
ãåãã®ãšãããã¢ãªã¥ãŒã«ã«ã¯4ã€ã®å®äºã¹ããŒã¿ã¹ããããŸãã
ããã¯ïŒ
- ã¹ãããããŸãã
- å£ãã
- 倱æïŒåé¡ãæ€åºãããïŒ;
- åæ ŒïŒãã¹ãã«åæ ŒïŒã
ããã¹ãçšã®ãŠãŒã¶ãŒäœæãšã©ãŒãããã»ã¬ã³ãšã©ãŒãããã»ã¬ã¯ã¿ãŒã®åé¡ããªã©ãè¿œå ã®ã¹ããŒã¿ã¹ãè¿œå ããããã«ããæ±ããããŸããã ã¹ããŒã¿ã¹ã®æ°ãå¢ããã®ã§ã¯ãªãããšã©ãŒã®ã«ããŽãªã§ããçŽäº€æŠå¿µãè¿œå ããããšã«ããŸããã
ã«ããŽãªãŒã䜿çšããã«ã¯ãcategories.jsonãšããæ§æãã¡ã€ã«ãæºåããå¿ èŠããããŸãã ãã®ãã¡ã€ã«ã«ã¯ã䜿çšãããšã©ãŒã®ã«ããŽãªã«é¢ããæ å ±ãå«ãŸããŠããŸãã
[ { "name": " ()", "messageRegex": ".*Unable to locate element.*", "matchedStatuses": ["broken"] }, { "name": " ", "messageRegex": ".*Timed out .* from renderer.*", "matchedStatuses": ["broken"] } ]
ããšãã°ããå»æ¢ããããã¹ãããšããã«ããŽãªãäœæããŸãããããã¯ä¿®æ£ãå¿ èŠãªå€ããã¹ãã§ãã ãã¿ãŒã³ãæºãããã¹ãŠã®ãšã©ãŒãããã«è¿œå ãããŸãïŒãã®å ŽåãèŠçŽ ãããŒãžã«èŠã€ãããªãå ŽåïŒãããã§ã»ã¬ã¯ã¿ãŒãä¿®æ£ããå¿ èŠããããŸãã ãã®åŸãå£ããç¶æ ã®ãã¹ãŠã®ãã¹ããããã«å«ããå¿ èŠããããšèšããŸãã
ãã©ãŠã¶ã®ã¯ã©ã¹ã¿ãŒã®åé¡ã远跡ããããã«ã¿ã€ã ã¢ãŠããèšå®ããããšãã§ããŸãã
ã¬ããŒããçæãããšãæ°ããã¿ããäœæãããŸãã
以åã¯ããã®ã¿ãã¯æ¬ é¥ãšåŒã°ããŠããŸãããã€ãŸãã補åã®æ¬ é¥ãšãã¹ãã«é¢ããæ å ±ããããŸããã çŸåšããŸããŸãå€ãã®ããŒã¿ãç¹ã«ã«ããŽãªã«é¢ããæ å ±ã衚瀺ãããŠããŸããããã©ãŠã¶ã®ã¯ã©ã¹ã¿ã®åé¡ã-1ã€ã®åé¡ããæ代é ãã®ãã¹ãã-2çªç®ã®åé¡ã 次ã«ããã¹ãã§èŠã€ãã£ãåé¡ãšãå解ããå¿ èŠãããæ°ããåé¡ã ãããã£ãŠããã¹ããå®è¡ããåŸããã®ã¿ãã䜿çšããŠããã¹ãã§å®éã«äœãèµ·ãã£ãã®ãããŸãã©ã®ãããªçç±ã§èœã¡ãã®ãããã°ããææ¡ã§ããŸãã
ãšã©ãŒã«ããŽãªã¯åãã¹ãã«è¡šç€ºãããŸãã
ãã®ãã¹ããå±ãããšã©ãŒã®ã«ããŽãªã瀺ãæ°ãããããã¯ãèŠãããšãã§ããŸãã ãã®ãããªã«ããŽãªãããã€ãååšããå¯èœæ§ããããŸãããããããããã€ãã®åé¡ãåå ã§ãã¹ãã倱æããå ŽåããããŸããããã«ã¯ããã€ãã®ã«ããŽãªããããŸãã
ãšã©ãŒã®ã«ããŽãªã«åãçµã¿å§ããã°ããã§ãéçºã§ããå€ãã®èšç»ããããŸãã ç¹ã«ãç§ã¯æ¬åœã«BDDãšã¹ã€ãŒãã«åé¡ãè¿œå ããããšæããŸãã ç§ã¯ãã®ãããªããšãç解ããããšæããŸãïŒæ¿èªããã§ãã¯ããŸããã§ããããã¹ãŠãSeleniumã®åé¡ã«ããã£ãããã§ãããŸããå¥çŽãäœæãããŠããªããããã¯ã©ã€ã¢ã³ãã®äœæããã§ãã¯ããŸããã§ããã ã€ãŸããã¬ããŒãå ã®è¿œå ããŒã¿ã䜿çšããŠæäœããå¿ èŠããããŸãã ãã®ããã5ã€ã®ãã¹ãã±ãŒã¹ã§ã¯ãäžéšã®æ©èœãæ©èœããªãããªã©ã®æ å ±ã«éå®ãããŸãããããã®æ©èœã§ã¯ç¹ã«æ©èœããªãããšãç解ããŠãã ããã 2çªç®ã«ç解ãããããšã¯ãã«ããŽãªããšã®çµ±èšã§ãã ã€ã³ãã©ã¹ãã©ã¯ãã£ãµããŒãããŒã ã«æ¥ãŠæ¬¡ã®ããã«èšãã®ã¯éåžžã«èå³æ·±ãããšã§ããããã¹ãã®20ïŒ ãSeleniumã®ãšã©ãŒã®ããã«åžžã«å€±æããŠããŸãã ããã«ã€ããŠäœãããããã ããã«åãçµã¿ããã®æ©èœã¯è¿ãå°æ¥ç»å Žããäºå®ã§ãã
è©Šéšå±¥æŽ
ç§ãã¡ãããå°ããããæãèå³æ·±ãç¹ã¯ããã¹ãã®æŽå²ã§ãã
泚ææžã¿-å ¥æã ãã¹ãå±¥æŽã¯ãããŒã¿ãœãŒã¹ã§ããCIãµãŒããŒãšã®éä¿¡ãéããŠAllureã«ãã£ãŠå ¬åŒã«ç¶æãããããã«ãªããŸããã JenkinsãTeamCityãããã³Bambooã§ãµããŒããããããã«ãªããŸããã ãŸãããã¬ãŒã ã¯ãŒã¯ãç°¡åã«é©åãããAllureã䜿çšããŠçæããããšãã§ããŸãã
ããã¯ãã¹ãŠç®±ããåºããŠåäœããããšãç解ããããšã¯éåžžã«éèŠã§ãã ã¢ãªã¥ãŒã«ã¯ããŒã¿ããŒã¹ãååŸããŸããã§ãã;ããã¯ãŸã åãã·ã³ãã«ã§ç°¡åã§ä¿¡é Œã§ããããŒã«ã§ãã å®éã«ã¯ãéçã¬ããŒããçæããŸãããçæäžã«ãã©ã®ãã¹ãããã€å®è¡ããããã«é¢ããããŒã¿ãCIãµãŒããŒãããã«ã¢ããããŸãã
ã¢ãªã¥ãŒã«2ã䜿çšãããšãã«æåã«è¡šç€ºãããã®ã¯ããã¬ã³ãæ å ±ã§ãã
éå»20åã®éå§-å®è¡ããããã¹ãã®ã°ã©ãã衚瀺ãããŸãã ãã®ãã£ãŒããã¯ãªãã¯ãããšã以åã®ãã«ãã«åãæ¿ããããŸãã
ã¹ããŒãªãŒã¯ãã¹ãã±ãŒã¹ããŒãžã«ã衚瀺ãããŸãã
圌女ã¯ä»ããªãã©ã€ãããã¯ã®ããã«èŠããŸãã ããã«ããè¡ãã¯ãªãã¯å¯èœã§ãã è¡ãã¯ãªãã¯ãããšãç¹å®ã®çµæãåŸãããã«ä»¥åã®ãã«ãã®å±¥æŽã«æ»ããŸãã
ç¹å®ã®åé¡ãç°¡åã«åãæ¿ããŠãã°ããåæã§ããŸãã
ç©èªãå§ãŸãã«ãããŸããã å°æ¥çã«ã¯ãæ£ç¢ºã«æ°ãããã¹ãã®ã¡ã«ããºã ãå®éã«åäœãããããšæããŸãïŒãä»é±è¿œå ããããã¹ãã®æ°ããã人ã®å Žå-1人ã®ãã¹ã¿ãŒã«ââãã£ãŠè¿œå ããããã¹ãã®æ°ã2çªç®ã®ãã¹ã¿ãŒã«ââãã£ãŠè¿œå ããããã¹ãã®æ°ãããæ°ãããã¹ãã®å®å®æ§-æ°ãããã¹ãæåçã€ã³ãžã±ãŒã¿ããã¹ãããŸãããªã©ã ç§ãã¡ã¯ãã®æ¹åã«é²ã¿ãŸã-ã¢ãªã¥ãŒã«ã§ã¯ãæ°ãããã¹ãããããã®ãã¹ãã®åé¡ç¹ã«ã€ããŠã®æ å ±ããããŸãã
ããã«ãæ¢ç¥ã®åé¡ã«é¢ããå±¥æŽããŒã¿ã«åºã¥ããŠåé¡ã解決ããããšæããŸãã ãã®ãããªåé¡ããã§ã«çºçããããšãã©ãã§çºçããããªã©ãããã«ç€ºããããšæããŸãã ãŸããããã¯å±¥æŽããŒã¿ã«åºã¥ããŠè¡ãããŸãã
ããŒã¿ãšã¯ã¹ããŒã
ããèªäœã瀺åããå¥ã®æ©èœã¯ãããŒã¿ã®ãšã¯ã¹ããŒãã§ãã çŸåšããã®ããã«ãµããŒããããŠããŸãã ããŒã¿ããšã¯ã¹ããŒããããªãã·ã§ã³ããããŸãããããŒã¿ãšã¯ã¹ããŒãã®æ©èœã¯ãŸã æºåãã§ããŠããŸããã ããã«ãããããããç§ã¯æ¬åœã«ãããã«ã€ããŠè©±ãããã§ãã
æåã®æ©èœã¯èŠçŽã¬ããŒãã§ãã
ã¢ãªã¥ãŒã«ã¯é·ãéãé»åã¡ãŒã«ã§éä¿¡ã§ããã¬ããŒããæ±ããŠããŸããã ããã¯ç¹ã«ããã¹ãã«åæ ŒããCIãµãŒããŒã«åœãŠã¯ãŸããCIã¯åã«ããã«ãã«åé¡ããããŸããããšèšãããšãã§ããŸãã ãã«ãã«æ·»ä»ããŠã¡ãŒã«ã§éä¿¡ã§ããçµ±åã¬ããŒããçæããŸãã
ããã«ãCSVããã³PDF圢åŒã§èŠçŽçµ±èšããšã¯ã¹ããŒããããã§ãã ã¢ãªã¥ãŒã«ãå°å·ããŠå人ã顧客ã«è»¢éãããšãã¬ããŒããã¯ãªãã¯ããå¿ èŠããªããªããŸãã
ããã§ãã¢ãªã¥ãŒã«ã®å€§ããªç¹åŸŽã«ã€ããŠã®è¬æŒã¯çµããã§ãã ããŸããŸãªãœãŒã¹ããã¬ããŒãçšã®ããŒã¿ãåéãå§ãããã®æ¹åã§éçºãç¶ããŸãã
ã«ã¹ã¿ãã€ãºæ¹æ³
次ã«ãèªåã§ã¢ãªã¥ãŒã«ãã«ã¹ã¿ãã€ãºããæ¹æ³ã«ã€ããŠã話ããããšæããŸãã ãã¬ãŒã ã¯ãŒã¯ãšåŒã°ããã ãã§ã¯ãããŸããã äœããè¿œå ã§ããã¯ãã§ãã
ç§ã®æèŠã§ã¯ãã¢ãªã¥ãŒã«ã«ã¯éåžžã«åªããæ¡åŒµã·ã¹ãã ããããŸãã æ¡åŒµæ©èœã¯JavaãšJavaScriptã䜿çšããŠèšè¿°ãããŸãïŒã¢ãªã¥ãŒã«èªäœã¯JavaãšJavaScriptã§èšè¿°ãããŸã-éå£ã¯JavaScriptã§èšè¿°ãããã«ãŒãã«ã¯Javaã§èšè¿°ãããŸãïŒã
ã¹ã¯ãªãŒã³ã·ã§ããã®æ¯èŒ
äŸãšããŠãã¹ã¯ãªãŒã³ã·ã§ããã®æ¯èŒããã¹ãã±ãŒã¹ããŒãžã«çŽæ¥è¡šç€ºããã®ã«åœ¹ç«ã€å°ããªæ¡åŒµæ©èœãäœæããŸãããã ããã«ãããã¯ãè¿œå ããŸãã Webã€ã³ã¿ãŒãã§ãŒã¹ãæ±ããã¹ãŠã®ãã¹ã¿ãŒã¯ããã®ãããªåé¡ã«çŽé¢ããŠãããšæããŸãã ã¹ã¯ãªãŒã³ã·ã§ãããæ¯èŒããããšã§ããµãŒãã¹ã®æ©èœã«é¢ããäž»èŠãªãã¹ãããã°ããå±éã§ããŸãã ãã¹ãäžã®èŠçŽ ã®ã¹ã¯ãªãŒã³ã·ã§ãããæ®ããå®çšŒåäžã®èŠçŽ ã®ã¹ã¯ãªãŒã³ã·ã§ãããæ®ãã次ã®ãããªå·®åã確èªããŸãã
ãã®ãããéåžžã«è¿ éã«å€æ°ã®ãã¹ããå®è¡ã§ããŸãã
æ·»ä»ãã¡ã€ã«ãšããŠè¿œå ãããã¹ã¯ãªãŒã³ã·ã§ããã ãããã«å°éããã«ã¯ãæåã«ãã¹ãã±ãŒã¹ãéãã次ã«ãã¹ããå®è¡ãã次ã«å®è¡ã«é²ã¿ãã¹ã¯ãªãŒã³ã·ã§ãããžã®ãªã³ã¯ãã¯ãªãã¯ãããšã衚瀺ãããŸãã
ããã§ããã¹ãå®è¡ã¹ã¯ãªããã«çŽæ¥-ã¡ã€ã³ããŒãžã«çŽæ¥ãããã¯ãè¿œå ã§ããŸãã
ãã®ãããªæ¡åŒµæ©èœãäœæããæ¹æ³ã¯ïŒ
ãŸãããããžã§ã¯ãã®ãã«ãã·ã¹ãã ãšããŠgradleã䜿çšããŸãã
ç§ã¯å éšã«ã€ããŠã¯ãã以äžè©±ããŸãããæ¡åŒµæ©èœèªäœã«éäžããããšæããŸãã ãããè¡ãã«ã¯ãå¿ èŠãªæ å ±ãå®è¡ããã ãã®JavaScriptãäœæããå¿ èŠããããŸãã
ãŸããç»åãã¬ã³ããªã³ã°ããé¢æ°ãäœæããŸãã
function renderImage(src) { return '<div class="âŠ">' + '<img src="' + src + '">' + '</div>'; } } //Backbone.Marionette.View var ScreenDiffView = View.extend({ ⊠}) allure.api.addTestcaseBlock( ScreenDiffView, {position: 'before'} );
ãã®åŸãMarionette.Viewããããã«æ¡åŒµããŸããã€ãŸããJavaScriptããžãã¯ãè¿œå ã§ããè¿œå ã®æ¡åŒµæ©èœãäœæããŸãã ããšãã°ããã¿ã³ãæŒã-çç£ã衚瀺ãããã¿ã³ãæŒã-ãã¹ãã衚瀺ãããã¿ã³ãæŒã-å·®åã衚瀺ããŸãã ãã®åŸãAllure APIãåŒã³åºããŠããã¹ãçµæã«ãããã¯ãçŽæ¥è¿œå ããŸãã ãã®çµæãã¡ã€ã³ããŒãžã«çŽæ¥è¡šç€ºãããŸãã
ãã€ãã£ã圢åŒ
話ããã2çªç®ã®æ¡åŒµæ©èœã¯ããã®åœ¢åŒã®ãµããŒãã§ãã ãã¬ãŒã ã¯ãŒã¯ã«å¿ èŠãªãã¹ãŠã®æ å ±ïŒãã¹ãã®èµ·åããã¹ãŠã®æ©èœãã¢ã¯ã·ã§ã³ãªã©ïŒãããããšããããŸãã ãŸããã¢ããã¿ãŒã®äžéšãæ¥ç¶ããããªãå Žåããå¿ èŠãªã¢ããã¿ãŒãååšããªãå Žåãªã©ã§ãã ãã®å Žåãçµæãæ¢ã«ããå Žåã¯ãã¬ããŒããäœæãããšãã«ããããåã«èªã¿åã£ãŠãããããAllureã®çµæã«å€æã§ããŸãã ã€ãŸããååãšããŠãã¢ããã¿ãŒãæ¥ç¶ãã段éãééã§ããŸãã ããã¯ãããšãã°ããã§ã«æšæºã®åœ¢åŒãèªã¿åãå Žåã«åœ¹ç«ã¡ãŸãã ããã§ãTeamCityã¯mstãtestngãªã©ã®åœ¢åŒããµããŒãããŠããŸãã ãã°ãããããšãAllureã¯ããã©ã«ãã§ãããã®åœ¢åŒããµããŒãããŸãã ã¢ããã¿ãæ¥ç¶ããã«ã¬ããŒããçæã§ããŸãã ãã®ã¬ããŒãã¯æå°éã«æããããŸãããHTTPã§åäœãã¹ããŸãã¯çµ±åãã¹ããäœæãããŠãŒã¶ãŒã«ã¯ãå¿ èŠãªãã¹ãŠã®æ å ±ããããŸãã
ãã®æ¡åŒµæ©èœã¯ã©ã®ããã«èŠããŸããïŒ
ãã®æ¡åŒµæ©èœã«ã¯JavaScriptã¯ãããŸãããããã¯çŽç²ã«Javaã®ããžãã¯ã§ããçµæãèªã¿åãå¿ èŠããããŸãããã®åŸãããããAllureã«å€æããŸãã Javaã®éšåã«èå³ããããŸãã
ç¬èªã®åœ¢åŒããµããŒãããããã«ãReaderãšããã€ã³ã¿ãŒãã§ã€ã¹ããããŸãã
interface Reader extends Extension { void readResults( Configuration configuration, ResultsVisitor visitor, Path resultsDirectory); //your code here }
æ§æã¯åœŒã®å ¥åã«æž¡ããïŒããã§ã¯ãã¢ãªã¥ãŒã«ã«é¢ããé£åå šäœãèŠã€ããããšãã§ããŸãïŒãå ¥åãžã®ããžã¿ãŒãç²åŸããŸãã ã¢ãªã¥ãŒã«ã¬ããŒãã«æ°ãããã¹ããè¿œå ã§ããŸãã æåŸã®1ã€ã¯ãåæãããã£ã¬ã¯ããªã§ãã
æ°ããæ¡åŒµæ©èœãäœæãããšãïŒ
class CustomReader implements Reader { void readResults(config, visitor, results){ listFiles(directory).stream() .map(this::readFileToCustomResult) .map(this::convertToAllureTestResult) .forEach(visitor::visitTestResult); } }
ãŸãããã®ãã£ã¬ã¯ããªãããã¹ãŠã®ãã¡ã€ã«ãèªã¿åããŸãã 次ã«ãããããã¹ãŠã®ãã¡ã€ã«ãäœããã®ãªããžã§ã¯ãã«é 眮ããŸãã ãã®åŸãããŒã¿æ§é ãAllure Resultsã«å€æããVisitorã«è¿œå ããŸãã ååãšããŠãè€éãªããšã¯ãããŸããããã©ãŒããããAllure Resultsã«å€æããã ãã§ãã
ãããã®æ¡åŒµæ©èœã䜿çšãããšããã¬ãŒã ã¯ãŒã¯ããµããŒãã§ããŸãã ããšãã°ããªã¹ããŒãããªãå Žåã
ã«ã¹ã¿ã ããªãŒ
ãåç¥ã®ããã«ãã¢ãªã¥ãŒã«ã«ã¯ããã¹ãã±ãŒã¹ïŒã€ãŸããããã±ãŒãžã衚瀺ãããç¹å®ã®ãã¹ãã±ãŒã¹ïŒããšã«æåã®åé¡ããããæ©èœã¹ããŒãªãŒããšã«2çªç®ã®åé¡ïŒæåã«ããã¹ãŠã®ãã¹ããæ©èœããšã«ã°ã«ãŒãåããã次ã«ãã¹ãŠãã¹ãã¯ã¹ããŒãªãŒããšã«ã°ã«ãŒãåãããŠããŸãïŒã
ä»»æã®ããªãŒãäœæããã«ã¯ã2ã€ã®ãã€ã³ããå®è¡ããå¿ èŠããããŸãã
- ããŒã¿æ§é èªäœãçæããŸã çµã¿ç«ãŠãããããªãŒã«é¢ããæ
å ±ãæã€JSONã
- ãã®ããªãŒãã¢ãªã¥ãŒã«ã¬ããŒãã«åã蟌ã¿ãŸãã Webã€ã³ã¿ãŒãã§ãŒã¹ã§äœããã®å®è£
ãè¡ããŸãã
ãœãªã¥ãŒã·ã§ã³ã®æ§é ãé çªã«åæããŸãããã
JavaããŒãããå§ããŸãããã ãã¹ãã®ã«ããŽãªã«é¢ããæ å ±ãåéããã«ã¯ãã¢ãã¹ãã©ã¯ããŸãã¯ã¢ã°ãªã²ãŒã¿ãŒãæ¡åŒµããå¿ èŠããããŸãã 圌ã¯ããã¡ã€ã«ã®ååãå®è£ ããå¿ èŠããããŸãããã¡ã€ã«ã®ååã«ã¯ãã«ããŽãªã«é¢ããæ å ±ãšã«ããŽãªã®ãªã¹ãããããŸãã ã€ãŸããæåã«ã³ã³ããŒãã³ãã«é¢ããæ å ±ãåéãããã®åŸãã¢ãžã¥ãã§ãã
class CustomTab extends AbstractTreeAggregator { @Override protected String getFileName() { return "custom.json"; } protected List<TreeGroup> getGroups() { return Arrays.asList({ allByLabel(result, "component") allByLabel(result, "module") }) } }
ãã®æ å ±ã¯ãã¢ãªã¥ãŒã«ã¬ããŒãèªäœã«ãã§ã«è¡šç€ºãããŠããã¯ãã§ãã
var components = allure.components; allure.api.addTab('custom', { title: 'Custom', icon: 'fa fa-list' route: 'custom/(:/testcaseId)' onEnter: (function(){ var routeParams=⊠return new components.TreeLayout({ routeParams: routeParams, tabName: 'Custom', baseUrl: 'custom' url: 'data/custom.json' }) })});
ãããè¡ãã«ã¯ãAllure APIããã«ããcustomãšããã¿ããè¿œå ããŸãã ã¿ã€ãã«ãã¢ã€ã³ã³ãå ¥åããããã«ã«ãŒãã£ã³ã°ããŸãïŒã€ãŸããã«ã¹ã¿ã IDã«éä¿¡ããããã¹ãŠã®ãªã¯ãšã¹ãã¯ãã®ã¿ãã«éä¿¡ãããŸãïŒã
æšæºã®Allureã³ã³ããŒãã³ãã䜿çšããŠãæ°ããããªãŒãæç»ããŸãã ä»»æã®æ å ±ãç¹ã«æ°ããã°ã©ããŸãã¯ãŠã£ãžã§ãããè¿œå ã§ããŸãã ãã®ããã«ãèªå® ã§äœ¿çšã§ããã³ã³ããŒãã³ãã®ã©ã€ãã©ãªããããŸãã
Allureãèµ·åããŠæ¡åŒµæ©èœãæ¥ç¶ãããšãã«ã¹ã¿ã ã¿ãã衚瀺ãããèšå®ã«å¿ããã°ã«ãŒãåãå®è£ ãããŸãã
ãã®ãœãªã¥ãŒã·ã§ã³ã¯ãããšãã°éå»ããäœããã®çš®é¡ã®ãã¹ãæ§é ãæ¢ã«æã£ãŠããäŒæ¥ã«é©ããŠããŸãïŒããšãã°ãæ©èœã¹ããŒãªãŒããŸã 䜿çšããŠããªãããŸãã¯äœ¿çšããããªã©ïŒã
æ¡åŒµæ©èœã®é åž
çŸåšããã®ãããªæ¡åŒµæ©èœã®é åžã¯ãŸã æºåãã§ããŠããŸããã æ°ããæ¡åŒµæ©èœãéžæãããããAllureïŒæ¡åŒµåžå ŽïŒã«ããŒãããã¡ã«ããºã ã¯ãããŸããã ããã«ãããããããç§ãã¡ã¯ããã«åãçµãã§ããããã°ããããŠäžé£ã®æ¡åŒµæ©èœããããããããæè»ã«Allureã«ããŒãã§ããããã«ãªãããšãé¡ã£ãŠããŸãã ã€ãŸããæ§æã§ãã®æ¡åŒµæ©èœãšãã®æ¡åŒµæ©èœãå¿ èŠã§ããããšãçŽæ¥æå®ã§ããŸãã ã¢ãªã¥ãŒã«ã§å¯èœãªéãå€ãã®æ°ããæ©èœãèŠããã§ãã
æ¡åŒµã·ã¹ãã
ã»ãšãã©ãã¹ãŠã®æ¡åŒµæ©èœã1ã€ã®ã¹ã©ã€ãã«åããããšããŸããã å®éã«ã¯ãããããŸãã«ãã¯ãŒã«ã§ããããšã¯æããã§ããå¯èœæ§ã瀺ãããã£ãã®ã§ãå€ãã®ã³ãŒããã¹ãããããŸããã å®éãJavaãJavaScriptãBackboneãªã©ã§ããã°ã©ãã³ã°ã§ããçµéšè±å¯ãªãŠãŒã¶ãŒã®ã¿ãæ¡åŒµæ©èœãäœæã§ããŸãã ç§ã®æèŠã§ã¯ãèŠããã»ã©ç°¡åã§ã¯ãããŸããã ããããããªãã¯è©Šãããšãã§ããŸãã ã³ãã¥ããã£å šäœã«åœ¹ç«ã€æ¡åŒµæ©èœãäœæããæ¹æ³ã«ã€ããŠã¢ã€ãã¢ãããå Žåã¯ããé£çµ¡ãããã ãããããã®æ¡åŒµæ©èœããèªèº«ã§äœæããŠãã ããã ã©ã®ãããªæ å ±ãã¬ããŒãã«è¿œå ã§ãããã«ã€ããŠã®ã¢ã€ãã¢ããªããžããªã«éä¿¡ããŠãã ããã
移è¡æ¹æ³
æ°ããAllureã«ç§»è¡ããæ¹æ³ãšã移è¡ãšã¯äœã§ããã
ã¢ãªã¥ãŒã«ã«ã¯å®å šãªäžäœäºææ§ããããŸãã ããã§ãããŒãžã§ã³2.1.0ãããŠã³ããŒãããŠèªåèªèº«ã«é 眮ããçŸåšã®ããŒã¿ã«åºã¥ããŠã¬ããŒããäœæã§ããŸãã ã¢ãªã¥ãŒã«ã¬ããŒãèªäœã®ããŒãžã§ã³ä»¥å€ã¯äœãå€æŽããå¿ èŠã¯ãããŸããã
ããšãã°ã次ã®ããã«Jenkinsã«å¯ŸããŠãããå®è¡ã§ããŸãã
ã¢ãªã¥ãŒã«1.5.4ã®åã«æã£ãŠããã ããªãã¯ãããMaven CentralããéãåºããŸããã æ°ããããŒã«-ã¢ãªã¥ãŒã«2.1.0ãè¿œå ããURLãæå®ããŸãïŒæ®å¿µãªãããä»ã§ã¯ãã®ãããªé·ãURLããããŸã-ãžã§ã³ãã³ã¹ã«æ¢ã«ãªã¯ãšã¹ããéä¿¡ããŠãããè¿ãå°æ¥ã«ã€ã³ã¹ããŒã«ããå¿ èŠããããŸãããã®åŸãããããããŠã³ã¡ãã¥ãŒãã以åã®ããã«äœ¿çšã§ããŸãïŒã
æ°ããURLãè¿œå ããåŸããžã§ãã®äžéšãæ§æããŸããããã§ã1.5.4ãã2.1.0ã«åãæ¿ããæ©äŒãããããã¹ãŠãæ©èœããŸãã
åæã«ãåèµ·åãã¬ããŒãã®çµåãå±¥æŽããã¹ãã±ãŒã¹ã«æ°ãããããã¯ãè¿œå ããæ©èœãªã©ãäžèšã®ããããããã«å ¥æã§ããŸãã
ãªãã¢ããã¿ãŒãæŽæ°ããã®ã§ããïŒ
å¯èœãªéããã¹ãããæ å ±ãåéããããšããŸãã ããšãã°ãææ°ããŒãžã§ã³ã§ã¯ãããããçš®é¡ã®æšæºãœãªã¥ãŒã·ã§ã³ãšããç·å¯ã«çµ±åãå§ããŠããŸãã æåã«è¡ãããšã¯ãhttpãµã³ãã«ãhttpã¯ã©ã€ã¢ã³ããã¬ãããã£ãããªã©ã®ã«ã¹ã¿ã æ·»ä»ãã¡ã€ã«ã§ãã ãããã®ãã¯ãããžãŒã®ããããã䜿çšããå Žåãåã«ã¢ãªã¥ãŒã¢ã¬ãããã£ãããèªåã«æ¥ç¶ããã ãã§ãã¢ãªã¥ãŒã«ã®ãã°ããªã¯ãšã¹ããããã³åçãå«ã詳现ãªã¹ã¯ãªãããããã«åŸãããŸãã
æ¢è£œã®ãã¬ãŒã ã¯ãŒã¯ãšã®ãããªãçµ±åãå®è¡ãããããã®åšãã®ãã€ã³ãã£ã³ã°ãè¡ããŸãã
ã¢ãªã¥ãŒã«ã䜿çšããŠãããææ°ã®éçºç¶æ³ã«é ããªãããã«ããã«ã¯ãã³ãã¥ããã£ã«åå ããŠãã ããã
æåã«ã§ããããšã¯ãGithubã§ãã©ããŒããããšã§ãã Allureã«ã¯ãã¹ãŠã®ãªããžããªãšçµ±åããããŸãã èå³ã®ããçµ±åã賌èªããŠãã ããã ãããŠãããªãã¯ããã§èµ·ãã£ãŠããããšã«æ°ã¥ãã§ãããã
äœããã®ç·æ¥ã®åé¡ãããå Žåãäœãèµ·ãã£ãŠããã®ãããããªãå Žåã¯ãGitterïŒ here and hereãã芧ãã ãã ã ããã¯ãªã³ã©ã€ã³ãã£ããã§ãã åžžã«ãªã¢ã«ã¿ã€ã ã§ãã¹ãŠã®è³ªåã«çããŸãã ããã«è§£æ±ºã§ããªãåé¡ãçºçããè¿ éãªè§£æ±ºçãå¿ èŠãªå Žåã¯ãããã«åŒç€ŸãŸã§ãé£çµ¡ãã ãããè¿ éã«å¯Ÿå¿ãã解決ã«åœ¹ç«ãŠãŸãã
Twitterã§ãã©ããŒããŠãã ããïŒeroshenkoamïŒIïŒããã³@QametaSoftwareïŒTwitterãAllureã®æ°ããããŒãžã§ã³ãã¢ããã¿ãŒãªã©ã«ã€ããŠæçš¿ããŸãïŒã
ãã¢ãã¯ãªãã¯ãããå Žåã¯ã ãªã³ã¯ãäœæããŸããã ãããã¯ãªãã¯ãããšãã¢ãªã¥ãŒã«ã®æ°æ©èœãèŠã€ããããšãã§ããŸãã
Artem Eroshenkoã¯ãã¢ã¹ã¯ã¯ã§éå¬ãããHeisenbag 2017 Moscowåãã®èå³æ·±ãæ°ããã¬ããŒããæºåããŠããŸãã ããã°ã©ã ã¯ãŸã 圢æãããŠããŸãããããã€ãã®éèŠãªå ±åã¯ãã§ã«ç¥ãããŠããŸãã ã€ãã³ãã®è©³çŽ°æ å ±ãšåå æ¡ä»¶ã¯äŒè°ã®ãŠã§ããµã€ãã§å©çšå¯èœã§ãã