SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
Daniel DavisDaniel Davis
@ourmaninjapan@ourmaninjapan
Testharness.jsTestharness.js の基礎の基礎
テストの悪い事例テストの悪い事例
やっぱりロボットがほしい!
testharness.jstestharness.js はは
あなたのあなたの
ロボットロボット
最終的に…最終的に…
信頼できる、統一性のあるブラウザがほしい。信頼できる、統一性のあるブラウザがほしい。
そのため…そのため…
信頼できる、統一性のあるテストが必要。信頼できる、統一性のあるテストが必要。
そのため、こういうテストが必要そのため、こういうテストが必要
良い良い WebWeb テストの必須項目テストの必須項目
•
   WebWeb プラットフォームのテストスイートプラットフォームのテストスイート
•
   testharness.jstestharness.js 等等
•
 対象メソッド、要素、属性等 対象メソッド、要素、属性等
•
 テストコード自体 テストコード自体
testharness.jstestharness.js のパッケージのパッケージ
•
   testharness.jstestharness.js 等を等を /resources/resources に入れるに入れる
•
 できればローカルサーバーで実行する できればローカルサーバーで実行する
•
   id=”log”id=”log” の要素を作るの要素を作る
•
 テストを書く テストを書く
testharness.jstestharness.js の使い方の使い方
•
 なるべくシンプルに なるべくシンプルに
•
   test()test() とと async_test()async_test() が使えるが使える
•
   assert_assert_ 何とか何とか == 「◯◯なのか」「◯◯なのか」
•
 各テストは条件とタイトルが必要 各テストは条件とタイトルが必要
•
 既存のテストをパクった方が楽 既存のテストをパクった方が楽
•
 テストを先に書きましょう テストを先に書きましょう
Demo timeDemo time
サンプルサンプル
<div<div id="id="loglog""></div>></div>
<div<div id="id="testEltestEl" class="" class="BobBob""></div>></div>
<script><script>
var testEl = document.getElementById('var testEl = document.getElementById('testEltestEl');');
test(function() {test(function() {
assert_equals(testEl.getAttribute('assert_equals(testEl.getAttribute('classclass'), ''), 'BobBob');');
}, '}, 'Can get class attribute with getAttribute()Can get class attribute with getAttribute()');');
</script></script>
テストの種類テストの種類
assert_trueassert_true
assert_falseassert_false
assert_equalsassert_equals
assert_not_equalsassert_not_equals
……
参考参考
•
/webstorage//webstorage/
•
/XMLHttpRequest//XMLHttpRequest/
/html/dom/elements/global-attributes//html/dom/elements/global-attributes/
おまけおまけ
おすすめの簡単なサーバー:おすすめの簡単なサーバー:
python -m SimpleHTTPServerpython -m SimpleHTTPServer
リンク集リンク集
hoppipolla.co.uk/talks/ttwf/testharness.htmlhoppipolla.co.uk/talks/ttwf/testharness.html
darobin.github.io/test-harness-tutorial/docs/using-testharness.htmldarobin.github.io/test-harness-tutorial/docs/using-testharness.html

Más contenido relacionado

Destacado

Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Paul Irish
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
Paul Irish
 
How to do presentations that don't induce suicide
How to do presentations that don't induce suicideHow to do presentations that don't induce suicide
How to do presentations that don't induce suicide
Andy Whitlock
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Andrey Breslav
 

Destacado (20)

Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
Rich Typography Options For The Web - or - Why sIFR is Dead in 2009
 
PHPコアから読み解くPHP5.5
PHPコアから読み解くPHP5.5PHPコアから読み解くPHP5.5
PHPコアから読み解くPHP5.5
 
The web - What it has, what it lacks and where it must go
The web - What it has, what it lacks and where it must goThe web - What it has, what it lacks and where it must go
The web - What it has, what it lacks and where it must go
 
RDFa In A Nutshell V2
RDFa In A Nutshell V2RDFa In A Nutshell V2
RDFa In A Nutshell V2
 
jQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & CompressionjQuery Anti-Patterns for Performance & Compression
jQuery Anti-Patterns for Performance & Compression
 
WebRTC: A front-end perspective
WebRTC: A front-end perspectiveWebRTC: A front-end perspective
WebRTC: A front-end perspective
 
Leveraging HTML 5.0
Leveraging HTML 5.0Leveraging HTML 5.0
Leveraging HTML 5.0
 
What HTTP/2.0 Will Do For You
What HTTP/2.0 Will Do For YouWhat HTTP/2.0 Will Do For You
What HTTP/2.0 Will Do For You
 
The $10,000 Paid Content + Paid Linking Test that is 100% Google Safe
The $10,000 Paid Content + Paid Linking Test that is 100% Google SafeThe $10,000 Paid Content + Paid Linking Test that is 100% Google Safe
The $10,000 Paid Content + Paid Linking Test that is 100% Google Safe
 
Bruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of AppsBruce Lawson: Progressive Web Apps: the future of Apps
Bruce Lawson: Progressive Web Apps: the future of Apps
 
How to do presentations that don't induce suicide
How to do presentations that don't induce suicideHow to do presentations that don't induce suicide
How to do presentations that don't induce suicide
 
Intro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS featuresIntro to @viewport & other new Responsive Web Design CSS features
Intro to @viewport & other new Responsive Web Design CSS features
 
Why ARIA? [DevChatt 2010]
Why ARIA? [DevChatt 2010]Why ARIA? [DevChatt 2010]
Why ARIA? [DevChatt 2010]
 
Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)Progressive Enhancement 2.0 (Conference Agnostic)
Progressive Enhancement 2.0 (Conference Agnostic)
 
London React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor CharyparLondon React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor Charypar
 
Digital Body Language
Digital Body Language  Digital Body Language
Digital Body Language
 
Functional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis AtencioFunctional Programming in JavaScript by Luis Atencio
Functional Programming in JavaScript by Luis Atencio
 
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
Map, Flatmap and Reduce are Your New Best Friends: Simpler Collections, Concu...
 
Анонимные записи в Haskell. Никита Волков
Анонимные записи в Haskell. Никита ВолковАнонимные записи в Haskell. Никита Волков
Анонимные записи в Haskell. Никита Волков
 
Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?Who's More Functional: Kotlin, Groovy, Scala, or Java?
Who's More Functional: Kotlin, Groovy, Scala, or Java?
 

Similar a testharness.js の基礎

テスト初心者Androiderのためのソフトウェアテスト入門
テスト初心者Androiderのためのソフトウェアテスト入門テスト初心者Androiderのためのソフトウェアテスト入門
テスト初心者Androiderのためのソフトウェアテスト入門
Satoshi Watanabe
 
TDDを一年やってみました ~シロート集団がTDDをやってはまったこと~
TDDを一年やってみました ~シロート集団がTDDをやってはまったこと~TDDを一年やってみました ~シロート集団がTDDをやってはまったこと~
TDDを一年やってみました ~シロート集団がTDDをやってはまったこと~
Tomomi Kajita
 
Introduction to Continuous Test Runner MakeGood
Introduction to Continuous Test Runner MakeGoodIntroduction to Continuous Test Runner MakeGood
Introduction to Continuous Test Runner MakeGood
Atsuhiro Kubo
 
Continuous delivery chapter4
Continuous delivery chapter4Continuous delivery chapter4
Continuous delivery chapter4
favril1
 
Build insider testingwithvs
Build insider testingwithvsBuild insider testingwithvs
Build insider testingwithvs
Tomoyuki Iwade
 
アジャイル×テスト開発を考える
アジャイル×テスト開発を考えるアジャイル×テスト開発を考える
アジャイル×テスト開発を考える
yasuohosotani
 
Awsで実現するseleniumテスト高速術
Awsで実現するseleniumテスト高速術Awsで実現するseleniumテスト高速術
Awsで実現するseleniumテスト高速術
finoue
 

Similar a testharness.js の基礎 (20)

テスト初心者Androiderのためのソフトウェアテスト入門
テスト初心者Androiderのためのソフトウェアテスト入門テスト初心者Androiderのためのソフトウェアテスト入門
テスト初心者Androiderのためのソフトウェアテスト入門
 
TDDを一年やってみました ~シロート集団がTDDをやってはまったこと~
TDDを一年やってみました ~シロート集団がTDDをやってはまったこと~TDDを一年やってみました ~シロート集団がTDDをやってはまったこと~
TDDを一年やってみました ~シロート集団がTDDをやってはまったこと~
 
テストコードのリファクタリング
テストコードのリファクタリングテストコードのリファクタリング
テストコードのリファクタリング
 
Introduction to Continuous Test Runner MakeGood
Introduction to Continuous Test Runner MakeGoodIntroduction to Continuous Test Runner MakeGood
Introduction to Continuous Test Runner MakeGood
 
Sansan における Android アプリ自動テスト導入事例
Sansan における Android アプリ自動テスト導入事例Sansan における Android アプリ自動テスト導入事例
Sansan における Android アプリ自動テスト導入事例
 
ビルドプロセスとCI #STAC2014
ビルドプロセスとCI #STAC2014ビルドプロセスとCI #STAC2014
ビルドプロセスとCI #STAC2014
 
JUnit実践入門 xUnitTestPatternsで学ぶユニットテスト
JUnit実践入門 xUnitTestPatternsで学ぶユニットテストJUnit実践入門 xUnitTestPatternsで学ぶユニットテスト
JUnit実践入門 xUnitTestPatternsで学ぶユニットテスト
 
Robotium を使った UI テスト
Robotium を使った UI テストRobotium を使った UI テスト
Robotium を使った UI テスト
 
Continuous delivery chapter4
Continuous delivery chapter4Continuous delivery chapter4
Continuous delivery chapter4
 
Build insider testingwithvs
Build insider testingwithvsBuild insider testingwithvs
Build insider testingwithvs
 
サーバーレスでアンケートフォームを作ってみた
サーバーレスでアンケートフォームを作ってみたサーバーレスでアンケートフォームを作ってみた
サーバーレスでアンケートフォームを作ってみた
 
アジャイル×テスト開発を考える
アジャイル×テスト開発を考えるアジャイル×テスト開発を考える
アジャイル×テスト開発を考える
 
Introduction to Continuous Testing
Introduction to Continuous TestingIntroduction to Continuous Testing
Introduction to Continuous Testing
 
テストとの上手な付き合い方
テストとの上手な付き合い方テストとの上手な付き合い方
テストとの上手な付き合い方
 
20161218 selenium study4
20161218 selenium study420161218 selenium study4
20161218 selenium study4
 
Software Test Basic
Software Test BasicSoftware Test Basic
Software Test Basic
 
Azureを使って手軽にブラウザテストの自動化をはじめよう
Azureを使って手軽にブラウザテストの自動化をはじめようAzureを使って手軽にブラウザテストの自動化をはじめよう
Azureを使って手軽にブラウザテストの自動化をはじめよう
 
Awsで実現するseleniumテスト高速術
Awsで実現するseleniumテスト高速術Awsで実現するseleniumテスト高速術
Awsで実現するseleniumテスト高速術
 
Code complete ch22_developper_test
Code complete ch22_developper_testCode complete ch22_developper_test
Code complete ch22_developper_test
 
Microsoft ExcelでWebブラウザ(Selenium WebDriver)を動かした話
Microsoft ExcelでWebブラウザ(Selenium WebDriver)を動かした話Microsoft ExcelでWebブラウザ(Selenium WebDriver)を動かした話
Microsoft ExcelでWebブラウザ(Selenium WebDriver)を動かした話
 

Más de ourmaninjapan

HTML5: APIの活用事例 と 今後の広がり
HTML5: APIの活用事例 と 今後の広がりHTML5: APIの活用事例 と 今後の広がり
HTML5: APIの活用事例 と 今後の広がり
ourmaninjapan
 
HTML5とデバイスの連携: 良いところ、悪いところ、未来のこと
HTML5とデバイスの連携: 良いところ、悪いところ、未来のことHTML5とデバイスの連携: 良いところ、悪いところ、未来のこと
HTML5とデバイスの連携: 良いところ、悪いところ、未来のこと
ourmaninjapan
 
W3C Widgets、どこが面白い?
W3C Widgets、どこが面白い?W3C Widgets、どこが面白い?
W3C Widgets、どこが面白い?
ourmaninjapan
 
W3C Widgets: Why should I care?
W3C Widgets: Why should I care? W3C Widgets: Why should I care?
W3C Widgets: Why should I care?
ourmaninjapan
 
Widgets in theory and in practice
Widgets in theory and in practiceWidgets in theory and in practice
Widgets in theory and in practice
ourmaninjapan
 
Mobile web development without developing a mobile site
Mobile web development without developing a mobile siteMobile web development without developing a mobile site
Mobile web development without developing a mobile site
ourmaninjapan
 
実際のウェブページコーディング
実際のウェブページコーディング 実際のウェブページコーディング
実際のウェブページコーディング
ourmaninjapan
 
スマートTVへの アプローチと制作
スマートTVへの アプローチと制作スマートTVへの アプローチと制作
スマートTVへの アプローチと制作
ourmaninjapan
 

Más de ourmaninjapan (20)

テレビのウェブ開発:その1
テレビのウェブ開発:その1テレビのウェブ開発:その1
テレビのウェブ開発:その1
 
テレビのウェブ開発:その2
テレビのウェブ開発:その2テレビのウェブ開発:その2
テレビのウェブ開発:その2
 
テレビのウェブ開発:その3
テレビのウェブ開発:その3テレビのウェブ開発:その3
テレビのウェブ開発:その3
 
Developing for TV
Developing for TVDeveloping for TV
Developing for TV
 
HTML5概要、コードサンプル
HTML5概要、コードサンプルHTML5概要、コードサンプル
HTML5概要、コードサンプル
 
The status of living HTML (highlights)
The status of living HTML (highlights)The status of living HTML (highlights)
The status of living HTML (highlights)
 
How to read W3C specs
How to read W3C specsHow to read W3C specs
How to read W3C specs
 
HTML5: APIの活用事例 と 今後の広がり
HTML5: APIの活用事例 と 今後の広がりHTML5: APIの活用事例 と 今後の広がり
HTML5: APIの活用事例 と 今後の広がり
 
HTML5とデバイスの連携: 良いところ、悪いところ、未来のこと
HTML5とデバイスの連携: 良いところ、悪いところ、未来のことHTML5とデバイスの連携: 良いところ、悪いところ、未来のこと
HTML5とデバイスの連携: 良いところ、悪いところ、未来のこと
 
Web payments
Web paymentsWeb payments
Web payments
 
W3C Widgets、どこが面白い?
W3C Widgets、どこが面白い?W3C Widgets、どこが面白い?
W3C Widgets、どこが面白い?
 
W3C Widgets: Why should I care?
W3C Widgets: Why should I care? W3C Widgets: Why should I care?
W3C Widgets: Why should I care?
 
Widgets in theory and in practice
Widgets in theory and in practiceWidgets in theory and in practice
Widgets in theory and in practice
 
Mobile web development without developing a mobile site
Mobile web development without developing a mobile siteMobile web development without developing a mobile site
Mobile web development without developing a mobile site
 
実際のウェブページコーディング
実際のウェブページコーディング 実際のウェブページコーディング
実際のウェブページコーディング
 
HTML5: New capabilities, new markup
HTML5: New capabilities, new markupHTML5: New capabilities, new markup
HTML5: New capabilities, new markup
 
small 画面でも、 BIG 画面でも、 今すぐ使えるレスポンシブ活用術
small 画面でも、 BIG 画面でも、 今すぐ使えるレスポンシブ活用術small 画面でも、 BIG 画面でも、 今すぐ使えるレスポンシブ活用術
small 画面でも、 BIG 画面でも、 今すぐ使えるレスポンシブ活用術
 
スマートTVへの アプローチと制作
スマートTVへの アプローチと制作スマートTVへの アプローチと制作
スマートTVへの アプローチと制作
 
「Network Service Discovery API ができました!」 と言われた時
「Network Service Discovery API ができました!」 と言われた時「Network Service Discovery API ができました!」 と言われた時
「Network Service Discovery API ができました!」 と言われた時
 
Presentation Skills
Presentation SkillsPresentation Skills
Presentation Skills
 

Último

Último (10)

論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 

testharness.js の基礎