Meteor 1.3 Testing (beta)

Meteor 1.3 Testing (beta)

2016.3.6 の Meteor 勉強会の発表資料です。

10a5592707295ff192c41cbd35f36627?s=128

Nobutaka OSHIRO

March 06, 2016
Tweet

Transcript

  1. Meteor 1.3 Tes,ng 3/6 Meteor ษڧձ in ΪʔΫΦϑΟεܙൺण େ৓ ৴޹

    (OSHIRO, Nobutaka)
  2. Who? • גࣜձࣾJ-hack CTO݉ϓϩάϥϚʔ • MeteorΞϓϦاըɾ։ൃɾӡ༻ɾอक • Meteorྺ 10ϲ݄ •

    Twi5er: @notanota • GitHub: @nobutakaoshiro • Qiita: @n-oshiro
  3. My Recent Ac*vity • 2016 • 1/23: Meteorษڧձൃද • 1/30:

    Meteor iOSΞϓϦ։ൃϋϯζ Φϯओ࠵ • 3/6: Meteorษڧձൃද <- ͍·͜͜
  4. Meteor 1.3 Tes,ng

  5. ຊ೔ͷൃද಺༰͸ Meteor 1.3-beta.12 Λجʹ͍ͯ͠·͢ɻ Metoer 1.3 ਖ਼ࣜϦϦʔε࣌ʹ͸࢓༷͕มΘΔՄೳੑ͕͋Γ·͢ɻ

  6. ΞδΣϯμ • ςετͱ͸ • ςετछྨʹ͍ͭͯ • Tes%ng in Meteor 1.3ɹ

    • Full app tes%ng & Module tes%ngɹ • DEMOɹ
  7. ςετͱ͸ ιϑτ΢ΣΞςετʢso#ware testʣ͸ɺίϯϐϡʔλͷϓϩά ϥϜΛ࣮ߦ͠ɺਖ਼͘͠ಈ࡞͢Δ͔ɺ໨ඪͱͨ͠඼࣭ʹ౸ୡ͍ͯ͠ Δ͔ɺҙਤ͠ͳ͍ಈ࡞Λ͠ͳ͍͔Ͳ͏͔Λ֬ೝ͢Δ࡞ۀͷ͜ͱͰ ͋Δɻ — ιϑτ΢ΣΞςετ - Wikipedia

  8. ςετΛॻ͘͜ͱͰ... • ߴ඼࣭ͳ(όάͷগͳ͍)ঢ়ଶΛҡ࣋Ͱ͖Δ • ίʔυͷमਖ਼͕༰қʹͳΔ • ࣗ৴Λ࣋ͬͯίʔυͷϦϑΝΫλϦϯά͕Ͱ͖Δ • όάͷൃݟʹͭͳ͕Δ •

    ظ଴͞ΕΔಈ࡞ΛυΩϡϝϯτԽͰ͖Δ
  9. ςετछྨ(1/2) • ୯ମςετ (Unit test) • ͋ΔϞδϡʔϧ͕ਖ਼͘͠ಈ࡞͢Δ͔Λ͔֬ΊΔ • ݁߹ςετ(Integra.on test)

    • ෳ਺Ϟδϡʔϧ͕ڠௐͯ͠ਖ਼͘͠ಈ͘͜ͱΛ͔֬ΊΔ • ड͚ೖΕςετɺe2eςετ(Acceptance or end-to-end test) • ΞϓϦશମͷಈ࡞Λϒϥ΢βϨϕϧͰݕূ͢Δ
  10. ςετछྨ(2/2) • ෛՙςετ (Load test, Stress test) • ෛՙΛ͔͚ΔͱͲ͏ͳΔͷ͔ɺͲ͜·Ͱ଱͑ΒΕΔͷ͔Λ֬ ೝ͢Δ

    • ܧଓతΠϯςάϨʔγϣϯςετ (Con0nuous Integra0on test) • ఆظతɺίϛοτ୯ҐͰςετΛ࣮ߦ͢Δ͜ͱͰෆ۩߹Λૣ ظൃݟ͠ɺΤϥʔ͕ແ͍ঢ়ଶΛอͭ
  11. Tes$ng in Meteor 1.3

  12. Tes$ng in Meteor 1.3 (1/3) • meteor create ࣌ʹ package.json

    ͱ tests.js ͕ࣗಈੜ੒͞Ε ΔΑ͏ʹͳͬͨ • Meteor 1.3 Ͱ͸σϑΥϧτͰ mocha ͱ Chai ͕࢖༻Մೳ • prac7calmeteor:mocha package ͷ௥Ճ • prac7calmeteor:chai package ΋Ұॹʹಋೖ͞ΕΔ
  13. Tes$ng in Meteor 1.3 (2/3) // tests.js import assert from

    "assert"; import { name as appName } from "./app.js"; describe("app", () => { it("should export its name", () => { assert.strictEqual(appName, "app"); }); });
  14. Tes$ng in Meteor 1.3 (3/3) • Meteor 1.3 ͷ Module

    ػೳͰςετ͕؆୯͔ͭಡΈ΍͘͢ॻ͚ Δ • ৽͍͠ meteor test ίϚϯυͷ௥Ճ • Meteor 1.3 ͔Β tests/ σΟϨΫτϦ֎ʹஔ͍ͯ͋Δ *.app- test[s].*, *.tests.* ͷϑΝΠϧ΋ࣗಈతʹಡΈࠐ·Εͳ ͍Α͏ʹͳͬͨ
  15. Full app tes*ng & Module tes*ng

  16. # Full app testing (integration test) meteor test --full-app --driver-package

    <driver-package> # Module testing (Unit test) meteor test --driver-package <driver-package>
  17. DEMO

  18. # Install Meteor curl https://install.meteor.com/ | sh # Create Meteor

    app meteor create app --release 1.3-beta.12 cd app # Install node_modules npm install # Run meteor app meteor # Run meteor test meteor test --driver-package practicalmeteor:mocha --port 3100 ./ meteor test --full-app --driver-package practicalmeteor:mocha --port 3100 ./
  19. Conclusion • Meteor 1.3 ͔Β mocha ͱ chai ͕σϑΥϧτͰར༻Մೳʹ •

    Module ػೳͰςετ͕ॻ͖΍͘͢ͳͬͨ • Meteor 1.3 ͷϕʔλ൛ͷͨΊɺࠓޙ࢓༷͕มߋ͞ΕΔ͔΋͠Ε ͳ͍ͷͰࠓޙͷಈ޲ʹ஫໨
  20. References • Meteor Guide v1.3 Migra2on (Dra6) h9p:/ /guide.meteor.com/v1.3/1.3-migra2on.html •

    Meteor Guide tes2ng.md (Dra6) h9ps:/ /github.com/meteor/guide/blob/tes2ng-modules-content/ content/tes2ng.md • GitHub - meteor/todos h9ps:/ /github.com/meteor/todos
  21. ࠂ஌

  22. ʦ࿕ใʧ͜͏΍ͬͯReactΛMeteor1.3Ͱ࢖͏ΜͩϋϯζΦϯʂ h"p:/ /meteor-tokyo.connpass.com/event/27388/ 3/26(౔) 13:00-17:30 ։࠵༧ఆ

  23. Q&A

  24. THANK YOU!