iOS Test Night #3 https://testnight.connpass.com/event/49561/
iOS ։ൃͰͷPull Request ͱςετΧόϨοδͷ࿈ܞiOS Test Night #3by @star__hoshi
View Slide
ΞδΣϯμ• ࣗݾհ• ςετΧόϨοδܭଌ• ϓϧϦΫͱͷ࿈ܞ• ͓·͚
ࣗݾհ• Twitter: @star__hoshi• GitHub: starhoshi• Classiגࣜձࣾ• iOS ΤϯδχΞ
ΧόϨοδͬͯʁϝϦοτʁσϝϦοτʁΧόϨοδΛຬͨ͢ͱ্࣭͕͕ΔͷʁΧόϨοδϙϦεϝϯ
ͱ͍͏͠·ͤΜͳͥͳΒ5͔͠ͳ͍͔Β
࣮ࡍʹܭଌ͢Δͱ͍͏Λ͠·͢
ܥ
Xcode ʹ͓͚ΔΧόϨοδܭଌํ๏
Xcode: EditScheme > XxxTestsGather coverage data ʹνΣοΫೖΕΔ
͜Μͳײ͡Ͱ݁Ռ͕ग़Δ
ϩʔΧϧͰܭଌͰ͖Δ͕ϓϧϦΫʹ࿈ܞ͍ͨ͠
fastlane scan+fastlane action
fastlane scan؆୯ʹςετΛ࣮ߦ (ઃఆϑΝΠϧඞཁ)IUUQTHJUIVCDPNGBTUMBOFGBTUMBOFUSFFNBTUFSTDBO
fastlane action | grep coverage• lcov• xcov• gcovr• slather
nakiostudio/xcovIUUQTHJUIVCDPNOBLJPTUVEJPYDPW
nakiostudio/danger-xcovIUUQTHJUIVCDPNOBLJPTUVEJPEBOHFSYDPW
dangerIUUQEBOHFSTZTUFNTϓϧϦΫʹ merge OK ͔νΣοΫͰ͖Δ
IUUQOJXBUBLPIBUFOBCMPHKQFOUSZ
fastlane scan+danger-xcov+CI Server
gem 'fastlane'gem 'danger-xcov'gem 'danger'Gemfile
scheme "HogeTests"configuration "Staging"device "iPad Retina"workspace "hoge.xcworkspace"clean trueskip_build truefastlane/Scanfile
xcov.report(workspace:"hoge.xcworkspace",scheme:"HogeTests",minimum_coverage_percentage:40)Dangerfileminimum_coverage_percentageΛԼճΔͱ Merge Ͱ͖ͳ͍
lane :test doscandangerendfastlane/Fastfile
test:override:- bundle exec fastlane testCI Ͱ࣮ߦCircleCI Ͱͷྫ:
DANGER_GITHUB_API_TOKENhttps://github.com/settings/tokens/newͰAPIτʔΫϯΛऔಘɺCI Ͱઃఆ
݁Ռ
͍͍͜ͱ• 100% ΛݟΔͱॆ࣮ײ͕͋Δ• ͬͱΔͧ• ✅ ϨϏϡϫʔͷෛ୲ݮ• ςετॻ͍ͯͳ͍ͷ͕ҰॠͰόϨΔ• ݾͷະख़͞Λײ͡Δ ( 43%)
͓·͚
require 'date'max = 90diff = Date.today - Date.new(2017,3,13)min = max > diff ? diff : maxxcov.report(workspace: 'workspace', scheme: 'scheme',minimum_coverage_percentage: min)90ޙʹ90%Λ࣮ݱ͢Δํ๏ຖ1%ͣͭ Merge ͷਫ४Λ্͍͛ͯ͘
Ҏ্