JSTAPdã使ã£ã¦JavaScriptã®ã¯ãã¹ãã©ã¦ã¶ãã¹ããã¦ã¿ã(IEå«)
YAPCã«ã¦Yappoããã®ãAjax Application Testingããè´ãèå³ãããããã¾ããã
ä»åã¯ã¯ãã¹ãã©ã¦ã¶ã§ã®ãã¹ãèªååãå®ç¾ãããã£ãã®ã§ãã®è¾ºãã試ãã¦ã¿ã¾ããã
http://yappo.github.com/talks/20101016-yapcasia2010-jstapd/
ã¤ã³ã¹ãã¼ã«
cpanm JSTAPd
ãã¹ãç¨ãã¼ã¢ã³èµ·å
jstapd -d hoge
http://127.0.0.1:1978/____jstapd/ ã«ã¢ã¯ã»ã¹ãã¦
ãmake testããã¿ã³æ¼ãã¨ãã¹ãåãã¾ãï¼
è¶
ç°¡åï¼
ãã¹ããã©ãæ¸ãã
èªåã®å ´åã¯Ajaxã§ã¯ãªãçJSããã¹ããã¾ããã
ããããèªç±ã«æ¸ãã¾ãããåºæ¬çã«ã¯ä»¥ä¸ã®ããã«æ¸ãã°OKã
- ????.t ãã¡ã¤ã«ã«ãã¹ãæ°ã¨ãããã¹ããããJSãã¤ã³ã¯ã«ã¼ããããã¨ãæ¸ãã
- ????.js ãã¡ã¤ã«ã«ãã¹ãJSæ¸ãã
egã«ãµã³ãã«ããããããã®ã§
Ajaxã®ãã¹ããããã¨ãã¯ãã¡ããåèã«ããã®ãè¯ãã§ãããã
ãããã°ãã©ãããã
åºæ¬ãä½ãã¨ã©ã¼ããã£ã¦ã表示ä¸ãããã¾ããã
ãªã®ã§FireBugãªã©ã§æ®éã«JSãããã°ããæãã«ããã®ãããã§ãããã
ãã¹ãç¨ã®jsã¯ä»¥ä¸ã®ãããªURLã«ãªã£ã¦ãã¾ãã®ã§ããã«ãã¬ã¼ã¯ãã¤ã³ããä»è¾¼ãã ãã
http://127.0.0.1:1978/____jstapd/contents/(ãã¹ããã¡ã¤ã«å)?session=xxxxxxxxxxxxxxx
CLIãã¹ã
ã¾ãã¯ä»¥ä¸ã®ç°å¢å¤æ°ãè¨å®ãã¾ãã
export JSTAP_AUTO_OPEN_COMMAND='open -a Safari %s'
ã§ããã¨ã¯æ®éã«proveããã¨èªåã§ãã©ã¦ã¶ãç«ã¡ä¸ããCLIãããã¹ãåºæ¥ã¾ãã
prove hoge
ããã¼
èªåã§è¤æ°ãã©ã¦ã¶ãã¹ã(for Mac)
ä¸è¨ã®ãããªãã¨ãããã¹ã¯ãªããæ¸ãã°ããã§ããã
Macã ã¨ä»¥ä¸ã®ãããªæãã«ãªãã¾ãããã
use strict; my $dir=$ARGV[0]; my @browser = ( 'open -a Safari %s', 'open -a Firefox %s', 'open -a "Google Chrome" %s', ); for (@browser) { $ENV{JSTAP_AUTO_OPEN_COMMAND} = $_; system("prove $dir"); }
ã½ãã½ãè¤æ°ãã©ã¦ã¶ãç«ã¡ä¸ãã£ã¦èªåãã¹ããããã¾ããããããï½
èªåã§è¤æ°ãã©ã¦ã¶ãã¹ã(for Windows XP)
IEã§ããã¹ããããã§ãããï¼*1
ã¤ã¾ãWindowsä¸ã§ç°å¢æ§ç¯ããå¿
è¦ãããã¾ãã
ã¾ãActivePerlã ã¨JSTAPdãã¤ã³ã¹ãã¼ã«ããã®ã大å¤ãªã®ã§
Strawberry Perl ã§æ®éã«cpanmã¤ã³ã¹ãã¼ã«ãã¦ãã¾ãã¾ãããã
ãã¨èªåã®ãµã¼ãã¹ã ã¨è¦ä»¶çã«IE6,IE7,IE8ã§ã®ãã¹ããè¡ãå¿
è¦ãããã®ã§
ãããèªåã§ãã¹ããããã¨ããã§ãã
ä»å㯠IE Tester ã使ã£ã¦ã¿ã¾ã*2ã
IE Testerã¯ã©ãã«ã¤ã³ã¹ãã¼ã«ãã¦ãããã§ãã
ãã¹ã«ã¹ãã¼ã¹ãããå ´åã¯
ã³ãã³ãããã³ãã®ãdir -xãã³ãã³ãã§è¡¨ç¤ºãããç縮ãã£ã¬ã¯ããªãæå®ãã¾ãããã
èªåã®ç°å¢ã ã¨ä»¥ä¸ã®ãããªæãã«ãªãã¾ããã
use strict; my $dir=$ARGV[0]; my @browser = ( 'D:/PROGRA~1/CORESE~1/IETester/IETester.exe -ie6 %s', 'D:/PROGRA~1/CORESE~1/IETester/IETester.exe -ie7 %s', 'D:/PROGRA~1/CORESE~1/IETester/IETester.exe -ie8 %s', ); for (@browser) { $ENV{JSTAP_AUTO_OPEN_COMMAND} = $_; system("prove $dir"); }
ããã§ããããªï¼ã¨ããããã¨ããã§ããã
proveãä¸ã¤çµãããã³ã«ãã¦ã£ã³ãã¦ãéãã¾ããï¼ãã¨ãã¡ãã¡èããããã
Runtime error ãçºçãããããã®ã§CLIãã¹ãã¯ãã¾ãã¡...*3
IEã¯ã ã¾ã£ã¦ãã¼ã¢ã³ç«ã¡ä¸ãã¦ãã©ã¦ã¶ä¸ã§ãã¹ãããã®ãããããããã¾ãããã
ã¾ãä¸ã¤æ³¨æç¹ãããã¾ãã¦ã
IETesterã®å ´åã¯ãªãã·ã§ã³ã®ããã«ãããã»ã¹ã¢ã¼ãã§èµ·åãã¨ããã®ãç¡å¹ã«ããªãã¨
CLIã®ãã¹ãæã«å¤ãªããã»ã¹ãæ®ã£ã¦ãã¾ãã¾ãã®ã§OFFã«ãã¦ããã¾ããã