Slide 1

Slide 1 text

ʙ1)1FS͔ͩΒͦ͜஌͓͖͍ͬͯͨʙ +BWB4DSJQUͷςετΛ ෳ਺ϒϥ΢βͰࣗಈ࣮ߦ͢Δ࿩ 1)1$POGFSFODF,BOTBJ !TV[VLJ

Slide 2

Slide 2 text

4IPVMELOPXCFDBVTFZPVBSF1)1FS "VUPNBUJDBMMZSVOUIF+BWB4DSJQU UFTUJONVMUJQMFCSPXTFST 1)1$POGFSFODF,BOTBJ !TV[VLJ

Slide 3

Slide 3 text

"HFOEB w "CPVUNF w 5PEBZTUIFNF w 3FDFOU+BWB4DSJQU w ,BSNB w $PODMVTJPO

Slide 4

Slide 4 text

"CPVUNF w *MPWFTV[VLJBDDPVOU w IUUQTUXJUUFSDPNTV[VLJ w IUUQTHJUIVCDPNTV[VLJ w IUUQTLFZCBTFJPTV[VLJ w IUUQTV[VLJUEJBSZOFU

Slide 5

Slide 5 text

"CPVUNF w *SFDFJWFENFOUJPOTBCPVU46;6,*.0503 $03103"5*0/ FWFSZEBZ

Slide 6

Slide 6 text

1BTUQSFTFOUBUJPO IUUQTTQFBLFSEFDLDPNTV[VLJ

Slide 7

Slide 7 text

.Z1)1DPEFJT -(5.

Slide 8

Slide 8 text

.Z+BWB4DSJQU DPEFJTOPU-(5.

Slide 9

Slide 9 text

5PEBZTUIFNF

Slide 10

Slide 10 text

,BSNB IUUQLBSNBSVOOFSHJUIVCJP

Slide 11

Slide 11 text

8IFOVTF,BSNB w :PVXBOUUPUFTUDPEFJOSFBMCSPXTFST w :PVXBOUUPUFTUDPEFJONVMUJQMFCSPXTFST EFTLUPQ NPCJMF UBCMFUT FUD w :PVXBOUUPFYFDVUFZPVSUFTUTMPDBMMZEVSJOH EFWFMPQNFOU w :PVXBOUUPFYFDVUFZPVSUFTUTPOBDPOUJOVPVT JOUFHSBUJPOTFSWFS IUUQTHJUIVCDPNLBSNBSVOOFSLBSNB

Slide 12

Slide 12 text

8IFOVTF,BSNB w :PVXBOUUPFYFDVUFZPVSUFTUTPOFWFSZTBWF w :PVMPWFZPVSUFSNJOBM w :PVEPOUXBOUZPVS UFTUJOH MJGFUPTVDL w :PVXBOUUPVTF*TUBOCVMUPBVUPNBHJDBMMZHFOFSBUF DPWFSBHFSFQPSUT w :PVXBOUUPVTF3FRVJSF+4GPSZPVSTPVSDFpMFT IUUQTHJUIVCDPNLBSNBSVOOFSLBSNB

Slide 13

Slide 13 text

SFBMCSPXTFST IUUQTLBSNBSVOOFSHJUIVCJPDPOpHCSPXTFSTIUNM

Slide 14

Slide 14 text

#SPXTFSDPNQBUJCJMJUZ IUUQDBOJVTFDPNGFBUDIBOOFMNFTTBHJOH

Slide 15

Slide 15 text

,BSNBEFNP

Slide 16

Slide 16 text

3FDFOU +BWB4DSJQU

Slide 17

Slide 17 text

,FZXPSETPG3FDFOU+4 ,FZXPSE 1SPEVDUT 4FSWFS4JEF /PEFKTJPKT -BOHVBHF $P⒎FF4DSJQU5ZQF4DSJQU&$."4DSJQU 1BDLBHF OQN#PXFSDPNQPOFOU 5BTL3VOOFS (VMQ(SVOU 4UZMFTIFFU -&444BTT -JOU +4-JOU+4)JOU&4)JOU .PEVMF 3FRVJSF+4#SPXTFSJGZ8FC1BDL 'SBNFXPSL "OHVMBS+4#BDLCPOFKT3FBDU 5FTU'SBNFXPSL 26OJU.PDIB+BTNJOF #SPXTFS 1IBOUPN+4$BTQFS+4 5FTU3VOOFS ,BSNB

Slide 18

Slide 18 text

4FSWFS4JEF 1BDLBHF

Slide 19

Slide 19 text

/PEFKT IUUQTOPEFKTPSH

Slide 20

Slide 20 text

OQN IUUQTXXXOQNKTDPN

Slide 21

Slide 21 text

5BTL3VOOFS

Slide 22

Slide 22 text

(VMQ IUUQHVMQKTDPN

Slide 23

Slide 23 text

(SVOU IUUQHSVOUKTDPN

Slide 24

Slide 24 text

(SVOU1)16OJU IUUQFOHJOFFSJOHDSPDPTKQQPTUHSVOUXBUDIQIQVOJU

Slide 25

Slide 25 text

.PEVMF

Slide 26

Slide 26 text

3FRVJSF+4 IUUQSFRVJSFKTPSH

Slide 27

Slide 27 text

#SPXTFSJGZ IUUQCSPXTFSJGZPSH

Slide 28

Slide 28 text

XFCQBDL IUUQXFCQBDLHJUIVCJP

Slide 29

Slide 29 text

5SBEJUJPOBMTUZMF

Slide 30

Slide 30 text

3FRVJSF+4

Slide 31

Slide 31 text

3FRVJSF+4 // app.js require(['functions', 'library'], function(functions, library) { } );

Slide 32

Slide 32 text

#SPXTFSJGZXFCQBDL

Slide 33

Slide 33 text

#SPXTFSJGZXFCQBDL // app.js var functions = require('functions'); var library = require('library');

Slide 34

Slide 34 text

&$."4DSJQU // app.js import 'functions' as functions; import 'library' as library;

Slide 35

Slide 35 text

6OJU5FTU

Slide 36

Slide 36 text

5FTUBCMFDPEF

Slide 37

Slide 37 text

/PU5FTUBCMF Karma Samples function add(x, y) { return x + y; }

Karma Samples

Slide 38

Slide 38 text

&YUFSOBMJTHPPE Karma Samples

Karma Samples

Slide 39

Slide 39 text

.PSF5FTUBCMF w 6TF.PEVMFTZTUFN w 3FRVJSF+4 w #SPXTFSJGZ w XFCQBDL w &$."4DSJQU w #VU OPUGPDVTJUUPEBZ

Slide 40

Slide 40 text

+BTNJOF IUUQKBTNJOFHJUIVCJP

Slide 41

Slide 41 text

+BTNJOFJOTUBMM % npm install jasmine-core --save-dev

Slide 42

Slide 42 text

+BTNJOFCBTJD 5FTU3VOOFS )5.- GVODUJPOTKT GVODUJPOT4QFDKT TDSJQUTSDGVODUJPOTKTTDSJQU TDSJQUTSDGVODUJPOT4QFDKTTDSJQU

Slide 43

Slide 43 text

4QFD3VOOFSIUNM Jasmine Test Runner

Slide 44

Slide 44 text

GVODUJPOTKT // functions.js function add(x, y) { return x + y; }

Slide 45

Slide 45 text

GVODUJPOT4QFDKT // functionsSpec.js describe('add() tests', function() { it('1 + 2 equal 3', function() { expect(add(1, 2)).toBe(3); }); it('2 + 2 not equal 5', function() { expect(add(2, 2)).not.toBe(5); }); });

Slide 46

Slide 46 text

3VO

Slide 47

Slide 47 text

3VO 3VO 3VO

Slide 48

Slide 48 text

/PUSIZUINJD 8SJUF5FTU 8SJUF$PEF 3FMPBE#SPXTFSˡ#SFBLUIFSIZUIN 3FMPBE#SPXTFSˡ#SFBLUIFSIZUIN 3FMPBE#SPXTFSˡ#SFBLUIFSIZUIN 8SJUF5FTU 8SJUF$PEF 3FMPBE#SPXTFSˡ#SFBLUIFSIZUIN 3FMPBE#SPXTFSˡ#SFBLUIFSIZUIN 3FMPBE#SPXTFSˡ#SFBLUIFSIZUIN

Slide 49

Slide 49 text

,BSNB IUUQLBSNBSVOOFSHJUIVCJP

Slide 50

Slide 50 text

4UFQUPVTF,BSNB w *OTUBMM w 4UBSU,BSNB w 4UBSUUFTUTCZ,BSNB w 8BUDIDIBOHJOHpMFT w 8SJUFUFTUPSDPEF w %FUFDUDIBOHJOHBpMFCZ,BSNB w 4UBSUUFTUTCZ,BSNB

Slide 51

Slide 51 text

,BSNBJOTUBMM % npm install \ karma \ karma-chrome-launcher \ --save-dev

Slide 52

Slide 52 text

,BSNBJOJU % ./node_modules/karma/bin/karma init

Slide 53

Slide 53 text

,BSNBJOJU Which testing framework do you want to use ? Press tab to list possible options. Enter to move to the next question. > jasmine Do you want to use Require.js ? This will add Require.js plugin. Press tab to list possible options. Enter to move to the next question. > no Do you want to capture any browsers automatically ? Press tab to list possible options. Enter empty string to move to the next question. > Chrome >

Slide 54

Slide 54 text

,BSNBJOJU What is the location of your source and test files ? You can use glob patterns, eg. "js/*.js" or "test/**/*Spec.js". Enter empty string to move to the next question. > src/*.js > spec/*Spec.js > Should any of the files included by the previous patterns be excluded ? You can use glob patterns, eg. "**/*.swp". Enter empty string to move to the next question. > Do you want Karma to watch all the files and run the tests on change ? Press tab to list possible options. > yes Config file generated at "/Users/suzuki/work/karma-samples/ karma.conf.js".

Slide 55

Slide 55 text

,BSNBDPOpHpMF // karma.conf.js module.exports = function(config) { config.set({ basePath: '', frameworks: ['jasmine'], files: [ 'src/*.js', 'spec/*Spec.js' ], exclude: [], preprocessors: {}, reporters: ['progress'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false }); };

Slide 56

Slide 56 text

,BSNBTUBSU % ./node_modules/karma/bin/karma start

Slide 57

Slide 57 text

,BSNBTUBSU ᶃ4UBSU,BSNB

Slide 58

Slide 58 text

,BSNBTUBSU ᶄPQFO$ISPNFCZ,BSNB ᶅ&YFDVUFUFTUT ᶆ8BUDIpMFT

Slide 59

Slide 59 text

,BSNBBEECSPXTFST % npm install \
 karma-safari-launcher \
 karma-firefox-launcher \
 --save-dev

Slide 60

Slide 60 text

MBVODIFS ,BSNB DISPNFMBVODIFS TBGBSJMBVODIFS pSFGPYMBVODIFS

Slide 61

Slide 61 text

,BSNBBEECSPXTFST // karma.conf.js module.exports = function(config) { // [snip] browsers: ['Chrome'], // [snip] }); }; // karma.conf.js module.exports = function(config) { // [snip] browsers: ['Chrome', 'Safari', 'Firefox'], // [snip] }); }; .PEJGZDPOpH

Slide 62

Slide 62 text

,BSNBBEECSPXTFST

Slide 63

Slide 63 text

,BSNBBEECSPXTFST

Slide 64

Slide 64 text

TQFDJpDCSPXTFS % ./node_modules/karma/bin/karma start \
 --browsers 'Firefox'

Slide 65

Slide 65 text

VTFPO$*TFWFS

Slide 66

Slide 66 text

1IBOUPN+4 IUUQQIBOUPNKTPSH

Slide 67

Slide 67 text

,BSNBBEECSPXTFST % npm install \
 karma-phantomjs-launcher \
 --save-dev

Slide 68

Slide 68 text

LBSNBDPOGKT // karma.conf.js module.exports = function(config) { // [snip] browsers: [ 'Chrome', 'Safari', 'Firefox', 'PhantomJS' // added ], // [snip] }); };

Slide 69

Slide 69 text

PO$*TFSWFS % ./node_modules/karma/bin/karma start \
 --browsers 'PhantomJS'

Slide 70

Slide 70 text

*OUFSOFU&YQMPSFS

Slide 71

Slide 71 text

7JSUVBM#PY IUUQTXXXWJSUVBMCPYPSH

Slide 72

Slide 72 text

EFWNPEFSOJF IUUQEFWNPEFSOJF

Slide 73

Slide 73 text

NPEFSOJF PMETUZMF IUUQTXXXNPEFSOJFKBKQ

Slide 74

Slide 74 text

JFWNT IUUQYEJTTFOUHJUIVCJPJFWNT

Slide 75

Slide 75 text

4UFQUPVTF*& w *OTUBMM7JSUVBM#PY w &YFDVUFJFWNT w %PXOMPBE*&7JSUVBM.BDIJOFT w 4FUVQ7.UP7JSUVBM#PY

Slide 76

Slide 76 text

*OTUBMM7JSUVBM#PY w %PXOMPBEGSPN8FCTJUF w IUUQTXXXWJSUVBMCPYPSHXJLJ%PXOMPBET PS w 6TF)PNFCSFX$BTL % brew cask install virtualbox

Slide 77

Slide 77 text

6TFJFWNT w %PXOMPBE"MMWFSTJPOT % curl -s https://raw.githubusercontent.com/ xdissent/ievms/master/ievms.sh | bash w %PXOMPBE4QFDJpDWFSTJPOT % curl -s https://raw.githubusercontent.com/ xdissent/ievms/master/ievms.sh | env IEVMS_VERSIONS="7 9" bash

Slide 78

Slide 78 text

8"3/*/( %0/564&JFWNT)&3& #FDBVTF*&WJSUVBMNBDIJOFTWFSZWFSZMBSHF

Slide 79

Slide 79 text

%JTLTQBDFPG7.T % du -sh ~/.ievms 43G /Users/suzuki/.ievms

Slide 80

Slide 80 text

*&TJO7JSUVBM#PY

Slide 81

Slide 81 text

LBSNBJFWNT % npm install karma-ievms --save-dev

Slide 82

Slide 82 text

LBSNBDPOGKT // karma.conf.js // [snip] browsers: [ //'Chrome', //'Safari', //'Firefox', //'PhantomJS', 'IE7 - WinXP', // added 'IE8 - WinXP', // added 'IE9 - Win7', // added 'IE10 - Win7', // added 'IE11 - Win7' // added ], // [snip]

Slide 83

Slide 83 text

,BSNBXJUI*&T

Slide 84

Slide 84 text

)FBEMFTTNPEF

Slide 85

Slide 85 text

,BSNBFYUFOET

Slide 86

Slide 86 text

1SFQSPDFTTPST IUUQTXXXOQNKTDPNCSPXTFLFZXPSELBSNBQSFQSPDFTTPS

Slide 87

Slide 87 text

1MVHJOT IUUQTXXXOQNKTDPNCSPXTFLFZXPSELBSNBQMVHJO

Slide 88

Slide 88 text

.ZGVUVSFQMBO w .PCJMF w J04MBVODIFS w "OESPJEMBVODIFS w 3FNPUF#SPXTFST w 8FC%SJWFSMBVODIFS w #SPXTFS4UBDLMBVODIFS w .JDSPTPGU&EHF w

Slide 89

Slide 89 text

$PODMVTJPO

Slide 90

Slide 90 text

*N)BQQZXJUI,BSNB w *N)BQQZXJUI,BSNB w *FBTFEBTFOTFPGJOTFDVSJUZXJUISFBMCSPXTFSUFTU

Slide 91

Slide 91 text

:PVXJMMCF)BQQZ w -FUTVTFUIF,BSNBUPHFUIFS w *GZPVVTFUIF,BSNB 
 QMFBTFXSJUFBOBSUJDMFUPZPVSCMPH w *XBOUUPLOPXNPSFJOGPSNBUJPOBCPVU,BSNB

Slide 92

Slide 92 text

)FMQNF1)1FST ZPVSFNZPOMZIPQF

Slide 93

Slide 93 text

5IBOLZPV