SlideShare a Scribd company logo
1 of 15
Download to read offline
StarlingをFlexUnitで
ユニットテストしてみる。
FlashBuilderで。
自己紹介
• 宇都宮正宗 1975生まれ。プログラマー。
• @masamunet
• 大阪で、宇都宮ウエブ制作所という屋号でいろいろ
やっています。
あらかじめ謝っておくこと
• Starlingに限った方法ではないこと
• モバイル(AIR for iOS)とも直接関係ないこと
• 厳密にユニットテストというと疑問があること
• FlashBuilderという、限られた開発環境でのお話し
であること
やりたいこと
• 狙ったViewを、FlexUnit環境で表示させたい!
• assertはできなくてもいい
• assertさせたい処理は別クラスで書くので
• 動きのチェックなど、目視でしか判断できないと
ころを繰り返し表示させたいので
どのようにテストするか
• 別プロジェクトにわけてテストする
• やり方がわからなかった…
• プロジェクト内にtestパッケージを作ってその中でテストする
• リファクタリング時に、テストのエラーが残るとコンパイル
出来なくなる
• 厳格に考えればそれでいいのかもしれないけど…
• 今回はこっちでやります
ポインヨ
• 最終的には任意のViewを、Starlingのstageに
addChildしたい
• いかにFlexUnitのstageを参照出来るようにするか
• 別にStarlingに限った話しではないけど…
• 「FlexUnit stage」でぐぐる
• 前提条件が違うのか、どれもうまく動かず…
ポインヨ
• 最終的には、テストケースクラスに、stageを参照
できるようにして、そこに任意のViewをaddChild
させれば何でもよい
• 今回はこのへんを参考にしてみる
http://forum.starling-framework.org/topic/
testing-starling-application-with-flexunit
やってみよう
• FlexUnitのstageを参照出来るようなクラスを作
成。
FlexUnitStarlingIntegration.as
https://github.com/masamunet/
StarlingFlexunitTest/blob/master/test/
FlexUnitStarlingIntegration.as
やってみよう
• テストケースごとにStarlingを初期化する処理を共
通できるように親クラスを作成
TestStarlingDisplayObject.as
https://github.com/masamunet/
StarlingFlexunitTest/blob/master/test/views/
TestStarlingDisplayObject.as
やってみよう
• 各テストケースはTestStarlingDisplayObjectを継承。
• [Before]タグのメソッド内でstart()しとけば、あとは適
当に非同期処理してくれるようにする。
https://github.com/masamunet/StarlingFlexunitTest/
blob/master/test/views/TestGrowthView.as
https://github.com/masamunet/StarlingFlexunitTest/
blob/master/test/views/TestProtrudeView.as
やってみよう
• 自動生成されるFlexUnitApplication.asのコンストラク
タ内に、FlexUnitのstageを参照させるように、次の処
理を追加。
FlexUnitStarlingIntegration.nativeStage = stage;
• これ毎回しないといけないので超めんどい。
https://github.com/masamunet/StarlingFlexunitTest/
blob/master/FlexUnitApplication.as
やってみよう
• FlexUnitApplication-app.xmlのrenderModeを
directに。
<renderMode>direct</renderMode>
• これも毎回勝手に書き換わるので面倒臭くてしぬ。
https://github.com/masamunet/
StarlingFlexunitTest/blob/master/
FlexUnitApplication-app.xml
問題点
• テストケースを変更するたびに、

FlexUnitApplication-app.xml

FlexUnitApplication.as

が勝手に書き換わるので、その都度こちらで手を加
えなければいけない。
• ここのテンプレート触れればいいのだけど…。
• このへんはもしかして、FlashBuilderでなければ解
決できるのかもしれない。
• assertさせないなんてテストじゃないなんて声も聞こえてきそう
だけど、そこはほら、テストスウィートの皮を被ったオレオレテ
ストですから。
• 逆にassertさせにくい、動きの調整を繰り返し行うようなときに
便利。
• そもそも、assertで拾っておきたい処理はviewと切り離してお
くほうがいいのでは?とも思う。
• あとこれだと一発で画面表示できるの便利。
• モバイル開発でANEを導入したあとのタイミングで、実機でしか
動かなくなったときも便利。
ご静聴ありがとう
ございました。

More Related Content

Recently uploaded

Recently uploaded (10)

Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
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 を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
論文紹介: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...
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
論文紹介: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
 
論文紹介: 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デバイス
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

StarlingをFlexUnitで ユニットテストしてみる。