ã¿ãªããããã«ã¡ã¯ïŒ
ç§ã¯BadooãµãŒããŒããŒã ã®ããã¯ãšã³ãéçºè ã§ãã æšå¹Žã®HighLoadäŒè°ã§ããã¬ãŒã³ããŒã·ã§ã³ãäœæããŸãã ããããããã¹ãããŒãžã§ã³ã§å ±æããŸãã ãã®æçš¿ã¯ãè€éãªããžãã¹ããžãã¯ããã¹ãããã人ã ãã§ãªãããââãã¯ãšã³ãã®ãã¹ããèªåã§æžããŠã¬ã¬ã·ãŒã³ãŒãã®ãã¹ãã§åé¡ãçµéšãã人ã«ãšã£ãŠæãæçšã§ãã
äœã«ã€ããŠè©±ããŸããïŒ æåã«ãéçºããã»ã¹ãšãããããã¹ãã®å¿ èŠæ§ãšãããã®ãã¹ããäœæããããšãã欲æ±ã«ã©ã®ããã«åœ±é¿ãããã«ã€ããŠç°¡åã«èª¬æããŸãã 次ã«ããã¹ãã®èªååãã©ãããã®äžéšããäžéšã«ç§»åããŠã䜿çšãããã¹ãã®çš®é¡ã«ã€ããŠè°è«ããåãã¹ãã®å éšã®ããŒã«ãšãããã®å©ããåããŠè§£æ±ºããåé¡ã«ã€ããŠèª¬æããŸãã æåŸã«ãããããã¹ãŠãä¿å®ããã³å®è¡ããæ¹æ³ãæ€èšããŠãã ããã
éçºããã»ã¹
éçºããã»ã¹ã瀺ããŸããã
ãŽã«ãã¡ãŒã¯ããã¯ãšã³ãéçºè ã§ãã ããæç¹ã§ãéåžžã¯2ã€ã®ããã¥ã¡ã³ãã®åœ¢åŒã§éçºã¿ã¹ã¯ã圌ã«æž¡ãããŸããããžãã¹ãµã€ãããã®èŠä»¶ãšãããã¯ãšã³ããšã¯ã©ã€ã¢ã³ãïŒã¢ãã€ã«ã¢ããªã±ãŒã·ã§ã³ãšãµã€ãïŒéã®çžäºäœçšã®ãããã³ã«ã®å€æŽã説æããæè¡ããã¥ã¡ã³ãã§ãã
éçºè ã¯ã³ãŒããèšè¿°ããŠããã¹ãŠã®ã¯ã©ã€ã¢ã³ãã¢ããªã±ãŒã·ã§ã³ãããæ©ãåäœããããã«ããŸãã ãã¹ãŠã®æ©èœã¯ãããã€ãã®æ©èœãã©ã°ãŸãã¯A / Bãã¹ãã«ãã£ãŠä¿è·ãããŠããŸããããã¯æè¡ææžã§èŠå®ãããŠããŸãã ãã®åŸãçŸåšã®åªå é äœãšè£œåããŒããããã«åŸã£ãŠãã¯ã©ã€ã¢ã³ãã¢ããªã±ãŒã·ã§ã³ããªãªãŒã¹ãããŸãã ããã¯ãšã³ãéçºè ã®ç§ãã¡ã«ãšã£ãŠãç¹å®ã®æ©èœãã¯ã©ã€ã¢ã³ãã«å®è£ ãããããšã¯ãŸã£ããäºæž¬ã§ããŸããã ã¯ã©ã€ã¢ã³ãã¢ããªã±ãŒã·ã§ã³ã®ãªãªãŒã¹ãµã€ã¯ã«ã¯ããè€éã§é·ãããã補åãããŒãžã£ãŒã¯æåéãåªå é äœã調æŽããŠããŸãã
äŒç€Ÿãæ¡çšããŠããéçºæåã¯éåžžã«éèŠã§ããããã¯ãšã³ãã®éçºè ã¯ãããã¯ãšã³ãã§ã®å®è£ ã®ç¬éããããã®æ©èœãæåã«å®è£ ããäºå®ã ã£ãæåŸã®ãã©ãããã©ãŒã ã§ã®æåŸã®çµ±åãŸã§ã®æ©èœãæ åœããŸãã
ãã®ç¶æ³ã¯éåžžã«èµ·ããããŸãã6ãæåã«ããã€ãã®æ©èœãå±éããã¯ã©ã€ã¢ã³ãããŒã ã¯ãããé·æéå®è£ ããŸããã§ãããäŒç€Ÿã®åªå é äœãå€æŽãããããã§ãã圌ãã¯èšãïŒãããªãã6ã¶æåã«æŽãæµãããã®ããšãèŠããŠããŸããïŒ åœŒå¥³ã¯åããŸãããã ãããŠãæ°ããã¿ã¹ã¯ã«åŸäºãã代ããã«ãç«ãæ¶ããŸãã
ãã®ãããéçºè ã¯PHPããã°ã©ããŒã«ãšã£ãŠã¯çããåæ©ãæã£ãŠããŸã-çµ±åãã§ãŒãºã§åé¡ãã§ããã ãå°ãªããªãããã«ããŸãã
æ©èœãæ©èœããããšã確èªããããã«ãæåã«äœããããã§ããïŒ
ãã¡ãããæåã«é ã«æµ®ãã¶ã®ã¯ãæåãã¹ããå®æœããããšã§ãã ã¢ããªã±ãŒã·ã§ã³ãååŸããŸãããæ¹æ³ã¯ããããŸããããã®æ©èœã¯æ°ããããã顧客ã¯6ãæã§åŠçããŸãã ãŸããæåãã¹ãã§ã¯ãããã¯ãšã³ãã®ãªãªãŒã¹ããçµ±åã®éå§ãŸã§ã«çµéããæéã«ã€ããŠã¯ãã¯ã©ã€ã¢ã³ãã«åœ±é¿ãäžããªããšããä¿èšŒã¯ãããŸããã
ãããŠãããã§èªåãã¹ãã圹ç«ã¡ãŸãã
åäœãã¹ã
æãç°¡åãªãã¹ãã¯åäœãã¹ãã§ãã ããã¯ãšã³ãã®ã¡ã€ã³èšèªãšããŠPHPã䜿çšãããŠããããã¹ãã®ãã¬ãŒã ã¯ãŒã¯ãšããŠPHPUnitã䜿çšããŸãã ä»åŸã¯ããã¹ãŠã®ããã¯ãšã³ããã¹ãããã®ãã¬ãŒã ã¯ãŒã¯ã«åºã¥ããŠèšè¿°ãããŠãããšèšããŸãã
åäœãã¹ãã§ã¯ãå€ç«ããå°ããªã³ãŒããããã€ãã«ããŒããã¡ãœãããé¢æ°ã®ããã©ãŒãã³ã¹ããã§ãã¯ããããšããããããŸããã€ãŸããããžãã¹ããžãã¯ã®å°ããªåäœã«ã€ããŠè©±ããŠããŸãã åäœãã¹ãã¯ãããŒã¿ããŒã¹ããµãŒãã¹ã«ã¢ã¯ã»ã¹ãããã®ãšçžäºäœçšããŠã¯ãªããŸããã
ãœããã¢ãã¯
éçºè ãåäœãã¹ããäœæãããšãã«çŽé¢ããäž»ãªåé¡ã¯ããã¹ãã§ããªãã³ãŒãã§ãããéåžžããã¯ã¬ã¬ã·ãŒã³ãŒãã§ãã
ç°¡åãªäŸã Badooã¯12æ³ã§ããã€ãŠã¯éåžžã«å°ããªã¹ã¿ãŒãã¢ããã§ããããäœäººãã®äººã ã«ãã£ãŠéçºãããŸããã ã¹ã¿ãŒãã¢ããã¯ããã¹ããªãã§ãŸã£ããæåããŸããã ãã®åŸãååã«å€§ãããªãããã¹ããªãã§ã¯çããŠãããªãããšã«æ°ä»ããŸããã ãããããã®é ã«ã¯ãæ©èœããå€ãã®ã³ãŒããæžãããŠããŸããã ãã¹ãã®ããã ãã«æžãçŽããªãã§ãã ããïŒ ããã¯ããžãã¹ã®èŠ³ç¹ããã¯ããŸãåççã§ã¯ãããŸããã
ãã®ããããã¹ããäœæããããã»ã¹ãããå®ããããéãããå°ããªãªãŒãã³ãœãŒã¹ã©ã€ãã©ãªSoftMocksãéçºããŸããã ãã¹ãŠã®ã€ã³ã¯ã«ãŒã/å¿ èŠãªPHPãã¡ã€ã«ãã€ã³ã¿ãŒã»ãããããªã³ã¶ãã©ã€ã§ãœãŒã¹ãã¡ã€ã«ãå€æŽãããã³ã³ãã³ããã€ãŸãæžãæããããã³ãŒãã«çœ®ãæããŸãã ããã«ãããä»»æã®ã³ãŒãã®ã¹ã¿ããäœæã§ããŸãã ã©ã€ãã©ãªã®æ©èœã®è©³çŽ°ã瀺ããŸãã
éçºè åãã®ãã®ãããªãã®ïŒ
//mock \Badoo\SoftMocks::redefineConstant($constantName, $newValue); //mock : , , \Badoo\SoftMocks::redefineMethod( $class, $method, $method_args, $fake_code ); //mock \Badoo\SoftMocks::redefineFunction( $function, $function_args, $fake_code );
ãã®ãããªåçŽãªæ§é ã®å©ããåããŠãå¿ èŠãªãã®ããã¹ãŠã°ããŒãã«ã«åå®çŸ©ã§ããŸãã ç¹ã«ãæšæºã®PHPUnitã¡ãŒã«ãŒã®å¶éãåé¿ã§ããŸãã ã€ãŸããéçã¡ãœãããšãã©ã€ããŒãã¡ãœãããã¢ãã¯ããå®æ°ãåå®çŸ©ããããã«å€ãã®ããšãè¡ãããšãã§ããŸããããã¯éåžžã®PHPUnitã§ã¯äžå¯èœã§ãã
ããããåé¡ãçºçããŸãããSoftMocksã䜿çšãããšããã¹ãå¯èœãªã³ãŒããäœæããå¿ èŠããªãããã§ããã°ããŒãã«ã¢ãã¯ã䜿çšããŠã³ãŒãããã€ã§ããã³ãŒã ãã§ãããã¹ãŠæ£åžžã«åäœããŸãã ãããããã®ã¢ãããŒãã¯ãããè€éãªã³ãŒããšãã¯ã©ã³ããã®èç©ã«ã€ãªãããŸãã ãã®ãããç¶æ³ã管çã§ããããã«ããããã€ãã®ã«ãŒã«ãæ¡çšããŸããã
- æ°ããã³ãŒãã¯ãã¹ãŠãæšæºã®PHPUnitã¢ãã¯ã§ç°¡åã«ãã¹ãããå¿
èŠããããŸãã ãã®æ¡ä»¶ãæºãããããšãã³ãŒãã¯ãã¹ãå¯èœã«ãªããå°ããªããŒã¹ãç°¡åã«éžæããŠãã¹ãããããšãã§ããŸãã
- SoftMocksã¯ãåäœãã¹ãã«é©ããªãæ¹æ³ã§èšè¿°ãããå€ãã³ãŒãã§äœ¿çšã§ããŸãããŸããä»ã®æ¹æ³ã§ã¯ã³ã¹ããé«ããã/é·ããã/é£ããïŒå¿
èŠæ§ã匷調ããïŒå Žåã«ã䜿çšã§ããŸãã
ãããã®ã«ãŒã«ãžã®æºæ ã¯ãã³ãŒãã¬ãã¥ãŒæ®µéã§æ éã«ç£èŠãããŸãã
çªç¶å€ç°è©Šéš
ãããšã¯å¥ã«ãåäœãã¹ãã®å質ã«ã€ããŠèšããããšæããŸãã å€ãã®äººãã³ãŒãã«ãã¬ããžãªã©ã®ã¡ããªãã¯ã䜿çšããŠãããšæããŸãã ããããæ®å¿µãªããã圌女ã¯1ã€ã®è³ªåã«çããŠããŸããããè¯ããŠããããã¹ããæžããããšããããŸããïŒã å®éã«ã¯äœããã§ãã¯ãããåäžã®ã¢ãµãŒããå«ãŸãªããã¹ããäœæããå¯èœæ§ããããŸãããåªããã³ãŒãã«ãã¬ããžãçæããŸãã ãã¡ãããäŸã¯èªåŒµãããŠããŸãããç¶æ³ã¯çŸå®ããããã»ã©é ããããŸããã
æè¿ãçªç¶å€ç°è©Šéšãå°å ¥ãå§ããŸããã ããã¯ããªãå€ãã§ãããããŸãããç¥ãããŠããªãæŠå¿µã§ãã ãã®ãããªãã¹ãã®ã¢ã«ãŽãªãºã ã¯éåžžã«ç°¡åã§ãã
- ã³ãŒããšã³ãŒãã«ãã¬ããžãååŸããŸãã
- parsimãå®è¡ããã³ãŒãã®å€æŽãéå§ããŸããtrueããfalseã> to> =ã+ to-ïŒäžè¬çã«ãããããç¹ã§å®³ããããŸãïŒ;
- ãã®ãããªå€æŽã®å€æŽããšã«ãå€æŽãããæååãã«ããŒãããã¹ãã¹ã€ãŒããå®è¡ããŸãã
- ãã¹ãã倱æããå Žåããã¹ãã¯è¯å¥œã§ãããå®éã«ã³ãŒããå£ãããšã¯ã§ããŸããã
- ãã¹ãã«åæ Œããå Žåãã»ãšãã©ã®å Žåãã«ãã¬ããžã«ããããããååã«å¹æçã§ã¯ãªããããããã€ãã®ã¢ãµãŒããè¡ãããã«ïŒãŸãã¯ãã¹ãã§ã«ããŒãããŠããªãé åãããïŒããããããã詳ãã調ã¹ã䟡å€ããããããããŸããã
HumbugãInfectionãªã©ãPHPçšã®æ¢è£œã®ãã¬ãŒã ã¯ãŒã¯ãããã€ããããŸãã æ®å¿µãªããããããã¯SoftMocksãšäºææ§ããªããããç§ãã¡ã«ã¯åããŠããŸããã§ããã ãããã£ãŠãåãããšãå®è¡ããç¬èªã®å°ããªã³ã³ãœãŒã«ãŠãŒãã£ãªãã£ãäœæããŸããããå éšã³ãŒãã«ãã¬ããžåœ¢åŒã䜿çšããSoftMocksãšã¯å奜çã§ãã çŸåšãéçºè ã¯ãããæåã§éå§ãã圌ãæžãããã¹ããåæããŸãããéçºããã»ã¹ã«ããŒã«ãå°å ¥ããããšã«åãçµãã§ããŸãã
çµ±åãã¹ã
çµ±åãã¹ãã®å©ããåããŠãããŸããŸãªãµãŒãã¹ãããŒã¿ããŒã¹ãšã®çžäºäœçšã確èªããŸãã
ã¹ããŒãªãŒãããã«ç解ããããã«ãæ¶ç©ºã®ããã¢ãŒã·ã§ã³ãäœæãããã¹ãã§ã«ããŒããŸãããã ãããã¯ããããŒãžã£ãŒãäŒè°ãã±ãããæãç±å¿ãªãŠãŒã¶ãŒã«é åžããããšã決å®ãããšæ³åããŠãã ããã
次ã®å Žåã«ããã¢ã衚瀺ããå¿ èŠããããŸãã
- ãWorkããã£ãŒã«ãã®ãŠãŒã¶ãŒã¯ãprogrammerãã瀺ããŸãã
- ãŠãŒã¶ãŒã¯A / Bãã¹ãHL18_promoã«åå ãã
- ãŠãŒã¶ãŒã¯2幎以äžåã«ç»é²ãããŠããŸãã
ããã±ãããååŸããã¿ã³ãã¯ãªãã¯ããŠããã±ãããé åžãããããŒãžã£ãŒã«è»¢éããããã«ããã®ãŠãŒã¶ãŒã®ããŒã¿ããªã¹ãã«ä¿åããå¿ èŠããããŸãã
ãã®ããªãåçŽãªäŸã§ããåäœãã¹ãã䜿çšããŠæ€èšŒã§ããªãããšããããŸã-ããŒã¿ããŒã¹ãšã®çžäºäœçšã ãããè¡ãã«ã¯ãçµ±åãã¹ãã䜿çšããå¿ èŠããããŸãã
PHPUnitãæäŸããããŒã¿ããŒã¹ã®çžäºäœçšããã¹ãããæšæºçãªæ¹æ³ãæ€èšããŠãã ããã
- ãã¹ãããŒã¿ããŒã¹ãäžããŸãã
- DataTablesãšDataSetsãæºåããŸãã
- ãã¹ããå®è¡ããŸãã
- ãã¹ãããŒã¿ããŒã¹ãã¯ãªã¢ããŸãã
ãã®ãããªã¢ãããŒãã§åŸ ã€ã®ã«ã©ããªå°é£ããããŸããïŒ
- DataTablesããã³DataSetsã®æ§é ããµããŒãããå¿
èŠããããŸãã ããŒãã«ã®ã¬ã€ã¢ãŠããå€æŽããå Žåããããã®å€æŽããã¹ãã«åæ ããå¿
èŠããããŸãããããã¯å¿
ããã䟿å©ã§ã¯ãªããè¿œå ã®æéãå¿
èŠã§ãã
- ããŒã¿ããŒã¹ã®æºåã«ã¯æéãããããŸãã ãã¹ããèšå®ãããã³ã«ãããã«äœããã¢ããããŒãããäœããã®çš®é¡ã®ããŒãã«ãäœæããå¿
èŠããããŸãããã¹ããå€ãå Žåãããã¯é·ããŠé¢åã§ãã
- ãããŠãæãéèŠãªæ¬ ç¹ïŒãã®ãããªãã¹ãã䞊è¡ããŠå®è¡ãããšããã¹ããäžå®å®ã«ãªããŸãã ãã¹ãAãéå§ãã圌ãäœæãããã¹ãããŒãã«ãžã®æžã蟌ã¿ãéå§ããŸããã åæã«ããã¹ãBãèµ·åããŸããããã¹ãBã¯ãåããã¹ãããŒãã«ã§åäœããããšãæãã§ããŸãã ãã®çµæãçžäºã®åŠšå®³ããã®ä»ã®äºæããªãç¶æ³ãçºçããŸãã
ãããã®åé¡ãåé¿ããããã«ãå°ããªDBMocksã©ã€ãã©ãªãéçºããŸããã
DBMocks
åäœåçã¯æ¬¡ã®ãšããã§ãã
- SoftMocksã䜿çšããŠãããŒã¿ããŒã¹ãæäœãããã¹ãŠã®ã©ãããŒãã€ã³ã¿ãŒã»ããããŸãã
- ãã€
ã¯ãšãªã¯ã¢ãã¯ãééããSQLã¯ãšãªã解æããŠDB + TableNameããã«ããæ¥ç¶ãããã¹ããååŸããŸãã
- tmpfsã®åããã¹ãã§ãå
ã®ããŒãã«ãšåãæ§é ã®äžæããŒãã«ãäœæããŸãïŒSHOW CREATE TABLEã䜿çšããŠæ§é ãã³ããŒããŸãïŒã
- ãã®åŸãã¢ãã¯ãä»ããŠãã®ããŒãã«ã«éä¿¡ããããã¹ãŠã®ãªã¯ãšã¹ãããæ°ããäœæãããäžæçãªãªã¯ãšã¹ãã«ãªãã€ã¬ã¯ãããŸãã
ããã«ããäœãåŸãããŸããïŒ
- æ§é ãåžžã«ç®¡çããå¿
èŠã¯ãããŸããã
- ãã¹ãã¯ããœãŒã¹ããŒãã«ã®ããŒã¿ããã®å Žã§äžæããŒãã«ã«ãªãã€ã¬ã¯ããããããç Žæããããšã¯ãããŸããã
- äœæ¥äžã®MySQLã®ããŒãžã§ã³ãšã®äºææ§ããã¹ãããŠããŸããããªã¯ãšã¹ããçªç¶æ°ããããŒãžã§ã³ãšã®äºææ§ã倱ã£ãå Žåããã¹ãã¯ããã確èªããŠã¯ã©ãã·ã¥ããŸãã
- ãããŠæãéèŠãªããšã¯ããã¹ããåé¢ããããã¹ãã䞊è¡ããŠå®è¡ããŠãããã¹ãããŒãã«ã®ååã«åãã¹ãã«åºæã®ããŒãè¿œå ãããããã¹ããªãŒã ãç°ãªãäžæããŒãã«ã«åæ£ãããããšã§ãã
APIãã¹ã
ãŠããããã¹ããšAPIãã¹ãã®éãã¯ããã®GIFã§ãã瀺ãããŠããŸãã
ããã¯ã¯æ£åžžã«æ©èœããŸãããééã£ããã¢ã«åãä»ããããŠããŸãã
ãã¹ãã¯ã¯ã©ã€ã¢ã³ãã»ãã·ã§ã³ãã·ãã¥ã¬ãŒããããããã³ã«ã«åŸã£ãŠãªã¯ãšã¹ããããã¯ãšã³ãã«éä¿¡ã§ããããã¯ãšã³ãã¯å®éã®ã¯ã©ã€ã¢ã³ããšããŠãªã¯ãšã¹ãã«å¿çããŸãã
ãŠãŒã¶ãŒããŒã«ããã¹ããã
ãã®ãããªãã¹ããæ£åžžã«äœæããã«ã¯äœãå¿ èŠã§ããïŒ ããã¢ãŒã·ã§ã³ã®ã·ã§ãŒã®æ¡ä»¶ã«æ»ããŸãããã
- ãWorkããã£ãŒã«ãã®ãŠãŒã¶ãŒã¯ãprogrammerãã瀺ããŸãã
- ãŠãŒã¶ãŒã¯A / Bãã¹ãHL18_promoã«åå ãã
- ãŠãŒã¶ãŒã¯2幎以äžåã«ç»é²ãããŠããŸãã
ã©ããããããã§ã¯ãã¹ãŠããŠãŒã¶ãŒã«é¢ãããã®ã§ãã ãããŠå®éã«ã¯ãAPIãã¹ãã®99ïŒ ã«ã¯ããã¹ãŠã®ãµãŒãã¹ãšããŒã¿ããŒã¹ã«ååšããèš±å¯ãããç»é²ãŠãŒã¶ãŒãå¿ èŠã§ãã
ã©ãã§å ¥æã§ããŸããïŒ ãã¹ãæã«ç»é²ãè©Šã¿ãããšãã§ããŸããã次ã®ããšãã§ããŸãã
- ããã¯é·ãããªãœãŒã¹ãæ¶è²»ããŸãã
- ãã¹ããå®äºããåŸããã®ãŠãŒã¶ãŒãäœããã®æ¹æ³ã§åé€ããå¿
èŠããããŸããããã¯ã倧èŠæš¡ãªãããžã§ã¯ãã«ã€ããŠè©±ããŠããå Žåã«ã¯ããªãéèŠãªäœæ¥ã§ãã
- æåŸã«ãä»ã®å€ãã®è² è·ã®é«ããããžã§ã¯ããšåæ§ã«ãããã¯ã°ã©ãŠã³ãã§å€ãã®æäœãå®è¡ããŸãïŒããŸããŸãªãµãŒãã¹ãžã®ãŠãŒã¶ãŒã®è¿œå ãä»ã®ããŒã¿ã»ã³ã¿ãŒãžã®ã¬ããªã±ãŒã·ã§ã³ãªã©ïŒã ãã¹ãã¯ãã®ãããªããã»ã¹ã«ã€ããŠäœãç¥ããŸããããå®è¡ã®çµæã«æé»çã«äŸåããŠããå Žåãäžå®å®ã«ãªããªã¹ã¯ããããŸãã
Test Users PoolãšããããŒã«ãéçºããŸããã 次ã®2ã€ã®ã¢ã€ãã¢ã«åºã¥ããŠããŸãã
- æ¯åãŠãŒã¶ãŒãç»é²ããããã§ã¯ãããŸããããäœåºŠã䜿çšããŠããŸãã
- ãã¹ãåŸããŠãŒã¶ãŒããŒã¿ãå
ã®ç¶æ
ïŒç»é²æïŒã«ãªã»ããããŸãã ãããè¡ããªããšããŠãŒã¶ãŒã¯ä»ã®ãã¹ãããã®æ
å ±ã§ãæ±æããããããããã¹ãã¯æéãšãšãã«äžå®å®ã«ãªããŸãã
次ã®ããã«æ©èœããŸãã
ããæç¹ã§ãå®çšŒåç°å¢ã§APIãã¹ããå®è¡ããããšèããŸããã ãªããããå¿ èŠãªã®ã§ããããïŒ éçºã€ã³ãã©ã¹ãã©ã¯ãã£ã¯æ¬çªãšåãã§ã¯ãªãããã§ãã
çç£ã€ã³ãã©ã¹ãã©ã¯ãã£ãåžžã«çž®å°ãµã€ãºã§ç¹°ãè¿ãããšãè©Šã¿ãŠããŸãããdevelãå®å šãªã³ããŒã«ãªãããšã¯ãããŸããã æ°ãããã«ããæåŸ ã©ããã§åé¡ããªãããšã確å®ã«ç¢ºèªããããã«ãæ°ããã³ãŒããå®çšŒåããŒã¿ãšãµãŒãã¹ã§åäœããå®çšŒååã¯ã©ã¹ã¿ãŒã«ã¢ããããŒãããããã§APIãã¹ããå®è¡ããŸãã
ãã®å Žåããã¹ããŠãŒã¶ãŒãå®éã®ãŠãŒã¶ãŒããåé¢ããæ¹æ³ãèããããšãéåžžã«éèŠã§ãã
ãã¹ããŠãŒã¶ãŒãã¢ããªã±ãŒã·ã§ã³ã§å®éã«è¡šç€ºãããããã«ãªã£ããã©ããªããŸããã
åé¢ããæ¹æ³ã¯ïŒ åãŠãŒã¶ãŒã«ã¯
is_test_user
ãã©ã°ããããŸãã ç»é²æ®µéã§ã
yes
ãŸãã¯
no
ã«ãªããå€æŽãããªããªããŸãã ãã®ãã©ã°ã«ããââããã¹ãŠã®ãµãŒãã¹ã§ãŠãŒã¶ãŒãåé¢ããŸãã ãŸããçµ±èšãæªããªãããã«ããã¹ããŠãŒã¶ãŒãããžãã¹åæããã³A / Bãã¹ãã®çµæããé€å€ããããšãéèŠã§ãã
ããç°¡åãªæ¹æ³ã§é²ãããšãã§ããŸãããã¹ãŠã®ãã¹ããŠãŒã¶ãŒãå極ã«ã移転ããããšããäºå®ããå§ããŸããã ãžãªãµãŒãã¹ãããå Žåãããã¯å®å šã«æ©èœããæ¹æ³ã§ãã
QA API
ãŠãŒã¶ãŒã ãã§ãªããç¹å®ã®ãã©ã¡ãŒã¿ãŒãå¿ èŠã§ããããã°ã©ããŒãšããŠåããç¹å®ã®A / Bãã¹ãã«åå ãã2幎以äžåã«ç»é²ãããŸããã ãã¹ããŠãŒã¶ãŒã®å Žåãããã¯ãšã³ãAPIã䜿çšããŠè·æ¥ãç°¡åã«å²ãåœãŠãããšãã§ããŸãããA / Bãã¹ãã«å ¥ãããšã¯ç¢ºççã§ãã ãŸãããŠãŒã¶ãŒãããŒã«ã«ãã€ç»å Žãããããããªãããã2幎以äžåã®ç»é²æ¡ä»¶ãäžè¬ã«æºããããšã¯å°é£ã§ãã
ãããã®åé¡ã解決ããããã«ãQA APIããããŸãã å®éãããã¯ãã¹ãã®è£å£ã§ããããŠãŒã¶ãŒããŒã¿ããã°ããç°¡åã«ç®¡çããã¯ã©ã€ã¢ã³ããšã®éä¿¡ã®ã¡ã€ã³ãããã³ã«ããã€ãã¹ããŠç¶æ ãå€æŽã§ãããååã«ææžåãããAPIã¡ãœããã§ãã ãããã®ã¡ãœããã¯ãQAãšã³ãžãã¢ããã³UIããã³APIãã¹ãã§äœ¿çšããããã«ãããã¯ãšã³ãéçºè ã«ãã£ãŠäœæãããŠããŸãã
QA APIã¯ããã¹ããŠãŒã¶ãŒã®å Žåã«ã®ã¿é©çšã§ããŸãã察å¿ãããã©ã°ããªãå Žåããã¹ãã¯ããã«å€±æããŸãã ãŠãŒã¶ãŒç»é²æ¥ãä»»æã®æ¥ä»ã«å€æŽã§ããQA APIã¡ãœããã®1ã€ã次ã«ç€ºããŸãã
ãããã£ãŠããã¹ããŠãŒã¶ãŒã®ããŒã¿ããã°ããå€æŽããŠãããã¢ãŒã·ã§ã³ã®è¡šç€ºæ¡ä»¶ãæºãããããã«ãã3ã€ã®åŒã³åºãã®ããã«ãªããŸãã
- ãäœæ¥ããã£ãŒã«ãã«ã¯ããããã°ã©ããŒãã衚瀺ãããŸãã
addUserWorkEducation?user_id=ID&works[]=Badoo,
- ãŠãŒã¶ãŒã¯A / Bãã¹ãHL18_promoã«åå ããŸãã
forceSplitTest?user_id=ID&test=HL18_promo
- 2幎以äžåã«ç»é²ïŒ
userCreatedChange?user_id=ID&created=2016-09-01
ããã¯ããã¯ãã¢ã§ãããããã»ãã¥ãªãã£ã«ã€ããŠèããããšãäžå¯æ¬ ã§ãã ããã€ãã®æ¹æ³ã§ãµãŒãã¹ãä¿è·ããŸããã
- ãããã¯ãŒã¯ã¬ãã«ã§åé¢ïŒãµãŒãã¹ã¯ãªãã£ã¹ãããã¯ãŒã¯ããã®ã¿ã¢ã¯ã»ã¹ã§ããŸãã
- ãªã¯ãšã¹ãããšã«ã·ãŒã¯ã¬ãããæž¡ããŸããã·ãŒã¯ã¬ãããªãã§ã¯ããªãã£ã¹ãããã¯ãŒã¯ããã§ãQA APIã«ã¢ã¯ã»ã¹ã§ããŸããã
- ã¡ãœããã¯ãã¹ããŠãŒã¶ãŒã§ã®ã¿æ©èœããŸãã
ãªã¢ãŒãã¢ãã¯
APIãã¹ãã®ãªã¢ãŒãããã¯ãšã³ãã䜿çšããã«ã¯ãã¢ãã¯ãå¿ èŠã«ãªãå ŽåããããŸãã äœã®ããã«ïŒ ããšãã°ãå®çšŒåç°å¢ã§ã®APIãã¹ããããŒã¿ããŒã¹ãžã®ã¢ã¯ã»ã¹ãéå§ããå Žåããã®ããŒã¿ããã¹ãããŒã¿ããæ¶å»ãããããšã確èªããå¿ èŠããããŸãã ããã«ãã¢ãã¯ã¯ãã¹ãå¿çããã¹ãã«ããé©ãããã®ã«ããã®ã«åœ¹ç«ã¡ãŸãã
3ã€ã®ããã¹ãããããŸãã
Badooã¯å€èšèªã¢ããªã±ãŒã·ã§ã³ã§ããè€éãªããŒã«ã©ã€ãºã³ã³ããŒãã³ããããããŠãŒã¶ãŒã®çŸåšå°ã®ç¿»èš³ããã°ãã翻蚳ããã³åä¿¡ã§ããŸãã ããŒã«ã©ã€ã¶ãŒã¯ã翻蚳ã®æ¹åãããŒã¯ã³ã䜿çšããA / Bãã¹ãã®å®æœãããæåãã補å€ã®æ¢çŽ¢ã«åžžã«åãçµãã§ããŸãã ãããŠããã¹ããè¡ããšããµãŒããŒããè¿ãããããã¹ããç¥ãããšãã§ããŸãã-ãã€ã§ãå€æŽã§ããŸãã ãã ããRemoteMocksã䜿çšããŠãããŒã«ãªãŒãŒã·ã§ã³ã³ã³ããŒãã³ãã«æ£ããã¢ã¯ã»ã¹ã§ãããã©ããã確èªã§ããŸãã
RemoteMocksã¯ã©ã®ããã«æ©èœããŸããïŒ ãã¹ãã§ã¯ãããã¯ãšã³ãã«ã»ãââã·ã§ã³çšã«åæåããããèŠæ±ããåŸç¶ã®ãã¹ãŠã®ãªã¯ãšã¹ããåä¿¡ãããšãããã¯ãšã³ãã¯çŸåšã®ã»ãã·ã§ã³ã®ã¢ãã¯ããã§ãã¯ããŸãã ååšããå ŽåãSoftMocksã䜿çšããŠåçŽã«åæåããŸãã
ãªã¢ãŒãã¢ãã¯ãäœæããå Žåã¯ãã©ã®ã¯ã©ã¹ãŸãã¯ã¡ãœãããäœã«çœ®ãæããå¿ èŠããããã瀺ããŸãã ãã®ã¢ãã¯ãèæ ®ããŠãåŸç¶ã®ãã¹ãŠã®ããã¯ãšã³ããªã¯ãšã¹ããå®è¡ãããŸãã
$this->remoteInterceptMethod( \Promo\HighLoadConference::class, 'saveUserEmailToDb', true );
ããã§ã¯ãAPIãã¹ããåéããŸãããã
// $app_startup = [ 'supported_promo_blocks' => [\Mobile\Proto\Enum\PromoBlockType::GENERIC_PROMO] ]; $Client = $this->getLoginedConnection(BmaFunctionalConfig::USER_TYPE_NEW, $app_startup); // $Client->getQaApiClient()->addUserWorkEducation(['Badoo, ']); $Client->getQaApiClient()->forceSplitTest('HL18_promo'); $Client->getQaApiClient()->userCreatedChange('2016-09-01'); // $this->remoteInterceptMethod(\Promo\HighLoadConference::class, 'saveUserEmail', true); //, , $Resp = $Client->ServerGetPromoBlocks([]); $this->assertTrue($Resp->hasMessageType('CLIENT_NEXT_PROMO_BLOCKS')); $PromoBlock = $Resp->CLIENT_NEXT_PROMO_BLOCKS; ⊠// CTA, , , $Resp = $Client->ServerPromoAccepted($PromoBlock->getPromoId()); $this->assertTrue($Resp->hasMessageType('CLIENT_ACKNOWLEDGE_COMMAND'));
ãã®ããã«ç°¡åãªæ¹æ³ã§ãããã¯ãšã³ãã§éçºãããã¢ãã€ã«ãããã³ã«ã®å€æŽãå¿ èŠãªæ©èœããã¹ãã§ããŸãã
APIãã¹ãã®äœ¿çšèŠå
ãã¹ãŠãããŸãããããã«èŠããŸãããåã³åé¡ãçºçããŸããïŒAPIãã¹ãã¯éçºã«ã¯ããŸãã«ã䟿å©ã§ããããšãå€æããã©ãã§ããããã䜿çšããèªæããããŸããã ãã®çµæãæå³ããŠããªãAPIãã¹ãã®å©ããåããŠåé¡ã解決ãå§ããŠããããšãããã£ãã
ãªããããæªãã®ã§ããïŒ APIãã¹ãã¯éåžžã«é ãããã§ãã 圌ãã¯ãããã¯ãŒã¯ã«è¡ããããã¯ãšã³ãã«åãããŸããããã¯ãšã³ãã¯ã»ãã·ã§ã³ãååŸããããŒã¿ããŒã¹ãšäžé£ã®ãµãŒãã¹ã«è¡ããŸãã ãã®ãããAPIãã¹ãã䜿çšããããã®äžé£ã®ã«ãŒã«ãéçºããŸããã
- APIãã¹ãã®ç®çã¯ãã¯ã©ã€ã¢ã³ããšãµãŒããŒéã®çžäºäœçšã®ãããã³ã«ãšãæ°ããã³ãŒãã®æ£ããçµ±åã確èªããããšã§ãã
- ã¢ã¯ã·ã§ã³ã®é£éãªã©ãè€éãªããã»ã¹ããããã§ã«ããŒããããšã¯èš±å¯ãããŠããŸãã
- ãããã䜿çšããŠãµãŒããŒå¿çã®ããããªå€åæ§ããã¹ãããããšã¯ã§ããŸãããããã¯åäœãã¹ãã®ã¿ã¹ã¯ã§ãã
- ã³ãŒãã®ã¬ãã¥ãŒäžã«ããã¹ããå«ããŠç¢ºèªããŸãã
UIãã¹ã
èªååã®ãã©ããããæ€èšããŠãããããUIãã¹ãã«ã€ããŠå°ã説æããŸãã
Badooã®ããã¯ãšã³ãéçºè ã¯UIãã¹ããäœæããŸããããã®ãããQAéšéã«å°ä»»ã®ããŒã ããããŸãã ãã§ã«é ã«æµ®ãã³ãå®å®ããŠããæ©èœãUIãã¹ãã§ã«ããŒããŸããæ©èœã®ããªãé«äŸ¡ãªèªååã«ãªãœãŒã¹ãè²»ããã®ã¯äžåçã§ãããšèããŠãããããããããA / Bãã¹ããè¶ ããªãã§ãããã
ã¢ãã€ã«ã®èªåãã¹ãã«ã¯Calabashã䜿çšããWebã«ã¯Seleniumã䜿çšããŸãã èªååããã³ãã¹ããã©ãããã©ãŒã ã«ã€ããŠèª¬æããŸãã
è©Šé転
çŸåšã100,000åã®ãŠããããã¹ãã6,000åã®çµ±åãã¹ãã14,000åã®APIãã¹ãããããŸãã ãããã1ã€ã®ã¹ã¬ããã§å®è¡ããããšãããšãæã匷åãªãã·ã³ã§ãããã¹ãŠã®å®è¡ã«æéãããããŸãïŒã¢ãžã¥ã©ãŒ-40åãçµ±å-90åãAPIãã¹ã-10æéã é·ãããŸãã
䞊åå
ãã®èšäºã§ã¯ãåäœãã¹ãã®äžŠååã®çµéšã«ã€ããŠèª¬æããŸãã ã
æåã®è§£æ±ºçã¯æãããªããã§ããããã¹ããè€æ°ã®ã¹ã¬ããã§å®è¡ããããšã§ãã ããããç§ãã¡ã¯ããã«é²ãã§ãããŒããŠã§ã¢ãªãœãŒã¹ãæ¡åŒµã§ããããã«ããããã«ã䞊åèµ·åçšã®ã¯ã©ãŠããäœæããŸããã ç°¡ç¥åãããšã圌ã®äœåã¯æ¬¡ã®ããã«ãªããŸãã
ããã§æãèå³æ·±ãã¿ã¹ã¯ã¯ãã¹ã¬ããéã§ã®ãã¹ãã®åæ£ãã€ãŸãããããã®ãã£ã³ã¯ãžã®åå²ã§ãã
ããããåçã«åå²ã§ããŸããããã¹ãŠã®ãã¹ããç°ãªããããã¹ã¬ããã®å®è¡æéã«å€§ããªåããããå¯èœæ§ããããŸãããã¹ãŠã®ã¹ã¬ããã¯ãã§ã«å°éããŠãããéåžžã«é ããã¹ãã§ã幞éãã ã£ãããã1ã€ã¯30åãã³ã°ããŸãã
è€æ°ã®ã¹ã¬ãããéå§ããŠãäžåºŠã«1ã€ãã€ãã¹ãããã£ãŒãã§ããŸãã ãã®å Žåããã¡ãªããã¯ããã»ã©æçœã§ã¯ãããŸãããç°å¢ãåæåããããã®ãªãŒããŒãããã³ã¹ãããããå€æ°ã®ãã¹ããšãã®ã¢ãããŒãã«ãããéèŠãªåœ¹å²ãæããããã«ãªããŸãã
ç§ãã¡ã¯äœãããŸãããïŒ åãã¹ãã®å®è¡ã«ãããæéã«é¢ããçµ±èšã®åéãéå§ããçµ±èšã«åŸã£ãŠã1ã€ã®ã¹ã¬ããã30ç§ä»¥å ã«å®è¡ãããããã«ãã£ã³ã¯ãæ§æãå§ããŸããã åæã«ããã¹ããå°ããããããã«ããã¹ããéåžžã«å¯ã«ãŸãšããŸãã
ãã ãããã®ã¢ãããŒãã«ã¯æ¬ ç¹ããããŸãã APIãã¹ãã«é¢é£ä»ããããŠããŸããéåžžã«é ããå€ãã®ãªãœãŒã¹ãæ¶è²»ãããããé«éãã¹ãã®å®è¡ã劚ããããŸãã
ãããã£ãŠãã¯ã©ãŠãã2ã€ã®éšåã«åå²ããŸãããæåã®éšåã§ã¯é«éãã¹ãã®ã¿ãèµ·åããã2çªç®ã®éšåã§ã¯é«éãšäœéã®äž¡æ¹ãèµ·åã§ããŸãã ãã®ã¢ãããŒãã§ã¯ãè¿ éãªãã¹ããåŠçã§ããã¯ã©ãŠãã®äžéšãåžžã«ãããŸãã
ãã®çµæãåäœãã¹ãã¯1åã§ãçµ±åãã¹ãã¯5åã§ãAPIãã¹ãã¯15åã§å®è¡ããå§ããŸããã ã€ãŸãã12æéã§ã¯ãªããã«å®è¡ã«22åããããããŸããã
ã³ãŒãã«ãã¬ããžãã¹ãã®å®è¡
巚倧ã§è€éãªã¢ããªã¹ããããè¯ãæ¹æ³ã§ã¯ãããå Žæã§ã®å€æŽãå¥ã®å Žæã§äœããå£ãå¯èœæ§ãããããããã¹ãŠã®ãã¹ããåžžã«å®è¡ããå¿ èŠããããŸãã ããã¯ãã¢ããªã·ãã¯ã¢ãŒããã¯ãã£ã®äž»ãªæ¬ ç¹ã®1ã€ã§ãã
ããæç¹ã§ãæ¯åãã¹ãŠã®ãã¹ããå®è¡ããå¿ èŠã¯ãªããšããçµè«ã«éããŸãããã³ãŒãã«ãã¬ããžã«åºã¥ããŠå®è¡ã§ããŸãã
- ãã©ã³ãã®å·®åãåãã
- å€æŽããããã¡ã€ã«ã®ãªã¹ããäœæããŸãã
- åãã¡ã€ã«ã«ã€ããŠããã¹ãã®ãªã¹ããååŸããŸãã
ãããã«ããŒããŸãã
- ãããã®ãã¹ãããã»ãããäœæãããã¹ãã¯ã©ãŠãã§å®è¡ããŸãã
ã«ãã¬ããžãååŸããå Žæ éçºç°å¢ã®ã€ã³ãã©ã¹ãã©ã¯ãã£ãã¢ã€ãã«ç¶æ ã®ãšãã«ã1æ¥ã«1åããŒã¿ãåéããŸãã å®è¡ããããã¹ãã®æ°ã¯èããæžå°ããå察ã«ããã¹ãããã®ãã£ãŒãããã¯ã®åä¿¡é床ã¯èããå¢å ããŸããã å©çïŒ
è¿œå ã®ããŒãã¹ã¯ããããã®ãã¹ããå®è¡ã§ããããšã§ããã Badooã¯é·ãéã¹ã¿ãŒãã¢ããã§ã¯ãããŸããã§ããããå®çšŒåç°å¢ã§ã®å€æŽã®è¿ éãªå®è£ ãããããã£ãã¯ã¹ã®è¿ éãªæå ¥ãæ©èœã®å±éãæ§æã®å€æŽãè¡ãããšãã§ããŸãã ååãšããŠãããããå±éããé床ã¯éåžžã«éèŠã§ãã æ°ããã¢ãããŒãã«ããããã¹ãããã®ãã£ãŒãããã¯é床ãå€§å¹ ã«åäžããŸãããããã¯ãå®å šãªå®è¡ãé·ãåŸ ã€å¿ èŠããªãããã§ãã
ããããæ¬ é¥ããªããã°ãã©ãã«ããããŸããã , , , . . , code coverage . , , â , - , . .
API-, code coverage. , , . - , API- .
ãããã«
- , . - , , - .
- â . code review , .
- , , . .
- . .
- , ! , .
, Badoo PHP Meetup 16 . PHP-. , . ! 12:00, â YouTube- .