Slide 1

Slide 1 text

RubyMotion 1.15Ͱ௥Ճ͞ΕͨtestपΓͷ࿩ RubyMotion ษڧձ #1 @pchw 12೥7݄25೔ਫ༵೔

Slide 2

Slide 2 text

intro Άͪ @pchw iPhoneΞϓϦͱ͔WebαʔϏεͱ͔ ࡞ͬͯ·͢ http://pchw.github.com/ 12೥7݄25೔ਫ༵೔

Slide 3

Slide 3 text

ͬ͛͢ʔΞοϓσʔτ͕དྷΔͬͯ 12೥7݄25೔ਫ༵೔

Slide 4

Slide 4 text

Viewͱ͔Controllerͱ͔ͷςετͰͨ͠ 12೥7݄25೔ਫ༵೔

Slide 5

Slide 5 text

ͳʹ͕ग़དྷΔͷʁ ͜͜ʹSimulator͕ TestͰάϦάϦಈ͘ಈ ը͕షͬͯ͋ͬͨ 12೥7݄25೔ਫ༵೔

Slide 6

Slide 6 text

12೥7݄25೔ਫ༵೔

Slide 7

Slide 7 text

UIAutomationʹΑΔςετ Objective-CͰΞϓϦॻ͍ͯΔਓ ͸࣮͸લ͔Βग़དྷͯͨ 12೥7݄25೔ਫ༵೔

Slide 8

Slide 8 text

12೥7݄25೔ਫ༵೔

Slide 9

Slide 9 text

UIAutomationʹΑΔςετ͕Մೳʹ •ObjC •࣮͸લ͔Βग़དྷͯͨ •Ͱ΋javascript •RubyMotion •ΞϓϦ => Ruby •ςετ => Ruby 12೥7݄25೔ਫ༵೔

Slide 10

Slide 10 text

ࣗಈԽग़དྷΔૢ࡞ view event tap flick pinch drag rotate device event rotate acceleration shake 12೥7݄25೔ਫ༵೔

Slide 11

Slide 11 text

४උ(app/app_delegate.rb) class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) return true if RUBYMOTION_ENV == 'test' not for full application acceptance tests. Therefore you should not let the application launch as normal. 12೥7݄25೔ਫ༵೔

Slide 12

Slide 12 text

ॻ͖ํ(spec/***.rb) describe “hoge” do tests it “fugas” do controller.fuga.should == ‘fuga’ end end 12೥7݄25೔ਫ༵೔

Slide 13

Slide 13 text

viewͷࢦఆ describe ‘controlelr has label’ do tests Hoge it ‘has label’ do view(‘hoge’).should.not == nil end end class Hoge < UIViewController def viewDidLoad label = UILabel.alloc.init label.accessibilityLabel = “hoge” end end 12೥7݄25೔ਫ༵೔

Slide 14

Slide 14 text

Ͳ͏΍ͬͯݟ͚ͭͯΔͷ def _viewByName(accessibilityLabel) subviews.each do |subview| ʢུʣ 12೥7݄25೔ਫ༵೔

Slide 15

Slide 15 text

ςετ࣮ߦ $ rake spec $ rake spec files=spec/hoge_spec.rb, spec/fuga_spec.rb 12೥7݄25೔ਫ༵೔

Slide 16

Slide 16 text

rm-redgreen Before After 12೥7݄25೔ਫ༵೔

Slide 17

Slide 17 text

reference Writing Test for RubyMotion Appsʢެࣜʣ http://www.rubymotion.com/developer-center/articles/testing/ Functional View and Controller Testing with RubyMotionʢެࣜBlogʣ http://blog.rubymotion.com/post/26489000626/functional-view-and-controller-testing-with-rubymotion HipByte / RubyMotionʢtest/bacon-ui/spec಺ʹTest Sample͕͋Γ·͢ʣ https://github.com/HipByte/RubyMotion rm-redgreen https://github.com/mdks/rm-redgreen 12೥7݄25೔ਫ༵೔